From d303154d91eb916a55ac93a372cbdb918aa18d14 Mon Sep 17 00:00:00 2001 From: vsr Date: Wed, 12 Mar 2008 16:11:49 +0000 Subject: [PATCH] Porting SMESH module to Qt 4 --- adm_local/unix/make_common_starter.am | 12 +- configure.ac | 16 +- src/NETGEN/Makefile.in | 171 - src/NETGEN/ReadMeForNgUsers | 102 - src/NETGEN/netgen43ForSalome.patch | 221 - src/NETGENPlugin/Makefile.in | 67 - src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx | 1083 ----- src/NETGENPlugin/NETGENPlugin_NETGEN_3D.hxx | 62 - src/NETGENPlugin/NETGENPlugin_NETGEN_3D_i.cxx | 85 - src/NETGENPlugin/NETGENPlugin_NETGEN_3D_i.hxx | 58 - src/NETGENPlugin/NETGENPlugin_i.cxx | 60 - src/NETGENPlugin/NETGENPlugin_icons.po | 39 - src/OBJECT/SMESH_Actor.cxx | 5 +- src/OBJECT/SMESH_ActorUtils.h | 11 +- .../SMESH_LogicalFilter.cxx | 7 +- .../SMESH_NumberFilter.cxx | 2 +- .../SMESH_TypeFilter.cxx | 2 +- src/SMESHGUI/Makefile.am | 51 +- src/SMESHGUI/SMESHGUI.cxx | 709 ++- src/SMESHGUI/SMESHGUI.h | 147 +- src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx | 365 +- src/SMESHGUI/SMESHGUI_AddMeshElementDlg.h | 191 +- .../SMESHGUI_AddQuadraticElementDlg.cxx | 436 +- .../SMESHGUI_AddQuadraticElementDlg.h | 189 +- src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx | 331 +- src/SMESHGUI/SMESHGUI_BuildCompoundDlg.h | 177 +- src/SMESHGUI/SMESHGUI_ClippingDlg.cxx | 348 +- src/SMESHGUI/SMESHGUI_ClippingDlg.h | 170 +- src/SMESHGUI/SMESHGUI_ComputeDlg.cxx | 587 ++- src/SMESHGUI/SMESHGUI_ComputeDlg.h | 125 +- src/SMESHGUI/SMESHGUI_ConvToQuadDlg.cxx | 112 +- src/SMESHGUI/SMESHGUI_ConvToQuadDlg.h | 82 +- src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx | 70 +- src/SMESHGUI/SMESHGUI_ConvToQuadOp.h | 55 +- src/SMESHGUI/SMESHGUI_CreateHypothesesDlg.h | 96 - src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx | 656 +-- src/SMESHGUI/SMESHGUI_CreatePatternDlg.h | 98 +- .../SMESHGUI_CreatePolyhedralVolumeDlg.cxx | 647 ++- .../SMESHGUI_CreatePolyhedralVolumeDlg.h | 191 +- src/SMESHGUI/SMESHGUI_DeleteGroupDlg.cxx | 179 +- src/SMESHGUI/SMESHGUI_DeleteGroupDlg.h | 79 +- src/SMESHGUI/SMESHGUI_Dialog.cxx | 65 +- src/SMESHGUI/SMESHGUI_Dialog.h | 53 +- src/SMESHGUI/SMESHGUI_Displayer.cxx | 45 +- src/SMESHGUI/SMESHGUI_Displayer.h | 49 +- src/SMESHGUI/SMESHGUI_EditHypothesesDlg.h | 153 - src/SMESHGUI/SMESHGUI_EditMeshDlg.cxx | 571 +-- src/SMESHGUI/SMESHGUI_EditMeshDlg.h | 204 +- .../SMESHGUI_ExtrusionAlongPathDlg.cxx | 484 +- src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h | 232 +- src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx | 399 +- src/SMESHGUI/SMESHGUI_ExtrusionDlg.h | 188 +- src/SMESHGUI/SMESHGUI_Filter.cxx | 72 +- src/SMESHGUI/SMESHGUI_Filter.h | 134 +- src/SMESHGUI/SMESHGUI_FilterDlg.cxx | 1409 +++--- src/SMESHGUI/SMESHGUI_FilterDlg.h | 261 +- src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx | 384 +- src/SMESHGUI/SMESHGUI_FilterLibraryDlg.h | 123 +- src/SMESHGUI/SMESHGUI_FilterUtils.cxx | 38 +- src/SMESHGUI/SMESHGUI_FilterUtils.h | 57 +- src/SMESHGUI/SMESHGUI_GEOMGenUtils.cxx | 50 +- src/SMESHGUI/SMESHGUI_GEOMGenUtils.h | 62 +- src/SMESHGUI/SMESHGUI_GroupDlg.cxx | 903 ++-- src/SMESHGUI/SMESHGUI_GroupDlg.h | 314 +- src/SMESHGUI/SMESHGUI_GroupOpDlg.cxx | 240 +- src/SMESHGUI/SMESHGUI_GroupOpDlg.h | 79 +- src/SMESHGUI/SMESHGUI_GroupUtils.cxx | 51 +- src/SMESHGUI/SMESHGUI_GroupUtils.h | 64 +- src/SMESHGUI/SMESHGUI_Hypotheses.cxx | 191 +- src/SMESHGUI/SMESHGUI_Hypotheses.h | 223 +- src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx | 256 +- src/SMESHGUI/SMESHGUI_HypothesesUtils.h | 113 +- src/SMESHGUI/SMESHGUI_IdValidator.h | 81 +- src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx | 259 +- src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.h | 89 +- src/SMESHGUI/SMESHGUI_MergeNodesDlg.cxx | 786 --- src/SMESHGUI/SMESHGUI_MergeNodesDlg.h | 150 - src/SMESHGUI/SMESHGUI_MeshDlg.cxx | 275 +- src/SMESHGUI/SMESHGUI_MeshDlg.h | 98 +- src/SMESHGUI/SMESHGUI_MeshEditPreview.cxx | 75 +- src/SMESHGUI/SMESHGUI_MeshEditPreview.h | 65 +- src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx | 465 +- src/SMESHGUI/SMESHGUI_MeshInfosDlg.h | 205 +- src/SMESHGUI/SMESHGUI_MeshOp.cxx | 267 +- src/SMESHGUI/SMESHGUI_MeshOp.h | 113 +- src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx | 507 +- src/SMESHGUI/SMESHGUI_MeshPatternDlg.h | 104 +- src/SMESHGUI/SMESHGUI_MeshUtils.cxx | 89 +- src/SMESHGUI/SMESHGUI_MeshUtils.h | 73 +- src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx | 221 +- src/SMESHGUI/SMESHGUI_MoveNodesDlg.h | 88 +- src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx | 488 +- src/SMESHGUI/SMESHGUI_MultiEditDlg.h | 97 +- src/SMESHGUI/SMESHGUI_NodesDlg.cxx | 596 ++- src/SMESHGUI/SMESHGUI_NodesDlg.h | 159 +- src/SMESHGUI/SMESHGUI_Operation.cxx | 91 +- src/SMESHGUI/SMESHGUI_Operation.h | 67 +- src/SMESHGUI/SMESHGUI_PatternUtils.cxx | 48 +- src/SMESHGUI/SMESHGUI_PatternUtils.h | 61 +- src/SMESHGUI/SMESHGUI_PatternWidget.cxx | 156 +- src/SMESHGUI/SMESHGUI_PatternWidget.h | 99 +- src/SMESHGUI/SMESHGUI_PrecisionDlg.h | 99 - .../SMESHGUI_Preferences_ColorDlg.cxx | 436 +- src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.h | 130 +- .../SMESHGUI_Preferences_ScalarBarDlg.cxx | 756 ++- .../SMESHGUI_Preferences_ScalarBarDlg.h | 165 +- .../SMESHGUI_Preferences_SelectionDlg.cxx | 309 -- .../SMESHGUI_Preferences_SelectionDlg.h | 101 - src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx | 373 +- src/SMESHGUI/SMESHGUI_RemoveElementsDlg.h | 167 +- src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx | 362 +- src/SMESHGUI/SMESHGUI_RemoveNodesDlg.h | 172 +- src/SMESHGUI/SMESHGUI_RenumberingDlg.cxx | 388 +- src/SMESHGUI/SMESHGUI_RenumberingDlg.h | 162 +- src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx | 488 +- src/SMESHGUI/SMESHGUI_RevolutionDlg.h | 236 +- src/SMESHGUI/SMESHGUI_RotationDlg.cxx | 493 +- src/SMESHGUI/SMESHGUI_RotationDlg.h | 233 +- src/SMESHGUI/SMESHGUI_SMESHGenUtils.cxx | 43 - src/SMESHGUI/SMESHGUI_SMESHGenUtils.h | 35 - src/SMESHGUI/SMESHGUI_Selection.cxx | 151 +- src/SMESHGUI/SMESHGUI_Selection.h | 90 +- src/SMESHGUI/SMESHGUI_SelectionOp.cxx | 87 +- src/SMESHGUI/SMESHGUI_SelectionOp.h | 103 +- src/SMESHGUI/SMESHGUI_SewingDlg.cxx | 485 +- src/SMESHGUI/SMESHGUI_SewingDlg.h | 209 +- src/SMESHGUI/SMESHGUI_ShapeByMeshDlg.cxx | 320 +- src/SMESHGUI/SMESHGUI_ShapeByMeshDlg.h | 81 +- src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx | 205 +- src/SMESHGUI/SMESHGUI_SingleEditDlg.h | 92 +- src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx | 385 +- src/SMESHGUI/SMESHGUI_SmoothingDlg.h | 197 +- src/SMESHGUI/SMESHGUI_SpinBox.cxx | 102 +- src/SMESHGUI/SMESHGUI_SpinBox.h | 75 +- .../SMESHGUI_StandardMeshInfosDlg.cxx | 217 +- src/SMESHGUI/SMESHGUI_StandardMeshInfosDlg.h | 110 +- src/SMESHGUI/SMESHGUI_Swig.hxx | 80 - src/SMESHGUI/SMESHGUI_Swig.i | 79 - src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx | 516 +- src/SMESHGUI/SMESHGUI_SymmetryDlg.h | 231 +- src/SMESHGUI/SMESHGUI_TranslationDlg.cxx | 486 +- src/SMESHGUI/SMESHGUI_TranslationDlg.h | 227 +- src/SMESHGUI/SMESHGUI_TransparencyDlg.cxx | 329 +- src/SMESHGUI/SMESHGUI_TransparencyDlg.h | 87 +- src/SMESHGUI/SMESHGUI_Utils.cxx | 116 +- src/SMESHGUI/SMESHGUI_Utils.h | 106 +- src/SMESHGUI/SMESHGUI_VTKUtils.cxx | 118 +- src/SMESHGUI/SMESHGUI_VTKUtils.h | 172 +- src/SMESHGUI/SMESHGUI_WhatIsDlg.cxx | 301 +- src/SMESHGUI/SMESHGUI_WhatIsDlg.h | 139 +- src/SMESHGUI/SMESHGUI_XmlHandler.cxx | 81 +- src/SMESHGUI/SMESHGUI_XmlHandler.h | 88 +- src/SMESHGUI/SMESHGUI_aParameter.h | 470 -- src/SMESHGUI/SMESH_SMESHGUI.hxx | 46 +- src/SMESHGUI/SMESH_icons.ts | 222 + src/SMESHGUI/SMESH_images.ts | 406 ++ src/SMESHGUI/SMESH_msg_en.ts | 4246 +++++++++++++++++ src/SMESH_I/Makefile.am | 8 +- src/SMESH_SWIG_WITHIHM/Makefile.am | 50 +- .../libSMESH_Swig.cxx} | 107 +- src/SMESH_SWIG_WITHIHM/libSMESH_Swig.h | 83 + src/SMESH_SWIG_WITHIHM/libSMESH_Swig.i | 96 +- src/StdMeshersGUI/SMESH_StdMeshersGUI.hxx | 47 +- src/StdMeshersGUI/StdMeshersGUI.cxx | 42 +- .../StdMeshersGUI_DistrPreview.cxx | 84 +- .../StdMeshersGUI_DistrPreview.h | 22 +- .../StdMeshersGUI_DistrTable.cxx | 794 +-- src/StdMeshersGUI/StdMeshersGUI_DistrTable.h | 150 +- ...tdMeshersGUI_LayerDistributionParamWdg.cxx | 106 +- .../StdMeshersGUI_LayerDistributionParamWdg.h | 71 +- .../StdMeshersGUI_NbSegmentsCreator.cxx | 157 +- .../StdMeshersGUI_NbSegmentsCreator.h | 41 +- .../StdMeshersGUI_ObjectReferenceParamWdg.cxx | 94 +- .../StdMeshersGUI_ObjectReferenceParamWdg.h | 57 +- .../StdMeshersGUI_StdHypothesisCreator.cxx | 131 +- .../StdMeshersGUI_StdHypothesisCreator.h | 47 +- src/StdMeshersGUI/StdMeshers_images.ts | 190 + src/StdMeshersGUI/StdMeshers_msg_en.ts | 297 ++ 178 files changed, 20423 insertions(+), 20287 deletions(-) delete mode 100644 src/NETGEN/Makefile.in delete mode 100644 src/NETGEN/ReadMeForNgUsers delete mode 100644 src/NETGEN/netgen43ForSalome.patch delete mode 100644 src/NETGENPlugin/Makefile.in delete mode 100644 src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx delete mode 100644 src/NETGENPlugin/NETGENPlugin_NETGEN_3D.hxx delete mode 100644 src/NETGENPlugin/NETGENPlugin_NETGEN_3D_i.cxx delete mode 100644 src/NETGENPlugin/NETGENPlugin_NETGEN_3D_i.hxx delete mode 100644 src/NETGENPlugin/NETGENPlugin_i.cxx delete mode 100644 src/NETGENPlugin/NETGENPlugin_icons.po delete mode 100644 src/SMESHGUI/SMESHGUI_CreateHypothesesDlg.h delete mode 100644 src/SMESHGUI/SMESHGUI_EditHypothesesDlg.h delete mode 100644 src/SMESHGUI/SMESHGUI_MergeNodesDlg.cxx delete mode 100644 src/SMESHGUI/SMESHGUI_MergeNodesDlg.h delete mode 100755 src/SMESHGUI/SMESHGUI_PrecisionDlg.h delete mode 100644 src/SMESHGUI/SMESHGUI_Preferences_SelectionDlg.cxx delete mode 100644 src/SMESHGUI/SMESHGUI_Preferences_SelectionDlg.h delete mode 100644 src/SMESHGUI/SMESHGUI_SMESHGenUtils.cxx delete mode 100644 src/SMESHGUI/SMESHGUI_SMESHGenUtils.h delete mode 100644 src/SMESHGUI/SMESHGUI_Swig.hxx delete mode 100644 src/SMESHGUI/SMESHGUI_Swig.i delete mode 100644 src/SMESHGUI/SMESHGUI_aParameter.h create mode 100644 src/SMESHGUI/SMESH_icons.ts create mode 100644 src/SMESHGUI/SMESH_images.ts create mode 100644 src/SMESHGUI/SMESH_msg_en.ts rename src/{SMESHGUI/SMESHGUI_Swig.cxx => SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx} (89%) create mode 100644 src/SMESH_SWIG_WITHIHM/libSMESH_Swig.h create mode 100644 src/StdMeshersGUI/StdMeshers_images.ts create mode 100644 src/StdMeshersGUI/StdMeshers_msg_en.ts diff --git a/adm_local/unix/make_common_starter.am b/adm_local/unix/make_common_starter.am index 533941331..17b81f031 100644 --- a/adm_local/unix/make_common_starter.am +++ b/adm_local/unix/make_common_starter.am @@ -19,12 +19,12 @@ salomeidldir = $(prefix)/idl/@PACKAGE@ salomeresdir = $(prefix)/share/@PACKAGE@/resources/@MODULE_NAME@ # Directories for installing admin files -admlocaldir = $(prefix)/adm_local -admlocalunixdir = $(admlocaldir)/unix -admlocalm4dir = $(admlocaldir)/unix/config_files +admlocaldir = $(prefix)/adm_local +admlocalunixdir = $(admlocaldir)/unix +admlocalm4dir = $(admlocaldir)/unix/config_files # Shared modules installation directory -sharedpkgpythondir =$(pkgpythondir)/shared_modules +sharedpkgpythondir = $(pkgpythondir)/shared_modules # Documentation directory docdir = $(datadir)/doc/@PACKAGE@ @@ -36,8 +36,8 @@ docdir = $(datadir)/doc/@PACKAGE@ $(MOC) $< -o $@ # qm-files generation -%.qm: %.po - $(MSG2QM) $< $@ +%.qm: %.ts + $(LRELEASE) $< -qm $@ EXTRA_DIST=$(MOC_FILES:%_moc.cxx=%.h) $(nodist_salomeres_DATA:%.qm=%.po) diff --git a/configure.ac b/configure.ac index 63eca7ec2..e4b55443e 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,7 @@ # -AC_INIT([Salome2 Project SMESH module], [4.1.1], [webmaster.salome@opencascade.com], [salome]) +AC_INIT([Salome2 Project SMESH module], [5.0.0], [webmaster.salome@opencascade.com], [salome]) AC_CONFIG_AUX_DIR(salome_adm/unix/config_files) AC_CANONICAL_HOST AC_CANONICAL_TARGET @@ -198,18 +198,6 @@ SMESH_WITH_GUI=yes AM_CONDITIONAL(SMESH_ENABLE_GUI, [test "${SMESH_WITH_GUI}" = "yes"]) -if test "${SMESH_WITH_GUI}" = "yes"; then - -echo -echo --------------------------------------------- -echo testing msg2qm -echo --------------------------------------------- -echo - -CHECK_MSG2QM - -fi - if test "x${GUI_DISABLE_CORBA}" != "xyes" ; then echo echo --------------------------------------------- @@ -374,7 +362,7 @@ echo echo Configure if test "${SMESH_WITH_GUI}" = "yes"; then -variables="cc_ok fortran_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok occ_ok doxygen_ok graphviz_ok qwt_ok Kernel_ok Geom_ok Med_ok" +variables="cc_ok fortran_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok occ_ok doxygen_ok graphviz_ok qwt_ok Kernel_ok Geom_ok Med_ok SalomeGUI_ok" fi if test "${SMESH_WITH_GUI}" = "no"; then diff --git a/src/NETGEN/Makefile.in b/src/NETGEN/Makefile.in deleted file mode 100644 index dd6e419c7..000000000 --- a/src/NETGEN/Makefile.in +++ /dev/null @@ -1,171 +0,0 @@ -# Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# -* Makefile *- -# -# Author : Nadir Bouhamou (CEA) -# Module : SMESH -# Date : 10/10/2003 -# -# - -# source path -top_srcdir=@top_srcdir@ -top_builddir=../.. -srcdir=@srcdir@ -VPATH=.:@srcdir@ - -@COMMENCE@ - -# Libraries targets -LIB = libNETGEN.la - -# additionnal information to compil and link file -CPPFLAGS += -DSOLIDGEOM -DLINUX $(OCC_INCLUDES) -CXXFLAGS += -DSOLIDGEOM -DLINUX $(OCC_CXXFLAGS) - -LDFLAGS += $(OCC_KERNEL_LIBS) $(OCC_MODELER_LIBS) -lg2c - -NETGEN_LIBS_DIR=@NETGEN_LIBS_DIR@ - -LIB_OBJ_O = linopt.o \ - bfgs.o \ - linsearch.o \ - global.o \ - bisect.o \ - meshtool.o \ - refine.o \ - ruler3.o \ - improve3.o \ - adfront3.o \ - tetrarls.o \ - prism2rls.o \ - pyramidrls.o \ - pyramid2rls.o \ - netrule3.o \ - ruler2.o \ - meshclass.o \ - improve2.o \ - adfront2.o \ - netrule2.o \ - triarls.o \ - geomsearch.o \ - secondorder.o \ - meshtype.o \ - parser3.o \ - quadrls.o \ - specials.o \ - parser2.o \ - meshing2.o \ - meshing3.o \ - meshfunc.o \ - localh.o \ - improve2gen.o \ - delaunay.o \ - boundarylayer.o \ - msghandler.o \ - meshfunc2d.o \ - smoothing2.o \ - smoothing3.o \ - topology.o \ - curvedelems.o \ - clusters.o \ - zrefine.o \ - ngexception.o \ - geomtest3d.o \ - geom2d.o \ - geom3d.o \ - adtree.o \ - transform3d.o \ - geomfuncs.o \ - polynomial.o \ - densemat.o \ - vector.o \ - basemat.o \ - sparsmat.o \ - algprim.o \ - brick.o \ - manifold.o \ - bspline2d.o \ - meshsurf.o \ - csgeom.o \ - polyhedra.o \ - curve2d.o \ - singularref.o \ - edgeflw.o \ - solid.o \ - explicitcurve2d.o \ - specpoin.o \ - gencyl.o \ - revolution.o \ - genmesh.o \ - spline3d.o \ - surface.o \ - identify.o \ - triapprox.o \ - meshstlsurface.o \ - stlline.o \ - stltopology.o \ - stltool.o \ - stlgeom.o \ - stlgeomchart.o \ - stlgeommesh.o \ - table.o \ - optmem.o \ - spbita2d.o \ - hashtabl.o \ - sort.o \ - flags.o \ - seti.o \ - bitarray.o \ - array.o \ - symbolta.o \ - mystring.o \ - moveablemem.o \ - spline2d.o \ - splinegeometry2.o \ - ngnewdelete.o \ - nglib.o - -$(LIB_OBJ_O): - ar x $(NETGEN_LIBS_DIR)/libnginterface.a - ar x $(NETGEN_LIBS_DIR)/libcsg.a - ar x $(NETGEN_LIBS_DIR)/libgprim.a - ar x $(NETGEN_LIBS_DIR)/libmesh.a - ar x $(NETGEN_LIBS_DIR)/libopti.a - ar x $(NETGEN_LIBS_DIR)/libgen.a - ar x $(NETGEN_LIBS_DIR)/libla.a - ar x $(NETGEN_LIBS_DIR)/libstlgeom.a - ar x $(NETGEN_LIBS_DIR)/libgeom2d.a - rm -rf sgparser.o hprefinement.o parthreads.o writediffpack.o writepermas.o writeuser.o dynamicmem.o importsolution.o readuser.o writefeap.o writetecplot.o wuchemnitz.o extrusion.o writeabaqus.o writefluent.o writetochnog.o csgparser.o geom2dmesh.o - -LIB_OBJ_LO = $(LIB_OBJ_O:%.o=%.lo) - -#implicits rules - -.o.lo: - ln -s $< $@ || true - -@CONCLUDE@ - -$(LIB): $(LIB_OBJ_O) $(LIB_OBJ_LO) - @$(LT) --mode=link $(CXX) -rpath $(libdir) -o $@ $(CXXFLAGS) $(LIB_OBJ_LO) $(LDFLAGS) $(LIBS) - -mostlyclean: cleandep - -$(RM) $(LIB_OBJ_O) $(LIB_OBJ_LO) diff --git a/src/NETGEN/ReadMeForNgUsers b/src/NETGEN/ReadMeForNgUsers deleted file mode 100644 index 555eb9716..000000000 --- a/src/NETGEN/ReadMeForNgUsers +++ /dev/null @@ -1,102 +0,0 @@ -The Netgen 4.3 from the web location : http://www.hpfem.jku.at/netgen/ is used -in the SMESH Module of Salome2 distribution. - -How to build Netgen for Salome ------------------------------- - -Patch the official netgen 4.3 distribution: - -$ cd netgen43 -$ patch -p1 < patch_directory/netgen43ForSalome.patch - -Then run makeForSalome.sh: -$ sh makeForSalome.sh - - -Additional information for maintainers --------------------------------------- - -The SMESH Engine of SALOME2 (particularly the m4 file check_Netgen.m4) assume -that Netgen is installed in the directory as follow: - -prompt> ls - -bin/ cshrc_for_netgen doc/ include/ lib/ tutorials/ - -prompt> ls /bin - -LINUX/ - -prompt> ls /bin/LINUX/ - -demoapp/ ng ng.tcl ngtcltk/ startup.tcl - -prompt> ls /bin/LINUX/demoapp/ - -demoapp.tcl - -prompt> ls /bin/LINUX/ngtcltk/ - -dialog.tcl menustat.tcl ngicon.tcl parameters.tcl -drawing.tcl nghelp.tcl ngvisual.tcl variables.tcl - -prompt> ls /doc/ - -ng4.pdf usenetgen.ps - -prompt> ls /include/ - -nglib.h - -prompt> ls /lib/ - -LINUX/ - -prompt> ls /lib/LINUX/ - -libcsg.a libgeom2d.a libla.a libnginterface.a libstlgeom.a -libgen.a libgprim.a libmesh.a libopti.a libvis.a - -prompt> ls /tutorials/ - -boxcyl.geo cylinder.geo ficherea.geo part1.stl square.in2d -cone.geo cylsphere.geo hinge.stl sculpture.geo trafo.geo -cubeandspheres.geo demo2d.in2d lshape3d.geo shaft.geo twobricks.geo -cube.geo ellipsoid.geo manyholes.geo sphere.geo twocubes.geo -cubemcyl.geo ellipticcyl.geo matrix.geo sphereincube.geo twocyl.geo -cubemsphere.geo - -All *.tcl files are needed to control and initiate the Netgen mesher throughout its -MHI (Machine Human Interface)./bin/LINUX/ng is the Netgen -executable with its embarked MHI. All the libraries *.a should be compiled without -the option -DOPENGL which is only needed for the Netgen MHI. netgen43 is assumed to -be the directory downloaded from the above web location archive of Netgen. The library -/lib/LINUX/libnginterface.a should contain the objects -nglib.o (from netgen43/libsrc/interface/nglib.cpp) and ngnewdelete.o -(from netgen43/ngtcltk/ngnewdelete.cpp). - -To have that kind of distribution from the version in the above web location you -should first compile Netgen as suggested in the netgen43/README.INSTALL file. It will -then produce the executable ng linked statically with the libraries *.a. Then modify -the Makefiles to remove -DOPENGL from compiler flags list, add the objects nglib.o -and ngnewdelete.o to the library libnginterface.a and recompile the libraries only. - -From the above web location perhaps, you will have to alter some Netgen sources to -compile them; if you find any difficulties to do that, just ask me. - -Nadir - -******************************** -* Dr Nadir Bouhamou * -* Ingénieur-chercheur * -* Engineer-Researcher * -* * -* CEA Saclay * -* DEN/DM2S/SFME/LGLS * -* Bat 454 Pièce 5A * -* 91191 Gif-Sur-Yvette cédex * -* * -* Tél: +33 (0)1 69 08 73 07 * -* Fax: +33 (0)1 69 08 96 96 * -* email: nadir.bouhamou@cea.fr * -******************************** diff --git a/src/NETGEN/netgen43ForSalome.patch b/src/NETGEN/netgen43ForSalome.patch deleted file mode 100644 index 5e08d8804..000000000 --- a/src/NETGEN/netgen43ForSalome.patch +++ /dev/null @@ -1,221 +0,0 @@ -diff -N -r -u netgen43/libsrc/include/spline2d.hpp /tmp/netgen43/libsrc/include/spline2d.hpp ---- netgen43/libsrc/include/spline2d.hpp 1970-01-01 01:00:00.000000000 +0100 -+++ /tmp/netgen43/libsrc/include/spline2d.hpp 2003-12-10 16:28:12.000000000 +0100 -@@ -0,0 +1 @@ -+#include "../geom2d/spline2d.hpp" -diff -N -r -u netgen43/libsrc/include/splinegeometry2.hpp /tmp/netgen43/libsrc/include/splinegeometry2.hpp ---- netgen43/libsrc/include/splinegeometry2.hpp 1970-01-01 01:00:00.000000000 +0100 -+++ /tmp/netgen43/libsrc/include/splinegeometry2.hpp 2003-12-10 16:28:23.000000000 +0100 -@@ -0,0 +1 @@ -+#include "../geom2d/splinegeometry2.hpp" -diff -N -r -u netgen43/libsrc/interface/Makefile /tmp/netgen43/libsrc/interface/Makefile ---- netgen43/libsrc/interface/Makefile 2003-05-07 16:01:43.000000000 +0200 -+++ /tmp/netgen43/libsrc/interface/Makefile 2003-12-10 15:59:47.000000000 +0100 -@@ -1,4 +1,4 @@ --src = nginterface.cpp writeuser.cpp writediffpack.cpp writeabaqus.cpp writefluent.cpp writepermas.cpp writetochnog.cpp writetecplot.cpp wuchemnitz.cpp writetochnog.cpp writefeap.cpp readuser.cpp importsolution.cpp -+src = writeuser.cpp writediffpack.cpp writeabaqus.cpp writefluent.cpp writepermas.cpp writetochnog.cpp writetecplot.cpp wuchemnitz.cpp writetochnog.cpp writefeap.cpp readuser.cpp importsolution.cpp nglib.cpp ngnewdelete.cpp - # - lib = nginterface - libpath = libsrc/interface -diff -N -r -u netgen43/libsrc/interface/nglib.cpp /tmp/netgen43/libsrc/interface/nglib.cpp ---- netgen43/libsrc/interface/nglib.cpp 2003-05-07 16:01:43.000000000 +0200 -+++ /tmp/netgen43/libsrc/interface/nglib.cpp 2003-12-10 16:32:54.000000000 +0100 -@@ -23,6 +23,20 @@ - - #include "nglib.h" - -+namespace netgen -+{ -+ char geomfilename [100]; -+ -+ //Destination for messages, errors, ... -+ void Ng_PrintDest(const char * s) -+ { -+ (*mycout) << s << flush; -+ } -+ -+#include -+#include -+} -+ - using namespace netgen; - - // constants and types: -@@ -171,8 +185,6 @@ - // CSG Geometry - - // FlexLexer * lexer; --char geomfilename [100]; -- - - // 2D Meshing Functions: - -@@ -362,7 +374,18 @@ - cout << "e(" << readedges.Get(i) << "," << readedges.Get(i+1) << ")" << endl; - } - */ -- geo->AddEdges(readedges); -+ -+ ARRAY< Point<3> > readedges1; -+ -+ for (i = 1; i <= readedges.Size(); i++) -+ { -+ Point3d readedgesData = readedges.Get(i); -+ Point <3> readedges1Data = Point<3>(readedgesData.X(),readedgesData.Y(),readedgesData.Z()); -+ -+ readedges1.Append(readedges1Data); -+ } -+ -+ geo->AddEdges(readedges1); - } - - if (geo->GetStatus() == STLTopology::STL_GOOD || geo->GetStatus() == STLTopology::STL_WARNING) return NG_OK; -@@ -472,7 +495,14 @@ - n = Vec3d(nv[0],nv[1],nv[2]); - } - -- readtrias.Append(STLReadTriangle(apts,n)); -+ Point<3> apts1[3]; -+ apts1[0] = Point<3>(p1[0],p1[1],p1[2]); -+ apts1[1] = Point<3>(p2[0],p2[1],p2[2]); -+ apts1[2] = Point<3>(p3[0],p3[1],p3[2]); -+ -+ Vec<3> n1 = Vec<3>(n.X(),n.Y(),n.Z()); -+ -+ readtrias.Append(STLReadTriangle(apts1,n1)); - } - - // add (optional) edges: -@@ -487,30 +517,29 @@ - - // compatibility functions: - --void MyError (const char * ch) -+void netgen::MyError (const char * ch) - { - cerr << ch; - } - --//Destination for messages, errors, ... --void Ng_PrintDest(const char * s) --{ -- (*mycout) << s << flush; --} -- -- --double GetTime () -+double netgen::GetTime () - { - return 0; - } - --void ResetTime () -+void netgen::ResetTime () - { - ; - } - --void MyBeep (int i) -+void netgen::MyBeep (int i) - { - ; - } - -+void MeshFromSpline2D (SplineGeometry2d & geometry, -+ Mesh *& mesh, -+ MeshingParameters & mp) -+{ -+ MeshFromSpline2D (geometry, mesh, mp); -+} -diff -N -r -u netgen43/libsrc/makefile.mach.LINUX /tmp/netgen43/libsrc/makefile.mach.LINUX ---- netgen43/libsrc/makefile.mach.LINUX 2003-05-07 16:01:43.000000000 +0200 -+++ /tmp/netgen43/libsrc/makefile.mach.LINUX 2003-12-10 15:12:18.000000000 +0100 -@@ -14,7 +14,8 @@ - # - CFLAGS2 = - # pg stands for profiling - also in linkflags2 --CPLUSPLUSFLAGS2 = -O2 -I/usr/X11R6/include -DLINUX -DOPENGL -+#CPLUSPLUSFLAGS2 = -O2 -I/usr/X11R6/include -DLINUX -DOPENGL -+CPLUSPLUSFLAGS2 = -O2 -I/usr/X11R6/include -DLINUX - # -fomit-frame-pointer - # -ffast-math - # -diff -N -r -u netgen43/libsrc/meshing/improve2.cpp /tmp/netgen43/libsrc/meshing/improve2.cpp ---- netgen43/libsrc/meshing/improve2.cpp 2003-05-07 16:01:43.000000000 +0200 -+++ /tmp/netgen43/libsrc/meshing/improve2.cpp 2003-12-10 15:42:00.000000000 +0100 -@@ -3,7 +3,7 @@ - #include "meshing.hpp" - #include - --#include -+/*#include */ - - - namespace netgen -diff -N -r -u netgen43/libsrc/meshing/meshing2.cpp /tmp/netgen43/libsrc/meshing/meshing2.cpp ---- netgen43/libsrc/meshing/meshing2.cpp 2003-05-07 16:01:43.000000000 +0200 -+++ /tmp/netgen43/libsrc/meshing/meshing2.cpp 2003-12-10 15:34:35.000000000 +0100 -@@ -1785,7 +1785,7 @@ - - - #else --void glrender (int wait) -+void netgen::glrender (int wait) - { - ; - } -diff -N -r -u netgen43/libsrc/visualization/stlmeshing.cpp /tmp/netgen43/libsrc/visualization/stlmeshing.cpp ---- netgen43/libsrc/visualization/stlmeshing.cpp 2003-05-07 16:01:43.000000000 +0200 -+++ /tmp/netgen43/libsrc/visualization/stlmeshing.cpp 2003-12-10 15:52:53.000000000 +0100 -@@ -5,7 +5,7 @@ - #include - - #include --#include -+/*#include */ - - namespace netgen - { -diff -N -r -u netgen43/Makefile /tmp/netgen43/Makefile ---- netgen43/Makefile 2003-05-07 16:01:43.000000000 +0200 -+++ /tmp/netgen43/Makefile 2003-12-10 15:11:41.000000000 +0100 -@@ -35,7 +35,8 @@ - .SUFFIXES: .cpp .o - # - # --CPLUSPLUSFLAGS1 = -c -I$(LIBSRC_DIR)/include -DOPENGL -+#CPLUSPLUSFLAGS1 = -c -I$(LIBSRC_DIR)/include -DOPENGL -+CPLUSPLUSFLAGS1 = -c -I$(LIBSRC_DIR)/include - LINKFLAGS1 = -lGL -lGLU -lX11 -lXext -lXmu - # - CPLUSPLUSFLAGS = $(CPLUSPLUSFLAGS1) $(CPLUSPLUSFLAGS2) $(CPLUSPLUSFLAGS3) -diff -N -r -u netgen43/makeForSalome.sh /tmp/netgen43/makeForSalome.sh ---- netgen43/makeForSalome.sh 1970-01-01 01:00:00.000000000 +0100 -+++ /tmp/netgen43/makeForSalome.sh 2004-01-05 12:33:59.000000000 +0100 -@@ -0,0 +1,26 @@ -+#! /bin/sh -+cp ngtcltk/ngnewdelete.* libsrc/interface/ -+ -+MACHINE=LINUX -+export MACHINE -+make -C libsrc/csg -+make -C libsrc/general -+make -C libsrc/geom2d -+make -C libsrc/gprim -+make -C libsrc/interface -+make -C libsrc/linalg -+make -C libsrc/meshing -+make -C libsrc/opti -+make -C libsrc/stlgeom -+ -+if [ ! -d install ] ; then -+ mkdir install -+fi -+ -+cp -r lib install/ -+ -+if [ ! -d install/include ] ; then -+ mkdir install/include -+fi -+ -+cp libsrc/interface/nglib.h install/include diff --git a/src/NETGENPlugin/Makefile.in b/src/NETGENPlugin/Makefile.in deleted file mode 100644 index a17bcf1b7..000000000 --- a/src/NETGENPlugin/Makefile.in +++ /dev/null @@ -1,67 +0,0 @@ -# SMESH NETGENPlugin : implementaion of SMESH idl descriptions -# -# Copyright (C) 2004 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# -# -# File : Makefile.in -# Author : Julia DOROVSKIKH -# Module : SMESH -# $Header$ - -top_srcdir=@top_srcdir@ -top_builddir=../.. -srcdir=@srcdir@ -VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl: - - -@COMMENCE@ - -EXPORT_PYSCRIPTS = - -# .po files to transform in .qm -PO_FILES = NETGENPlugin_icons.po - -# Libraries targets -LIB = libNETGENEngine.la -LIB_SRC = \ - NETGENPlugin_NETGEN_3D.cxx \ - NETGENPlugin_NETGEN_3D_i.cxx \ - NETGENPlugin_i.cxx - -LIB_SERVER_IDL = SMESH_NetgenAlgorithm.idl - -LIB_CLIENT_IDL = SMESH_Gen.idl SMESH_Mesh.idl SMESH_Group.idl - -# Executables targets -BIN = -BIN_SRC = - -# additionnal information to compil and link file -NETGEN_INCLUDES=@NETGEN_INCLUDES@ - -CPPFLAGS+= $(OCC_INCLUDES) $(HDF5_INCLUDES) $(KERNEL_CXXFLAGS) \ - $(GEOM_CXXFLAGS) $(NETGEN_INCLUDES) $(BOOST_CPPFLAGS) -CXXFLAGS+= $(OCC_CXXFLAGS) $(HDF5_INCLUDES) $(KERNEL_CXXFLAGS) \ - $(GEOM_CXXFLAGS) $(NETGEN_INCLUDES) - -LDFLAGS+= $(HDF5_LIBS) -lSMESHimpl -lSMESHEngine -lStdMeshers -lStdMeshersEngine -lNETGEN $(KERNEL_LDFLAGS) $(GEOM_LDFLAGS) -lSalomeGenericObj - -@CONCLUDE@ diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx deleted file mode 100644 index ca46afd0e..000000000 --- a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx +++ /dev/null @@ -1,1083 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -//============================================================================= -// File : NETGENPlugin_NETGEN_3D.cxx -// Moved here from SMESH_NETGEN_3D.cxx -// Created : lundi 27 Janvier 2003 -// Author : Nadir BOUHAMOU (CEA) -// Project : SALOME -// Copyright : CEA 2003 -// $Header$ -//============================================================================= -using namespace std; - -#include "NETGENPlugin_NETGEN_3D.hxx" -#include "SMESH_Gen.hxx" -#include "SMESH_Mesh.hxx" - -#include "SMDS_MeshElement.hxx" -#include "SMDS_MeshNode.hxx" -#include "SMDS_FacePosition.hxx" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "utilities.h" - -/* - Netgen include files -*/ - -#include "nglib.h" - -//============================================================================= -/*! - * - */ -//============================================================================= - -NETGENPlugin_NETGEN_3D::NETGENPlugin_NETGEN_3D(int hypId, int studyId, - SMESH_Gen* gen) - : SMESH_3D_Algo(hypId, studyId, gen) -{ - MESSAGE("NETGENPlugin_NETGEN_3D::NETGENPlugin_NETGEN_3D"); - _name = "NETGEN_3D"; -// _shapeType = TopAbs_SOLID; - _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);// 1 bit /shape type -// MESSAGE("_shapeType octal " << oct << _shapeType); - _compatibleHypothesis.push_back("MaxElementVolume"); - - _maxElementVolume = 0.; - - _hypMaxElementVolume = NULL; -} - -//============================================================================= -/*! - * - */ -//============================================================================= - -NETGENPlugin_NETGEN_3D::~NETGENPlugin_NETGEN_3D() -{ - MESSAGE("NETGENPlugin_NETGEN_3D::~NETGENPlugin_NETGEN_3D"); -} - -//============================================================================= -/*! - * - */ -//============================================================================= - -bool NETGENPlugin_NETGEN_3D::CheckHypothesis - (SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape, - SMESH_Hypothesis::Hypothesis_Status& aStatus) -{ - MESSAGE("NETGENPlugin_NETGEN_3D::CheckHypothesis"); - - _hypMaxElementVolume = NULL; - - list::const_iterator itl; - const SMESHDS_Hypothesis* theHyp; - - const list& hyps = GetUsedHypothesis(aMesh, aShape); - int nbHyp = hyps.size(); - if (!nbHyp) - { - aStatus = SMESH_Hypothesis::HYP_MISSING; - return false; // can't work with no hypothesis - } - - itl = hyps.begin(); - theHyp = (*itl); // use only the first hypothesis - - string hypName = theHyp->GetName(); - int hypId = theHyp->GetID(); - SCRUTE(hypName); - - bool isOk = false; - - if (hypName == "MaxElementVolume") - { - _hypMaxElementVolume = static_cast (theHyp); - ASSERT(_hypMaxElementVolume); - _maxElementVolume = _hypMaxElementVolume->GetMaxVolume(); - isOk =true; - aStatus = SMESH_Hypothesis::HYP_OK; - } - else - aStatus = SMESH_Hypothesis::HYP_INCOMPATIBLE; - - return isOk; -} - -//============================================================================= -/*! - *Here we are going to use the NETGEN mesher - */ -//============================================================================= - -bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape) -{ - MESSAGE("NETGENPlugin_NETGEN_3D::Compute with maxElmentsize = " << _maxElementVolume); - - bool isOk = false; - SMESHDS_Mesh* meshDS = aMesh.GetMeshDS(); - SMESH_subMesh* theSubMesh = aMesh.GetSubMesh(aShape); - //const Handle(SMESHDS_SubMesh)& subMeshDS = theSubMesh->GetSubMeshDS(); - - map netgenToDS; - - MESSAGE("NETGENPlugin_NETGEN_3D::Compute Checking the mesh Faces"); - - // check if all faces were meshed by a triangle mesher (here MESFISTO_2D) - - vector meshFaces; - vector shapeFaces; - - for (TopExp_Explorer exp(aShape,TopAbs_FACE);exp.More();exp.Next()) - { - TopoDS_Shape aShapeFace = exp.Current(); - SMESH_subMesh* aSubMesh = aMesh.GetSubMeshContaining(exp.Current()); - ASSERT (aSubMesh); - int internal_size = meshFaces.size(); - int index = 0; - for (int i = 0;iGetSubShape(); - TopoDS_Shape aFace = shapeFaces[i]; - SMESH_Algo* algoFace = _gen->GetAlgo(aMesh, aShapeFace); - string algoFaceName = algoFace->GetName(); - SCRUTE(algoFaceName); - if (algoFaceName != "MEFISTO_2D") - { - SCRUTE(algoFaceName); - ASSERT(0); - return false; - } - - bool orientationMeshFace = (aFace.Orientation() == aShapeFace.Orientation()); - - const SMESHDS_SubMesh* aSubMeshDSFace = meshFaces[i]->GetSubMeshDS(); - SCRUTE(aSubMeshDSFace); - - int nbNodes = aSubMeshDSFace->NbNodes(); - NbTotOfNodesFaces += nbNodes; - int nbTria = aSubMeshDSFace->NbElements(); - NbTotOfTria += nbTria; - int index = 0; - - MESSAGE("NETGENPlugin_NETGEN_3D::Compute The mesh Face " << (i+1) << " has " << nbNodes << " face internal Nodes, " << nbTria << " triangles"); - - SCRUTE(orientationMeshFace); - - if (orientationMeshFace) - { - MESSAGE("The mesh and face have the same orientation"); - } - else - { - MESSAGE("The mesh and face have different orientations"); - } - - SMDS_NodeIteratorPtr iteratorNodes = aSubMeshDSFace->GetNodes(); - SCRUTE(nbNodes); - index = 0; - while(iteratorNodes->more()) - { - index++; - const SMDS_MeshNode * node = iteratorNodes->next(); -// int nodeId = node->GetID(); -// double nodeX = node->X(); -// double nodeY = node->Y(); -// double nodeZ = node->Z(); -// MESSAGE("NODE -> ID = " << nodeId << " X = " << nodeX << " Y = " << nodeY << " Z = " << nodeZ); - } - - SCRUTE(index); - - SMDS_ElemIteratorPtr iteratorTriangle = aSubMeshDSFace->GetElements(); - - SCRUTE(nbTria); - index = 0; - int numberOfDegeneratedTriangle = 0; - while(iteratorTriangle->more()) - { - index++; - const SMDS_MeshElement * triangle = iteratorTriangle->next(); - int triangleId = triangle->GetID(); - - SMDS_ElemIteratorPtr triangleNodesIt = triangle->nodesIterator(); - - const SMDS_MeshNode * node1 = static_cast(triangleNodesIt->next()); - double node1X = node1->X(); - double node1Y = node1->Y(); - double node1Z = node1->Z(); - - const SMDS_MeshNode * node2 = static_cast(triangleNodesIt->next()); - double node2X = node2->X(); - double node2Y = node2->Y(); - double node2Z = node2->Z(); - - const SMDS_MeshNode * node3 = static_cast(triangleNodesIt->next()); - double node3X = node3->X(); - double node3Y = node3->Y(); - double node3Z = node3->Z(); - - int triangleNode1 = node1->GetID(); - int triangleNode2 = node2->GetID(); - int triangleNode3 = node3->GetID(); - - // Compute the triangle surface - - double vect1 = ((node2Y - node1Y)*(node3Z - node1Z) - (node2Z - node1Z)*(node3Y - node1Y)); - double vect2 = - ((node2X - node1X)*(node3Z - node1Z) - (node2Z - node1Z)*(node3X - node1X)); - double vect3 = ((node2X - node1X)*(node3Y - node1Y) - (node2Y - node1Y)*(node3X - node1X)); - double epsilon = 1.0e-6; - - bool triangleIsDegenerated = ((abs(vect1) ID = " << triangleId << " N1 = " << triangleNode1 << " N2 = " << triangleNode2 << " N3 = " << triangleNode3 << " is degenerated"); -// MESSAGE("NODE -> ID = " << triangleNode1 << " X = " << node1X << " Y = " << node1Y << " Z = " << node1Z); -// MESSAGE("NODE -> ID = " << triangleNode2 << " X = " << node2X << " Y = " << node2Y << " Z = " << node2Z); -// MESSAGE("NODE -> ID = " << triangleNode3 << " X = " << node3X << " Y = " << node3Y << " Z = " << node3Z); - numberOfDegeneratedTriangle++; - } - else - { -// MESSAGE("TRIANGLE -> ID = " << triangleId << " N1 = " << triangleNode1 << " N2 = " << triangleNode2 << " N3 = " << triangleNode3 << " is normal"); - } - } - - if (numberOfDegeneratedTriangle > 0) - MESSAGE("WARNING THERE IS(ARE) " << numberOfDegeneratedTriangle << " degenerated triangle on this face"); - - SCRUTE(index); - } - - - - SCRUTE(NbTotOfTria); - SCRUTE(NbTotOfNodesFaces); - - MESSAGE("NETGENPlugin_NETGEN_3D::Compute Checking the mesh Edges"); - - // check if all edges were meshed by a edge mesher (here Regular_1D) - - vector meshEdges; - for (TopExp_Explorer exp(aShape,TopAbs_EDGE);exp.More();exp.Next()) - { - SMESH_subMesh* aSubMesh = aMesh.GetSubMeshContaining(exp.Current()); - ASSERT (aSubMesh); - int internal_size = meshEdges.size(); - int index = 0; - for (int i = 0;iGetSubShape(); - SMESH_Algo* algoEdge = _gen->GetAlgo(aMesh, aShapeEdge); - string algoEdgeName = algoEdge->GetName(); - SCRUTE(algoEdgeName); - if (algoEdgeName != "Regular_1D") - { - SCRUTE(algoEdgeName); - ASSERT(0); - return false; - } - - const SMESHDS_SubMesh* aSubMeshDSEdge = meshEdges[i]->GetSubMeshDS(); - SCRUTE(aSubMeshDSEdge); - - int nbNodes = aSubMeshDSEdge->NbNodes(); - NbTotOfNodesEdges += nbNodes; - int nbSegs = aSubMeshDSEdge->NbElements(); - NbTotOfSegs += nbSegs; - - MESSAGE("NETGENPlugin_NETGEN_3D::Compute The mesh Edge " << (i+1) << " has " << nbNodes << " edge internal Nodes, " << nbSegs << " segments"); - - SMDS_NodeIteratorPtr iteratorNodes = aSubMeshDSEdge->GetNodes(); - SCRUTE(nbNodes); - int index = 0; - while(iteratorNodes->more()) - { - index++; - const SMDS_MeshNode * node = iteratorNodes->next(); -// int nodeId = node->GetID(); -// double nodeX = node->X(); -// double nodeY = node->Y(); -// double nodeZ = node->Z(); -// MESSAGE("NODE -> ID = " << nodeId << " X = " << nodeX << " Y = " << nodeY << " Z = " << nodeZ); - } - - SCRUTE(index); - } - - SCRUTE(NbTotOfNodesEdges); - SCRUTE(NbTotOfSegs); - - MESSAGE("NETGENPlugin_NETGEN_3D::Compute Checking the mesh Vertices"); - - vector meshVertices; - for (TopExp_Explorer exp(aShape,TopAbs_VERTEX);exp.More();exp.Next()) - { - SMESH_subMesh* aSubMesh = aMesh.GetSubMeshContaining(exp.Current()); - ASSERT (aSubMesh); - int internal_size = meshVertices.size(); - int index = 0; - for (int i = 0;iGetSubShape(); - - const SMESHDS_SubMesh * aSubMeshDSVertex = meshVertices[i]->GetSubMeshDS(); - SCRUTE(aSubMeshDSVertex); - - int nbNodes = aSubMeshDSVertex->NbNodes(); - NbTotOfNodesVertices += nbNodes; - - MESSAGE("NETGENPlugin_NETGEN_3D::Compute The mesh Vertex " << (i+1) << " has " << nbNodes << " Nodes"); - - SMDS_NodeIteratorPtr iteratorNodes = aSubMeshDSVertex->GetNodes(); - SCRUTE(nbNodes); - int index = 0; - while(iteratorNodes->more()) - { - index++; - const SMDS_MeshNode * node = iteratorNodes->next(); -// int nodeId = node->GetID(); -// double nodeX = node->X(); -// double nodeY = node->Y(); -// double nodeZ = node->Z(); -// MESSAGE("NODE -> ID = " << nodeId << " X = " << nodeX << " Y = " << nodeY << " Z = " << nodeZ); - } - - SCRUTE(index); - } - - SCRUTE(NbTotOfNodesVertices); - - MESSAGE("NETGENPlugin_NETGEN_3D::Compute --> Analysis of all shell mesh"); - - vector meshShells; - TopoDS_Shell aShell; - - for (TopExp_Explorer exp(aShape,TopAbs_SHELL);exp.More();exp.Next()) - { - SMESH_subMesh* aSubMesh = aMesh.GetSubMesh(exp.Current()); - ASSERT(aSubMesh); - SCRUTE(aSubMesh); - aShell = TopoDS::Shell(exp.Current()); - meshShells.push_back(aSubMesh); - } - - int numberOfShells = meshShells.size(); - SCRUTE(numberOfShells); - - if (numberOfShells == 1) - { - MESSAGE("NETGENPlugin_NETGEN_3D::Compute Only one shell --> generation of the mesh using directly Netgen"); - - /* - Prepare the Netgen surface mesh from the SMESHDS - */ - - MESSAGE("NETGENPlugin_NETGEN_3D::Compute Prepare the Netgen surface mesh from the SMESHDS"); - - int spaceDimension = 3; - int nbNodesByTri = 3; - int nbNodesByTetra = 4; - - int Netgen_NbOfNodes = NbTotOfNodesFaces + - NbTotOfNodesEdges + - NbTotOfNodesVertices; - int Netgen_NbOfTria = NbTotOfTria; - int Netgen_param2ndOrder = 0; - double Netgen_paramFine = 1.; - double Netgen_paramSize = _maxElementVolume; - - SCRUTE(Netgen_NbOfNodes); - SCRUTE(Netgen_NbOfTria); - - double * Netgen_Coordinates = new double [spaceDimension* - Netgen_NbOfNodes]; - int * listNodeCoresNetgenSmesh = new int [Netgen_NbOfNodes]; - int * Netgen_Connectivity = new int [nbNodesByTri*Netgen_NbOfTria]; - double * Netgen_point = new double [spaceDimension]; - int * Netgen_triangle = new int [nbNodesByTri]; - int * Netgen_tetrahedron = new int [nbNodesByTetra]; - - for (int i=0; iGetSubMeshDS(); - - SMDS_NodeIteratorPtr iteratorNodes = aSubMeshDSVertex->GetNodes(); - - while(iteratorNodes->more()) - { - const SMDS_MeshNode * node = iteratorNodes->next(); - int nodeId = node->GetID(); - double nodeX = node->X(); - double nodeY = node->Y(); - double nodeZ = node->Z(); -// MESSAGE("NODE -> ID = " << nodeId << " X = " << nodeX << " Y = " << nodeY << " Z = " << nodeZ); - listNodeCoresNetgenSmesh[indexNodes] = nodeId; - int index = indexNodes*spaceDimension; - Netgen_Coordinates[index] = nodeX; - Netgen_Coordinates[index+1] = nodeY; - Netgen_Coordinates[index+2] = nodeZ; - netgenToDS[indexNodes] = node; - indexNodes++; - } - } - - for (int i=0; iGetSubMeshDS(); - - SMDS_NodeIteratorPtr iteratorNodes = aSubMeshDSEdge->GetNodes(); - - while(iteratorNodes->more()) - { - const SMDS_MeshNode * node = iteratorNodes->next(); - int nodeId = node->GetID(); - double nodeX = node->X(); - double nodeY = node->Y(); - double nodeZ = node->Z(); -// MESSAGE("NODE -> ID = " << nodeId << " X = " << nodeX << " Y = " << nodeY << " Z = " << nodeZ); - listNodeCoresNetgenSmesh[indexNodes] = node->GetID(); - int index = indexNodes*spaceDimension; - Netgen_Coordinates[index] = node->X(); - Netgen_Coordinates[index+1] = node->Y(); - Netgen_Coordinates[index+2] = node->Z(); - netgenToDS[indexNodes] = node; - indexNodes++; - } - } - - for (int i=0; iGetSubMeshDS(); - - SMDS_NodeIteratorPtr iteratorNodes = aSubMeshDSFace->GetNodes(); - - while(iteratorNodes->more()) - { - const SMDS_MeshNode * node = iteratorNodes->next(); - int nodeId = node->GetID(); - double nodeX = node->X(); - double nodeY = node->Y(); - double nodeZ = node->Z(); -// MESSAGE("NODE -> ID = " << nodeId << " X = " << nodeX << " Y = " << nodeY << " Z = " << nodeZ); - listNodeCoresNetgenSmesh[indexNodes] = nodeId; - int index = indexNodes*spaceDimension; - Netgen_Coordinates[index] = nodeX; - Netgen_Coordinates[index+1] = nodeY; - Netgen_Coordinates[index+2] = nodeZ; - netgenToDS[indexNodes] = node; - indexNodes++; - } - } - - SCRUTE(indexNodes); - - for (int i=0; iGetSubMeshDS(); - - TopoDS_Shape aFace = shapeFaces[i]; - - SMDS_ElemIteratorPtr iteratorTriangle = aSubMeshDSFace->GetElements(); - - TopoDS_Shape aShapeFace = meshFaces[i]->GetSubShape(); - - bool orientationMeshFace = (aFace.Orientation() == aShapeFace.Orientation()); - - SCRUTE(orientationMeshFace); - - if (orientationMeshFace) - { - MESSAGE("The mesh and face have the same orientation"); - - while(iteratorTriangle->more()) - { - const SMDS_MeshElement * triangle = iteratorTriangle->next(); - int triangleId = triangle->GetID(); - - SMDS_ElemIteratorPtr triangleNodesIt = triangle->nodesIterator(); - - int triangleNode1 = (triangleNodesIt->next())->GetID(); - int triangleNode2 = (triangleNodesIt->next())->GetID(); - int triangleNode3 = (triangleNodesIt->next())->GetID(); - -// MESSAGE("TRIANGLE -> ID = " << triangleId << " N1 = " << triangleNode1 << " N2 = " << triangleNode2 << " N3 = " << triangleNode3); - - int N1New = 0; - int N2New = 0; - int N3New = 0; - int index = indexTrias*nbNodesByTri; - - for (int j=0; jmore()) - { - const SMDS_MeshElement * triangle = iteratorTriangle->next(); - int triangleId = triangle->GetID(); - - SMDS_ElemIteratorPtr triangleNodesIt = triangle->nodesIterator(); - - int triangleNode1 = (triangleNodesIt->next())->GetID(); - int triangleNode3 = (triangleNodesIt->next())->GetID(); - int triangleNode2 = (triangleNodesIt->next())->GetID(); - -// MESSAGE("TRIANGLE -> ID = " << triangleId << " N1 = " << triangleNode1 << " N2 = " << triangleNode2 << " N3 = " << triangleNode3); - - int N1New = 0; - int N2New = 0; - int N3New = 0; - int index = indexTrias*nbNodesByTri; - - for (int j=0; j=1) && (Nij<=Netgen_NbOfNodes)); - - nodesUsed[Nij-1] = 1; - Netgen_Connectivity[i*nbNodesByTri+j] = Nij; - } - - for (int i=0; i Adding the New Nodes to SMESHDS"); - - for (int i=0; iAddNode(Netgen_CoordinatesNew[index], - Netgen_CoordinatesNew[index+1], - Netgen_CoordinatesNew[index+2]); - - meshDS->SetNodeInVolume(node, aShell); - - index = i+Netgen_NbOfNodes; - netgenToDS[index] = node; - - listNodeShellCoresNetgenSmesh[i] = node->GetID(); - } - - SCRUTE(Netgen_NbOfNodesNew); - - SCRUTE(netgenToDS.size()); - - for (int i=0; i Adding the New elements (Tetrahedrons) to the SMESHDS"); - - for (int i=0; iAddVolume(node1,node2,node3,node4); - - meshDS->SetMeshElementOnShape(elt, aShell); - } - - /* - Free the memory needed by to generate the Netgen Mesh - */ - - MESSAGE("NETGENPlugin_NETGEN_3D::Compute Free the memory needed by to generate the Netgen Mesh"); - - delete [] Netgen_Coordinates; - delete [] Netgen_Connectivity; - delete [] Netgen_CoordinatesNew; - delete [] Netgen_ConnectivityNew; - delete [] Netgen_point; - delete [] Netgen_triangle; - delete [] Netgen_tetrahedron; - - delete [] listNodeCoresNetgenSmesh; - delete [] listNodeShellCoresNetgenSmesh; - - Ng_DeleteMesh(Netgen_mesh); - Ng_Exit(); - - /* - Verification - */ - - { - MESSAGE("NETGENPlugin_NETGEN_3D::Compute Verification of the Shell mesh"); - - TopoDS_Shape aShapeShell = meshShells[0]->GetSubShape(); - SMESH_Algo* algoShell = _gen->GetAlgo(aMesh, aShapeShell); - string algoShellName = algoShell->GetName(); - SCRUTE(algoShellName); - if (algoShellName != "NETGEN_3D") - { - SCRUTE(algoShellName); - ASSERT(0); - return false; - } - - const SMESHDS_SubMesh * aSubMeshDSShell = meshShells[0]->GetSubMeshDS(); - SCRUTE(&aSubMeshDSShell); - - int nbNodes = aSubMeshDSShell->NbNodes(); - int nbTetra = aSubMeshDSShell->NbElements(); - - MESSAGE("NETGENPlugin_NETGEN_3D::Compute The mesh Shell has " << nbNodes << " shell internal Nodes, " << nbTetra << " tetrahedrons"); - - SMDS_NodeIteratorPtr iteratorNodes = aSubMeshDSShell->GetNodes(); - - SCRUTE(nbNodes); - - int index; - - index = 0; - - while(iteratorNodes->more()) - { - index++; - const SMDS_MeshNode * node = iteratorNodes->next(); - int nodeId = node->GetID(); - double nodeX = node->X(); - double nodeY = node->Y(); - double nodeZ = node->Z(); -// MESSAGE("NODE -> ID = " << nodeId << " X = " << nodeX << " Y = " << nodeY << " Z = " << nodeZ); - } - - SCRUTE(index); - - SMDS_ElemIteratorPtr iteratorTetra = aSubMeshDSShell->GetElements(); - - SCRUTE(nbTetra); - - index = 0; - while(iteratorTetra->more()) - { - index++; - const SMDS_MeshElement * tetra = iteratorTetra->next(); - int tetraId = tetra->GetID(); - - SMDS_ElemIteratorPtr tetraNodesIt = tetra->nodesIterator(); - - int tetraNode1 = (tetraNodesIt->next())->GetID(); - int tetraNode2 = (tetraNodesIt->next())->GetID(); - int tetraNode3 = (tetraNodesIt->next())->GetID(); - int tetraNode4 = (tetraNodesIt->next())->GetID(); - -// MESSAGE("TETRAHEDRON -> ID = " << tetraId << " N1 = " << tetraNode1 << " N2 = " << tetraNode2 << " N3 = " << tetraNode3 << " N4 = " << tetraNode4); - - } - - SCRUTE(index); - } - } - else - { - SCRUTE(numberOfShells); - MESSAGE("NETGENPlugin_NETGEN_3D::Compute ERROR More than one shell ????? "); - return false; - } - - return true; -} - - -//============================================================================= -/*! - * - */ -//============================================================================= - -ostream & NETGENPlugin_NETGEN_3D::SaveTo(ostream & save) -{ - return save; -} - -//============================================================================= -/*! - * - */ -//============================================================================= - -istream & NETGENPlugin_NETGEN_3D::LoadFrom(istream & load) -{ - return load; -} - -//============================================================================= -/*! - * - */ -//============================================================================= - -ostream & operator << (ostream & save, NETGENPlugin_NETGEN_3D & hyp) -{ - return hyp.SaveTo( save ); -} - -//============================================================================= -/*! - * - */ -//============================================================================= - -istream & operator >> (istream & load, NETGENPlugin_NETGEN_3D & hyp) -{ - return hyp.LoadFrom( load ); -} diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.hxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.hxx deleted file mode 100644 index f640b15d0..000000000 --- a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.hxx +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -//============================================================================= -// File : NETGENPlugin_NETGEN_3D.hxx -// Moved here from SMESH_NETGEN_3D.hxx -// Created : lundi 27 Janvier 2003 -// Author : Nadir BOUHAMOU (CEA) -// Project : SALOME -// Copyright : CEA 2003 -// $Header$ -//============================================================================= - -#ifndef _NETGENPlugin_NETGEN_3D_HXX_ -#define _NETGENPlugin_NETGEN_3D_HXX_ - -#include "SMESH_3D_Algo.hxx" -#include "SMESH_Mesh.hxx" -#include "StdMeshers_MaxElementVolume.hxx" -#include "Utils_SALOME_Exception.hxx" - -class NETGENPlugin_NETGEN_3D: public SMESH_3D_Algo -{ -public: - NETGENPlugin_NETGEN_3D(int hypId, int studyId, SMESH_Gen* gen); - virtual ~NETGENPlugin_NETGEN_3D(); - - virtual bool CheckHypothesis(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape, - SMESH_Hypothesis::Hypothesis_Status& aStatus); - - virtual bool Compute(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape); - - ostream & SaveTo(ostream & save); - istream & LoadFrom(istream & load); - friend ostream & operator << (ostream & save, NETGENPlugin_NETGEN_3D & hyp); - friend istream & operator >> (istream & load, NETGENPlugin_NETGEN_3D & hyp); - -protected: - double _maxElementVolume; - - const StdMeshers_MaxElementVolume* _hypMaxElementVolume; -}; - -#endif diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_i.cxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_i.cxx deleted file mode 100644 index 0429bc9c1..000000000 --- a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_i.cxx +++ /dev/null @@ -1,85 +0,0 @@ -// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : NETGENPlugin_NETGEN_3D_i.cxx -// Moved here from SMESH_NETGEN_3D_i.cxx -// Author : Nadir Bouhamou CEA -// Module : SMESH -// $Header$ - -using namespace std; -#include "NETGENPlugin_NETGEN_3D_i.hxx" -#include "SMESH_Gen.hxx" - -#include "Utils_CorbaException.hxx" -#include "utilities.h" - -//============================================================================= -/*! - * NETGENPlugin_NETGEN_3D_i::NETGENPlugin_NETGEN_3D_i - * - * Constructor - */ -//============================================================================= - -NETGENPlugin_NETGEN_3D_i::NETGENPlugin_NETGEN_3D_i( PortableServer::POA_ptr thePOA, - int theStudyId, - ::SMESH_Gen* theGenImpl ) - : SALOME::GenericObj_i( thePOA ), - SMESH_Hypothesis_i( thePOA ), - SMESH_Algo_i( thePOA ), - SMESH_3D_Algo_i( thePOA ) -{ - MESSAGE( "NETGENPlugin_NETGEN_3D_i::NETGENPlugin_NETGEN_3D_i" ); - myBaseImpl = new ::NETGENPlugin_NETGEN_3D( theGenImpl->GetANewId(), - theStudyId, - theGenImpl ); -} - -//============================================================================= -/*! - * NETGENPlugin_NETGEN_3D_i::~NETGENPlugin_NETGEN_3D_i - * - * Destructor - */ -//============================================================================= - -NETGENPlugin_NETGEN_3D_i::~NETGENPlugin_NETGEN_3D_i() -{ - MESSAGE( "NETGENPlugin_NETGEN_3D_i::~NETGENPlugin_NETGEN_3D_i" ); -} - -//============================================================================= -/*! - * NETGENPlugin_NETGEN_3D_i::GetImpl - * - * Get implementation - */ -//============================================================================= - -::NETGENPlugin_NETGEN_3D* NETGENPlugin_NETGEN_3D_i::GetImpl() -{ - MESSAGE( "NETGENPlugin_NETGEN_3D_i::GetImpl" ); - return ( ::NETGENPlugin_NETGEN_3D* )myBaseImpl; -} - diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_i.hxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_i.hxx deleted file mode 100644 index ad0c59b4b..000000000 --- a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D_i.hxx +++ /dev/null @@ -1,58 +0,0 @@ -// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : NETGENPlugin_NETGEN_3D_i.hxx -// Moved here from SMESH_NETGEN_3D_i.hxx -// Author : Nadir Bouhamou CEA -// Module : SMESH -// $Header$ - -#ifndef _NETGENPlugin_NETGEN_3D_I_HXX_ -#define _NETGENPlugin_NETGEN_3D_I_HXX_ - -#include -#include CORBA_SERVER_HEADER(SMESH_NetgenAlgorithm) - -#include "SMESH_3D_Algo_i.hxx" -#include "NETGENPlugin_NETGEN_3D.hxx" - -// ====================================================== -// NETGEN 3d algorithm -// ====================================================== -class NETGENPlugin_NETGEN_3D_i: - public virtual POA_NETGENPlugin::NETGENPlugin_NETGEN_3D, - public virtual SMESH_3D_Algo_i -{ -public: - // Constructor - NETGENPlugin_NETGEN_3D_i( PortableServer::POA_ptr thePOA, - int theStudyId, - ::SMESH_Gen* theGenImpl ); - // Destructor - virtual ~NETGENPlugin_NETGEN_3D_i(); - - // Get implementation - ::NETGENPlugin_NETGEN_3D* GetImpl(); -}; - -#endif diff --git a/src/NETGENPlugin/NETGENPlugin_i.cxx b/src/NETGENPlugin/NETGENPlugin_i.cxx deleted file mode 100644 index 4401a1e54..000000000 --- a/src/NETGENPlugin/NETGENPlugin_i.cxx +++ /dev/null @@ -1,60 +0,0 @@ -// SMESH NETGENPlugin : implementaion of SMESH idl descriptions -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : NETGENPlugin.cxx -// Author : Julia DOROVSKIKH -// Module : SMESH -// $Header$ - -using namespace std; -#include "SMESH_Hypothesis_i.hxx" -#include "SMESH_Gen_i.hxx" - -#include "utilities.h" - -#include "NETGENPlugin_NETGEN_3D_i.hxx" - -//============================================================================= -/*! - * - */ -//============================================================================= - -extern "C" -{ - GenericHypothesisCreator_i* GetHypothesisCreator (const char* aHypName) - { - MESSAGE("GetHypothesisCreator " << aHypName); - - GenericHypothesisCreator_i* aCreator = 0; - - // Hypotheses - - // Algorithms - if (strcmp(aHypName, "NETGEN_3D") == 0) - aCreator = new HypothesisCreator_i; - else ; - - return aCreator; - } -} diff --git a/src/NETGENPlugin/NETGENPlugin_icons.po b/src/NETGENPlugin/NETGENPlugin_icons.po deleted file mode 100644 index 544555e33..000000000 --- a/src/NETGENPlugin/NETGENPlugin_icons.po +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# -# This is a Qt message file in .po format. Each msgid starts with -# a scope. This scope should *NOT* be translated - eg. "Foo::Bar" -# would be translated to "Pub", not "Foo::Pub". -msgid "" -msgstr "" -"Project-Id-Version: PROJECT VERSION\n" -"POT-Creation-Date: 2002-05-28 10:57:43 AM CEST\n" -"PO-Revision-Date: YYYY-MM-DD\n" -"Last-Translator: FULLNAME \n" -"Content-Type: text/plain; charset=iso-8859-1\n" - - -#----------------------------------------------------------- -# ObjectBrowser -#----------------------------------------------------------- - -#mesh_tree_algo_netgen -msgid "ICON_SMESH_TREE_ALGO_NETGEN_3D" -msgstr "mesh_tree_algo_tetra.png" -#msgstr "mesh_tree_algo_netgen.png" diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx index eefc25bf6..cf7628f57 100644 --- a/src/OBJECT/SMESH_Actor.cxx +++ b/src/OBJECT/SMESH_Actor.cxx @@ -32,14 +32,11 @@ #include "SMESH_DeviceActor.h" #include "SMESH_ControlsDef.hxx" #include "VTKViewer_ExtractUnstructuredGrid.h" - -#include +#include "SALOME_InteractiveObject.hxx" #include "SUIT_Session.h" #include "SUIT_ResourceMgr.h" -#include - #include #include #include diff --git a/src/OBJECT/SMESH_ActorUtils.h b/src/OBJECT/SMESH_ActorUtils.h index 0370d60e1..0ed673755 100644 --- a/src/OBJECT/SMESH_ActorUtils.h +++ b/src/OBJECT/SMESH_ActorUtils.h @@ -22,10 +22,7 @@ #include "SMESH_Object.h" -#include -#include - -#include "VTKViewer.h" +#include class vtkUnstructuredGrid; @@ -46,7 +43,7 @@ SMESHOBJECT_EXPORT QColor GetColor( const QString& theSect, const QString& theName, - const QColor&t = QColor() ); + const QColor& = QColor() ); SMESHOBJECT_EXPORT void @@ -55,7 +52,7 @@ SMESHOBJECT_EXPORT int&, int&, int&, - const QColor&t = QColor() ); + const QColor& = QColor() ); SMESHOBJECT_EXPORT void @@ -64,7 +61,7 @@ SMESHOBJECT_EXPORT vtkFloatingPointType&, vtkFloatingPointType&, vtkFloatingPointType&, - const QColor&t = QColor() ); + const QColor& = QColor() ); SMESHOBJECT_EXPORT void diff --git a/src/SMESHFiltersSelection/SMESH_LogicalFilter.cxx b/src/SMESHFiltersSelection/SMESH_LogicalFilter.cxx index 1495c9636..a8afe900c 100644 --- a/src/SMESHFiltersSelection/SMESH_LogicalFilter.cxx +++ b/src/SMESHFiltersSelection/SMESH_LogicalFilter.cxx @@ -27,7 +27,7 @@ // Purpose : Constructor //======================================================================= SMESH_LogicalFilter::SMESH_LogicalFilter (const QList& theFilters, - const int theLogOp) + const int theLogOp) { setFilters(theFilters); setOperation(theLogOp); @@ -47,10 +47,9 @@ SMESH_LogicalFilter::~SMESH_LogicalFilter() //======================================================================= bool SMESH_LogicalFilter::isOk (const SUIT_DataOwner* owner) const { - bool res = true; - for ( QList::const_iterator it = myFilters.begin(); it != myFilters.end() && res; ++it ) + SUIT_SelectionFilter* filter; + foreach( filter, myFilters ) { - SUIT_SelectionFilter* filter = *it; if (myOperation == LO_OR && filter->isOk(owner)) return true; if (myOperation == LO_AND && !filter->isOk(owner)) diff --git a/src/SMESHFiltersSelection/SMESH_NumberFilter.cxx b/src/SMESHFiltersSelection/SMESH_NumberFilter.cxx index 6862c7004..6513be532 100644 --- a/src/SMESHFiltersSelection/SMESH_NumberFilter.cxx +++ b/src/SMESHFiltersSelection/SMESH_NumberFilter.cxx @@ -165,7 +165,7 @@ GEOM::GEOM_Object_ptr SMESH_NumberFilter::getGeom _PTR(Study) study = appStudy->studyDS(); QString entry = owner->entry(); - _PTR(SObject) aSO( study->FindObjectID( (const char*)entry.toLatin1() ) ), aRefSO; + _PTR(SObject) aSO( study->FindObjectID( entry.toLatin1().data() ) ), aRefSO; if( extractReference && aSO && aSO->ReferencedObject( aRefSO ) ) aSO = aRefSO; diff --git a/src/SMESHFiltersSelection/SMESH_TypeFilter.cxx b/src/SMESHFiltersSelection/SMESH_TypeFilter.cxx index a19eb93fc..943e732b3 100644 --- a/src/SMESHFiltersSelection/SMESH_TypeFilter.cxx +++ b/src/SMESHFiltersSelection/SMESH_TypeFilter.cxx @@ -50,7 +50,7 @@ bool SMESH_TypeFilter::isOk (const SUIT_DataOwner* theDataOwner) const _PTR(Study) study = appStudy->studyDS(); QString entry = owner->entry(); - _PTR(SObject) obj (study->FindObjectID((const char*)entry.toLatin1())), aRefSO; + _PTR(SObject) obj (study->FindObjectID(entry.toLatin1().data())), aRefSO; if( extractReference && obj && obj->ReferencedObject( aRefSO ) ) obj = aRefSO; if (!obj) return false; diff --git a/src/SMESHGUI/Makefile.am b/src/SMESHGUI/Makefile.am index e56d1e567..5cddef784 100644 --- a/src/SMESHGUI/Makefile.am +++ b/src/SMESHGUI/Makefile.am @@ -1,38 +1,32 @@ -# SMESH SMESHGUI : GUI for SMESH component +# SMESH SMESHGUI : GUI for SMESH component # -# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. # +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # +# File : Makefile.am +# Author : Alexander BORODIN, Open CASCADE S.A.S. # -# File : Makefile.in -# Author : Nicolas REJNERI -# Modified by : Alexander BORODIN (OCN) - autotools usage -# Module : SMESH -# $Header$ include $(top_srcdir)/adm_local/unix/make_common_starter.am # header files salomeinclude_HEADERS = \ - SMESHGUI_Swig.hxx \ - SMESHGUI_Swig.i \ SMESHGUI.h \ SMESHGUI_Utils.h \ SMESHGUI_Hypotheses.h \ @@ -61,8 +55,6 @@ dist_libSMESH_la_SOURCES = \ SMESHGUI_WhatIsDlg.cxx \ SMESHGUI_Preferences_ColorDlg.cxx \ SMESHGUI_Preferences_ScalarBarDlg.cxx \ - SMESHGUI_Preferences_SelectionDlg.cxx \ - SMESHGUI_Swig.cxx \ SMESHGUI_MoveNodesDlg.cxx \ SMESHGUI_AddMeshElementDlg.cxx \ SMESHGUI_XmlHandler.cxx \ @@ -82,7 +74,6 @@ dist_libSMESH_la_SOURCES = \ SMESHGUI_TranslationDlg.cxx \ SMESHGUI_SymmetryDlg.cxx \ SMESHGUI_SewingDlg.cxx \ - SMESHGUI_MergeNodesDlg.cxx \ SMESHGUI_EditMeshDlg.cxx \ SMESHGUI_Utils.cxx \ SMESHGUI_GEOMGenUtils.cxx \ @@ -127,7 +118,6 @@ MOC_FILES = \ SMESHGUI_WhatIsDlg_moc.cxx \ SMESHGUI_Preferences_ColorDlg_moc.cxx \ SMESHGUI_Preferences_ScalarBarDlg_moc.cxx \ - SMESHGUI_Preferences_SelectionDlg_moc.cxx \ SMESHGUI_MoveNodesDlg_moc.cxx \ SMESHGUI_AddMeshElementDlg_moc.cxx \ SMESHGUI_FilterDlg_moc.cxx \ @@ -145,7 +135,6 @@ MOC_FILES = \ SMESHGUI_TranslationDlg_moc.cxx \ SMESHGUI_SymmetryDlg_moc.cxx \ SMESHGUI_SewingDlg_moc.cxx \ - SMESHGUI_MergeNodesDlg_moc.cxx \ SMESHGUI_EditMeshDlg_moc.cxx \ SMESHGUI_CreatePolyhedralVolumeDlg_moc.cxx \ SMESHGUI_Operation_moc.cxx \ diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 63ad64e37..bc7537e0a 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -1,32 +1,30 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// File : SMESHGUI.cxx +// Author : Nicolas REJNERI, Open CASCADE S.A.S. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// File : SMESHGUI.cxx -// Author : Nicolas REJNERI -// Module : SMESH -// $Header$ +// SMESH includes #include "SMESHGUI.h" - -#include "SMESH_Client.hxx" #include "SMESHGUI_NodesDlg.h" #include "SMESHGUI_TransparencyDlg.h" #include "SMESHGUI_ClippingDlg.h" @@ -38,7 +36,6 @@ #include "SMESHGUI_WhatIsDlg.h" #include "SMESHGUI_Preferences_ColorDlg.h" #include "SMESHGUI_Preferences_ScalarBarDlg.h" -#include "SMESHGUI_Preferences_SelectionDlg.h" #include "SMESHGUI_Hypotheses.h" #include "SMESHGUI_MoveNodesDlg.h" #include "SMESHGUI_AddMeshElementDlg.h" @@ -70,7 +67,6 @@ #include "SMESHGUI_ComputeDlg.h" #include "SMESHGUI_Utils.h" -#include "SMESHGUI_GEOMGenUtils.h" #include "SMESHGUI_MeshUtils.h" #include "SMESHGUI_GroupUtils.h" #include "SMESHGUI_FilterUtils.h" @@ -78,79 +74,62 @@ #include "SMESHGUI_VTKUtils.h" #include "SMESHGUI_HypothesesUtils.h" -#include "SMESH_Actor.h" -#include "SMESH_Object.h" -#include "SMESH_TypeFilter.hxx" +#include +#include +#include -#include "SalomeApp_Tools.h" -#include "SalomeApp_Study.h" -#include "SalomeApp_Application.h" -#include "SalomeApp_CheckFileDlg.h" -#include "SalomeApp_ImportOperation.h" +// SALOME GUI includes +#include +#include +#include +#include -#include "LightApp_DataOwner.h" -#include "LightApp_Preferences.h" -#include "LightApp_VTKSelector.h" -#include "LightApp_Operation.h" -#include "LightApp_UpdateFlags.h" -#include "LightApp_NameDlg.h" +#include +#include +#include +#include +#include #include #include -#include -#include #include -#include "OB_Browser.h" +#include +#include +#include +#include +#include +#include -#include "SUIT_Tools.h" -#include "SUIT_MessageBox.h" -#include "SUIT_ResourceMgr.h" -#include "SUIT_FileDlg.h" -#include "SUIT_Desktop.h" -#include "SUIT_OverrideCursor.h" -#include "SUIT_Study.h" -#include "SUIT_Session.h" +#include +#include -#include "QtxPopupMgr.h" +#include +#include -#include "SALOME_ListIO.hxx" -#include "SALOME_ListIteratorOfListIO.hxx" -#include "SALOME_InteractiveObject.hxx" -#include "SALOME_NamingService.hxx" -#include "SALOME_LifeCycleCORBA.hxx" - -#include "SALOMEconfig.h" +// IDL includes +#include #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) #include CORBA_SERVER_HEADER(SMESH_MeshEditor) -// QT Includes -#define INCLUDE_MENUITEM_DEF -#include -#include -#include -#include +// Qt includes +// #define INCLUDE_MENUITEM_DEF // VSR commented ???????? +#include -// BOOST Includes +// BOOST includes #include -// VTK Includes -#include -#include -#include +// VTK includes #include -#include - -#include "utilities.h" -#include "SALOMEDS_Study.hxx" -#include "SALOMEDSClient_StudyBuilder.hxx" -#include "SALOMEDSClient_SComponent.hxx" +// SALOME KERNEL includes +#include +#include +#include +// OCCT includes #include -using namespace std; - //namespace{ // Declarations //============================================================= @@ -197,19 +176,19 @@ using namespace std; case 112: { aMeshes->length( 1 ); - aMeshes[0] = theComponentMesh->CreateMeshesFromUNV(filename.latin1()); + aMeshes[0] = theComponentMesh->CreateMeshesFromUNV(filename.toLatin1().data()); break; } case 113: { SMESH::DriverMED_ReadStatus res; - aMeshes = theComponentMesh->CreateMeshesFromMED(filename.latin1(),res); + aMeshes = theComponentMesh->CreateMeshesFromMED(filename.toLatin1().data(),res); if ( res != SMESH::DRS_OK ) { wc.suspend(); - SUIT_MessageBox::warn1(SMESHGUI::desktop(), - QObject::tr("SMESH_WRN_WARNING"), - QObject::tr(QString("SMESH_DRS_%1").arg(res)), - QObject::tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(SMESHGUI::desktop(), + QObject::tr("SMESH_WRN_WARNING"), + QObject::tr(QString("SMESH_DRS_%1").arg(res). + toLatin1().data())); aMeshes->length( 0 ); wc.resume(); } @@ -232,10 +211,9 @@ using namespace std; if ( isEmpty ) { wc.suspend(); - SUIT_MessageBox::warn1(SMESHGUI::desktop(), - QObject::tr("SMESH_WRN_WARNING"), - QObject::tr("SMESH_DRS_EMPTY"), - QObject::tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(SMESHGUI::desktop(), + QObject::tr("SMESH_WRN_WARNING"), + QObject::tr("SMESH_DRS_EMPTY")); wc.resume(); } @@ -269,13 +247,12 @@ using namespace std; case 122: { if (aMesh->HasDuplicatedGroupNamesMED()) { - int aRet = SUIT_MessageBox::warn2 + int aRet = SUIT_MessageBox::warning (SMESHGUI::desktop(), QObject::tr("SMESH_WRN_WARNING"), QObject::tr("SMESH_EXPORT_MED_DUPLICATED_GRP").arg(anIObject->getName()), - QObject::tr("SMESH_BUT_YES"), QObject::tr("SMESH_BUT_NO"), - 0, 1, 0); - if (aRet) + SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::Yes); + if (aRet != SUIT_MessageBox::Yes) return; } // PAL18696 @@ -293,13 +270,12 @@ using namespace std; case 123: { if (aMesh->NbPyramids()) { - int aRet = SUIT_MessageBox::warn2 + int aRet = SUIT_MessageBox::warning (SMESHGUI::desktop(), QObject::tr("SMESH_WRN_WARNING"), QObject::tr("SMESH_EXPORT_UNV").arg(anIObject->getName()), - QObject::tr("SMESH_BUT_YES"), QObject::tr("SMESH_BUT_NO"), - 0, 1, 0); - if (aRet) + SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::Yes); + if (aRet != SUIT_MessageBox::Yes) return; } aFilter = QObject::tr("IDEAS files (*.unv)"); @@ -313,21 +289,19 @@ using namespace std; there must be check on others mesh elements not equal triangles */ if (aMesh->NbTriangles() < 1) { - SUIT_MessageBox::warn1 + SUIT_MessageBox::warning (SMESHGUI::desktop(), QObject::tr("SMESH_WRN_WARNING"), - QObject::tr("SMESH_EXPORT_STL1").arg(anIObject->getName()), - QObject::tr("SMESH_BUT_OK")); + QObject::tr("SMESH_EXPORT_STL1").arg(anIObject->getName())); return; } if (!(aMesh->NbElements() - aMesh->NbTriangles())) { - int aRet = SUIT_MessageBox::warn2 + int aRet = SUIT_MessageBox::warning (SMESHGUI::desktop(), QObject::tr("SMESH_WRN_WARNING"), QObject::tr("SMESH_EXPORT_STL2").arg(anIObject->getName()), - QObject::tr("SMESH_BUT_YES"), QObject::tr("SMESH_BUT_NO"), - 0, 1, 0); - if (aRet) + SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::Yes); + if (aRet != SUIT_MessageBox::Yes) return; } @@ -359,9 +333,9 @@ using namespace std; filters.push_back( it.key() ); SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true ); - fd->setCaption( aTitle ); + fd->setWindowTitle( aTitle ); fd->setFilters( filters ); - fd->setSelectedFilter( QObject::tr("STL ASCII (*.stl)") ); + fd->selectFilter( QObject::tr("STL ASCII (*.stl)") ); bool is_ok = false; while (!is_ok) { fd->exec(); @@ -379,10 +353,10 @@ using namespace std; //SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true ); SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg - ( SMESHGUI::desktop(), false, QObject::tr("SMESH_AUTO_GROUPS") ,true, true ); - fd->setCaption( aTitle ); + ( SMESHGUI::desktop(), false, QObject::tr("SMESH_AUTO_GROUPS"), true, true ); + fd->setWindowTitle( aTitle ); fd->setFilters( filters ); - fd->setSelectedFilter( QObject::tr("MED 2.2 (*.med)") ); + fd->selectFilter( QObject::tr("MED 2.2 (*.med)") ); fd->SetChecked(toCreateGroups); bool is_ok = false; while (!is_ok) { @@ -393,13 +367,11 @@ using namespace std; if ( !aFilename.isEmpty() && (aMesh->NbPolygons()>0 || aMesh->NbPolyhedrons()>0) && aFormat==SMESH::MED_V2_1) { - int aRet = SUIT_MessageBox::warn2(SMESHGUI::desktop(), - QObject::tr("SMESH_WRN_WARNING"), - QObject::tr("SMESH_EXPORT_MED_V2_1").arg(anIObject->getName()), - QObject::tr("SMESH_BUT_YES"), - QObject::tr("SMESH_BUT_NO"), - 0,1,0); - if (aRet) { + int aRet = SUIT_MessageBox::warning(SMESHGUI::desktop(), + QObject::tr("SMESH_WRN_WARNING"), + QObject::tr("SMESH_EXPORT_MED_V2_1").arg(anIObject->getName()), + SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::Yes); + if (aRet != SUIT_MessageBox::Yes) { is_ok = false; } } @@ -415,7 +387,7 @@ using namespace std; SUIT_OverrideCursor wc; try { - bool Renumber = false ; + bool Renumber = false; // PAL 14172 : Check of we have to renumber or not from the preferences before export if (resMgr) Renumber= resMgr->booleanValue("SMESH","renumbering"); @@ -429,19 +401,19 @@ using namespace std; switch ( theCommandID ) { case 125: case 122: - aMesh->ExportToMED( aFilename.latin1(), toCreateGroups, aFormat ); + aMesh->ExportToMED( aFilename.toLatin1().data(), toCreateGroups, aFormat ); break; case 124: case 121: - aMesh->ExportDAT( aFilename.latin1() ); + aMesh->ExportDAT( aFilename.toLatin1().data() ); break; case 126: case 123: - aMesh->ExportUNV( aFilename.latin1() ); + aMesh->ExportUNV( aFilename.toLatin1().data() ); break; case 140: case 141: - aMesh->ExportSTL( aFilename.latin1(), aIsASCII_STL ); + aMesh->ExportSTL( aFilename.toLatin1().data(), aIsASCII_STL ); break; default: break; @@ -449,10 +421,9 @@ using namespace std; } catch (const SALOME::SALOME_Exception& S_ex){ wc.suspend(); - SUIT_MessageBox::warn1(SMESHGUI::desktop(), - QObject::tr("SMESH_WRN_WARNING"), - QObject::tr("SMESH_EXPORT_FAILED"), - QObject::tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(SMESHGUI::desktop(), + QObject::tr("SMESH_WRN_WARNING"), + QObject::tr("SMESH_EXPORT_FAILED")); wc.resume(); } } @@ -478,7 +449,7 @@ using namespace std; if(selected.Extent() >= 1){ SALOME_ListIteratorOfListIO It( selected ); - for(; It.More(); It.Next()){ + for( ; It.More(); It.Next()){ Handle(SALOME_InteractiveObject) IObject = It.Value(); if(IObject->hasEntry()){ if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){ @@ -530,7 +501,7 @@ using namespace std; aMainObject->SetAutoColor( true ); - QValueList aReservedColors; + QList aReservedColors; SMESH::ListOfGroups aListOfGroups = *aMainObject->GetGroups(); for( int i = 0, n = aListOfGroups.length(); i < n; i++ ) @@ -591,16 +562,16 @@ using namespace std; switch(theCommandID){ case 1134:{ SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog(); - new SMESHGUI_ClippingDlg( SMESHGUI::GetSMESHGUI(), "", false ); + (new SMESHGUI_ClippingDlg( SMESHGUI::GetSMESHGUI() ))->show(); return; } case 1133:{ SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog(); - new SMESHGUI_TransparencyDlg( SMESHGUI::GetSMESHGUI(), "", false ); + (new SMESHGUI_TransparencyDlg( SMESHGUI::GetSMESHGUI() ))->show(); return; }} SALOME_ListIteratorOfListIO It( selected ); - for(; It.More(); It.Next()){ + for( ; It.More(); It.Next()){ Handle(SALOME_InteractiveObject) IObject = It.Value(); if(IObject->hasEntry()){ if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){ @@ -656,7 +627,7 @@ using namespace std; vtkFloatingPointType Shrink = anActor->GetShrinkFactor(); SMESHGUI_Preferences_ColorDlg *aDlg = - new SMESHGUI_Preferences_ColorDlg( SMESHGUI::GetSMESHGUI(), "" ); + new SMESHGUI_Preferences_ColorDlg( SMESHGUI::GetSMESHGUI() ); aDlg->SetColor(1, c); aDlg->SetColor(2, e); aDlg->SetColor(3, n); @@ -785,7 +756,7 @@ using namespace std; break; } anActor->SetControlMode(aControl); - anActor->GetScalarBarActor()->SetTitle(aTitle.latin1()); + anActor->GetScalarBarActor()->SetTitle(aTitle.toLatin1().data()); SMESH::RepaintCurrentView(); } } @@ -848,7 +819,7 @@ using namespace std; QString RefType = CheckTypeObject(selected.First()); SALOME_ListIteratorOfListIO It(selected); - for (; It.More(); It.Next()) + for ( ; It.More(); It.Next()) { Handle(SALOME_InteractiveObject) IObject = It.Value(); QString Type = CheckTypeObject(IObject); @@ -877,18 +848,18 @@ using namespace std; } if ( aParentComponent != SMESHGUI::GetSMESHGUI()->name() ) { - SUIT_MessageBox::warn1 ( SMESHGUI::desktop(), - QObject::tr("ERR_ERROR"), - QObject::tr("NON_SMESH_OBJECTS_SELECTED").arg( SMESHGUI::GetSMESHGUI()->moduleName() ), - QObject::tr("BUT_OK") ); + SUIT_MessageBox::warning( SMESHGUI::desktop(), + QObject::tr("ERR_ERROR"), + QObject::tr("NON_SMESH_OBJECTS_SELECTED").arg( SMESHGUI::GetSMESHGUI()->moduleName() ) ); return; } // VSR 17/11/04: check if all objects selected belong to SMESH component <-- finish - if (SUIT_MessageBox::warn2 + if (SUIT_MessageBox::warning (SMESHGUI::desktop(), QObject::tr("SMESH_WRN_WARNING"), QObject::tr("SMESH_REALLY_DELETE"), - QObject::tr("SMESH_BUT_YES"), QObject::tr("SMESH_BUT_NO"), 1, 0, 0) != 1) + SUIT_MessageBox::Yes | SUIT_MessageBox::No, + SUIT_MessageBox::Yes) != SUIT_MessageBox::Yes) return; SalomeApp_Application* anApp = dynamic_cast( SUIT_Session::session()->activeApplication() ); @@ -903,7 +874,7 @@ using namespace std; SALOME_ListIteratorOfListIO It(selected); aStudyBuilder->NewCommand(); // There is a transaction - for(; It.More(); It.Next()){ // loop on selected IO's + for( ; It.More(); It.Next()){ // loop on selected IO's Handle(SALOME_InteractiveObject) IObject = It.Value(); if(IObject->hasEntry()) { _PTR(SObject) aSO = aStudy->FindObjectID(IObject->getEntry()); @@ -911,7 +882,7 @@ using namespace std; // disable removal of "SMESH" component object if(aSO->FindAttribute(anAttr, "AttributeIOR")){ anIOR = anAttr; - if ( !strcmp( (char*)anIOR->Value().c_str(), engineIOR().latin1() ) ) + if ( engineIOR() == anIOR->Value().c_str() ) continue; } @@ -937,7 +908,7 @@ using namespace std; /** Erase graphical object **/ if(SO->FindAttribute(anAttr, "AttributeIOR")){ - QPtrVector aViews = vm->getViews(); + QVector aViews = vm->getViews(); for(int i = 0; i < nbSf; i++){ SUIT_ViewWindow *sf = aViews[i]; if(SMESH_Actor* anActor = SMESH::FindActorByEntry(sf,anEntry.c_str())){ @@ -963,7 +934,7 @@ using namespace std; } else { IObject = new SALOME_InteractiveObject - ( anEntry.c_str(), engineIOR().latin1(), SO->GetName().c_str() ); + ( anEntry.c_str(), engineIOR().toLatin1().data(), SO->GetName().c_str() ); QString objType = CheckTypeObject(IObject); if ( objType == "Hypothesis" || objType == "Algorithm" ) {// DELETE HYPOTHESIS SMESH::RemoveHypothesisOrAlgorithmOnMesh(IObject); @@ -1232,10 +1203,9 @@ static int isStudyLocked(_PTR(Study) theStudy){ static bool checkLock(_PTR(Study) theStudy) { if (isStudyLocked(theStudy)) { - SUIT_MessageBox::warn1 ( SMESHGUI::desktop(), - QObject::tr("WRN_WARNING"), - QObject::tr("WRN_STUDY_LOCKED"), - QObject::tr("BUT_OK") ); + SUIT_MessageBox::warning( SMESHGUI::desktop(), + QObject::tr("WRN_WARNING"), + QObject::tr("WRN_STUDY_LOCKED") ); return true; } return false; @@ -1407,7 +1377,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) #endif if (vtkwnd) { SALOME_ListIteratorOfListIO It( to_process ); - for (; It.More(); It.Next()) { + for ( ; It.More(); It.Next()) { Handle(SALOME_InteractiveObject) IOS = It.Value(); if (IOS->hasEntry()) { if (!SMESH::UpdateView(anAction, IOS->getEntry())) @@ -1444,13 +1414,12 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) if ( vtkwnd ) { EmitSignalDeactivateDialog(); - new SMESHGUI_NodesDlg(this); + ( new SMESHGUI_NodesDlg( this ) )->show(); } else { - SUIT_MessageBox::warn1(desktop(), - tr("SMESH_WRN_WARNING"), - tr("SMESH_WRN_VIEWER_VTK"), - tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(desktop(), + tr("SMESH_WRN_WARNING"), + tr("SMESH_WRN_VIEWER_VTK")); } break; } @@ -1460,7 +1429,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) if ( vtkwnd ) { EmitSignalDeactivateDialog(); - new SMESHGUI_FilterDlg( this, SMESH::EDGE ); + ( new SMESHGUI_FilterDlg( this, SMESH::EDGE ) )->show(); } break; } @@ -1469,13 +1438,13 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) { if ( !vtkwnd ) { - SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ), - tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) ); + SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ), + tr( "NOT_A_VTK_VIEWER" ) ); break; } if(checkLock(aStudy)) break; - new SMESHGUI_MoveNodesDlg(this); + ( new SMESHGUI_MoveNodesDlg( this ) )->show(); break; } @@ -1500,7 +1469,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) { if (checkLock(aStudy)) break; EmitSignalDeactivateDialog(); - new SMESHGUI_BuildCompoundDlg( this ); + ( new SMESHGUI_BuildCompoundDlg( this ) )->show(); } break; case 407: // DIAGONAL INVERSION @@ -1508,8 +1477,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) { if ( !vtkwnd ) { - SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ), - tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) ); + SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ), + tr( "NOT_A_VTK_VIEWER" ) ); break; } @@ -1520,16 +1489,16 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface(IObject); if ( aMesh->_is_nil() ) { - SUIT_MessageBox::warn1(GetDesktop(), tr( "SMESH_WRN_WARNING" ), - tr( "SMESH_BAD_SELECTION" ), tr( "SMESH_BUT_OK" ) ); + SUIT_MessageBox::warning(GetDesktop(), tr( "SMESH_WRN_WARNING" ), + tr( "SMESH_BAD_SELECTION" ) ); break; } */ EmitSignalDeactivateDialog(); if ( theCommandID == 407 ) - new SMESHGUI_TrianglesInversionDlg(this); + ( new SMESHGUI_TrianglesInversionDlg( this ) )->show(); else - new SMESHGUI_UnionOfTwoTrianglesDlg(this); + ( new SMESHGUI_UnionOfTwoTrianglesDlg( this ) )->show(); break; } case 409: // Change orientation @@ -1538,8 +1507,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) { if ( !vtkwnd ) { - SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ), - tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) ); + SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ), + tr( "NOT_A_VTK_VIEWER" ) ); break; } @@ -1563,12 +1532,11 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) if(checkLock(aStudy)) break; if( vtkwnd ) { EmitSignalDeactivateDialog(); - new SMESHGUI_SmoothingDlg( this ); + ( new SMESHGUI_SmoothingDlg( this ) )->show(); } else { - SUIT_MessageBox::warn1(desktop(), - tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"), - tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(desktop(), + tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK")); } break; } @@ -1577,11 +1545,10 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) if (checkLock(aStudy)) break; if (vtkwnd) { EmitSignalDeactivateDialog(); - new SMESHGUI_ExtrusionDlg ( this ); + ( new SMESHGUI_ExtrusionDlg ( this ) )->show(); } else { - SUIT_MessageBox::warn1(desktop(), - tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"), - tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(desktop(), + tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK")); } break; } @@ -1590,12 +1557,11 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) if(checkLock(aStudy)) break; if( vtkwnd ) { EmitSignalDeactivateDialog(); - new SMESHGUI_RevolutionDlg( this ); + ( new SMESHGUI_RevolutionDlg( this ) )->show(); } else { - SUIT_MessageBox::warn1(desktop(), - tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"), - tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(desktop(), + tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK")); } break; } @@ -1606,12 +1572,11 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) if ( vtkwnd ) { EmitSignalDeactivateDialog(); - new SMESHGUI_MeshPatternDlg( this ); + ( new SMESHGUI_MeshPatternDlg( this ) )->show(); } else { - SUIT_MessageBox::warn1(desktop(), - tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"), - tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(desktop(), + tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK")); } break; } @@ -1620,11 +1585,10 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) if (checkLock(aStudy)) break; if (vtkwnd) { EmitSignalDeactivateDialog(); - new SMESHGUI_ExtrusionAlongPathDlg( this ); + ( new SMESHGUI_ExtrusionAlongPathDlg( this ) )->show(); } else { - SUIT_MessageBox::warn1(desktop(), - tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"), - tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(desktop(), + tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK")); } break; } @@ -1636,9 +1600,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) EmitSignalDeactivateDialog(); new SMESHGUI_ConvToQuadDlg(); } else { - SUIT_MessageBox::warn1(desktop(), - tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"), - tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(desktop(), + tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK")); }*/ break; } @@ -1646,8 +1609,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) { if ( !vtkwnd ) { - SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ), - tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) ); + SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ), + tr( "NOT_A_VTK_VIEWER" ) ); break; } @@ -1665,7 +1628,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) // check if mesh is selected aMesh = SMESH::GetMeshByIO( selected.First() ); } - SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, "", aMesh); + SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, aMesh); aDlg->show(); break; } @@ -1674,8 +1637,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) { if ( !vtkwnd ) { - SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ), - tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) ); + SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ), + tr( "NOT_A_VTK_VIEWER" ) ); break; } @@ -1732,10 +1695,9 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) } } else if(nbSel==0) { - SUIT_MessageBox::warn1(desktop(), - tr("SMESH_WRN_WARNING"), - tr("SMESH_WRN_NO_AVAILABLE_DATA"), - tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(desktop(), + tr("SMESH_WRN_WARNING"), + tr("SMESH_WRN_NO_AVAILABLE_DATA")); } break; } @@ -1744,8 +1706,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) { if ( !vtkwnd ) { - SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ), - tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) ); + SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ), + tr( "NOT_A_VTK_VIEWER" ) ); break; } @@ -1765,13 +1727,13 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) SMESH::IObjectToInterface(It.Value()); if (!aGroup->_is_nil()) { nbSelectedGroups++; - SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, "", aGroup); + SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, aGroup); aDlg->show(); } } if (nbSelectedGroups == 0) { - SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, "", SMESH::SMESH_GroupBase::_nil()); + SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, SMESH::SMESH_GroupBase::_nil()); aDlg->show(); } break; @@ -1803,8 +1765,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) { if ( !vtkwnd ) { - SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ), - tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) ); + SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ), + tr( "NOT_A_VTK_VIEWER" ) ); break; } @@ -1826,8 +1788,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) { if ( !vtkwnd ) { - SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ), - tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) ); + SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ), + tr( "NOT_A_VTK_VIEWER" ) ); break; } @@ -1836,7 +1798,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) EmitSignalDeactivateDialog(); - new SMESHGUI_DeleteGroupDlg( this ); + ( new SMESHGUI_DeleteGroupDlg( this ) )->show(); break; } @@ -1854,13 +1816,13 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) for ( ; It.More(); It.Next() ) { IOs.Clear(); IOs.Append( It.Value() ); aSel->setSelectedObjects( IOs ); - new SMESHGUI_MeshInfosDlg(this, "", false); + ( new SMESHGUI_MeshInfosDlg( this ) )->show(); } // restore selection aSel->setSelectedObjects( selected ); } else - new SMESHGUI_MeshInfosDlg(this, "", false); + ( new SMESHGUI_MeshInfosDlg( this ) )->show(); break; } @@ -1879,20 +1841,20 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) IOs.Clear(); IOs.Append( It.Value() ); aSel->setSelectedObjects( IOs ); - new SMESHGUI_StandardMeshInfosDlg( this, "", false); + ( new SMESHGUI_StandardMeshInfosDlg( this ) )->show(); } // restore selection aSel->setSelectedObjects( selected ); } else - new SMESHGUI_StandardMeshInfosDlg( this, "", false); + ( new SMESHGUI_StandardMeshInfosDlg( this ) )->show(); break; } case 903: // WHAT IS { EmitSignalDeactivateDialog(); - new SMESHGUI_WhatIsDlg( this, "", false); + ( new SMESHGUI_WhatIsDlg( this ) )->show(); break; } @@ -1916,8 +1878,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) /* Warning : however by internal mechanism all subMeshes icons are changed ! */ if ( !aHypothesis->_is_nil() ) { - CORBA::String_var aHypType = aHypothesis->GetName(); - SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypType); + SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypothesis->GetName()); if (aCreator) aCreator->edit( aHypothesis.in(), anIObject->getName(), desktop() ); else @@ -1957,13 +1918,13 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) if ( !newName.isEmpty() ) { //old source: aStudy->renameIObject( IObject, newName ); - aName->SetValue( newName.latin1() ); + aName->SetValue( newName.toLatin1().data() ); // if current object is group update group's name SMESH::SMESH_GroupBase_var aGroup = SMESH::IObjectToInterface(IObject); if (!aGroup->_is_nil() ) - aGroup->SetName( newName.latin1() ); + aGroup->SetName( newName.toLatin1().data() ); updateObjBrowser(); } @@ -2021,12 +1982,11 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) type = SMDSAbs_Volume; nbNodes = 9; break; // 9 - identificator for POLYHEDRE default:; } - new SMESHGUI_AddMeshElementDlg( this, "", type, nbNodes); + ( new SMESHGUI_AddMeshElementDlg( this, type, nbNodes ) )->show(); } else { - SUIT_MessageBox::warn1(desktop(), - tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"), - tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(desktop(), + tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK")); } break; } @@ -2035,12 +1995,11 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) if(checkLock(aStudy)) break; if ( vtkwnd ) { EmitSignalDeactivateDialog(); - new SMESHGUI_CreatePolyhedralVolumeDlg(this, "", FALSE ); + ( new SMESHGUI_CreatePolyhedralVolumeDlg( this ) )->show(); } else { - SUIT_MessageBox::warn1(SMESHGUI::desktop(), - tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"), - tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(SMESHGUI::desktop(), + tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK")); } break; } @@ -2075,12 +2034,11 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) break; default:; } - new SMESHGUI_AddQuadraticElementDlg( this, type ); + ( new SMESHGUI_AddQuadraticElementDlg( this, type ) )->show(); } else { - SUIT_MessageBox::warn1(SMESHGUI::desktop(), - tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"), - tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(SMESHGUI::desktop(), + tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK")); } break; } @@ -2089,12 +2047,11 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) if(checkLock(aStudy)) break; if ( vtkwnd ) { EmitSignalDeactivateDialog(); - new SMESHGUI_RemoveNodesDlg(this); + ( new SMESHGUI_RemoveNodesDlg( this ) )->show(); } else { - SUIT_MessageBox::warn1(desktop(), - tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"), - tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(SMESHGUI::desktop(), + tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK")); } break; } @@ -2103,13 +2060,12 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) if(checkLock(aStudy)) break; if( vtkwnd ) { EmitSignalDeactivateDialog(); - new SMESHGUI_RemoveElementsDlg(this); + ( new SMESHGUI_RemoveElementsDlg( this ) )->show(); } else { - SUIT_MessageBox::warn1(desktop(), - tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"), - tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(SMESHGUI::desktop(), + tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK")); } break; } @@ -2118,13 +2074,12 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) if(checkLock(aStudy)) break; if( vtkwnd ) { EmitSignalDeactivateDialog(); - new SMESHGUI_RenumberingDlg( this, "", 0); + ( new SMESHGUI_RenumberingDlg( this, 0 ) )->show(); } else { - SUIT_MessageBox::warn1(desktop(), - tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"), - tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(SMESHGUI::desktop(), + tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK")); } break; } @@ -2133,13 +2088,12 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) if(checkLock(aStudy)) break; if ( vtkwnd ) { EmitSignalDeactivateDialog(); - new SMESHGUI_RenumberingDlg( this, "", 1); + ( new SMESHGUI_RenumberingDlg( this, 1 ) )->show(); } else { - SUIT_MessageBox::warn1(desktop(), - tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"), - tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(SMESHGUI::desktop(), + tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK")); } break; } @@ -2148,12 +2102,11 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) if(checkLock(aStudy)) break; if ( vtkwnd ) { EmitSignalDeactivateDialog(); - new SMESHGUI_TranslationDlg( this ); + ( new SMESHGUI_TranslationDlg( this ) )->show(); } else { - SUIT_MessageBox::warn1(desktop(), - tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"), - tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(SMESHGUI::desktop(), + tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK")); } break; } @@ -2162,12 +2115,11 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) if(checkLock(aStudy)) break; if( vtkwnd ) { EmitSignalDeactivateDialog(); - new SMESHGUI_RotationDlg( this ); + ( new SMESHGUI_RotationDlg( this ) )->show(); } else { - SUIT_MessageBox::warn1(desktop(), - tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"), - tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(SMESHGUI::desktop(), + tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK")); } break; } @@ -2176,12 +2128,11 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) if(checkLock(aStudy)) break; if(vtkwnd) { EmitSignalDeactivateDialog(); - new SMESHGUI_SymmetryDlg( this ); + ( new SMESHGUI_SymmetryDlg( this ) )->show(); } else { - SUIT_MessageBox::warn1(desktop(), - tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"), - tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(SMESHGUI::desktop(), + tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK")); } break; } @@ -2190,12 +2141,11 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) if(checkLock(aStudy)) break; if(vtkwnd) { EmitSignalDeactivateDialog(); - new SMESHGUI_SewingDlg( this ); + ( new SMESHGUI_SewingDlg( this ) )->show(); } else { - SUIT_MessageBox::warn1(desktop(), - tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"), - tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(SMESHGUI::desktop(), + tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK")); } break; } @@ -2204,12 +2154,11 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) if(checkLock(aStudy)) break; if(vtkwnd) { EmitSignalDeactivateDialog(); - new SMESHGUI_EditMeshDlg( this, 0 ); + ( new SMESHGUI_EditMeshDlg( this, 0 ) )->show(); } else { - SUIT_MessageBox::warn1(desktop(), - tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"), - tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(SMESHGUI::desktop(), + tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK")); } break; } @@ -2218,11 +2167,10 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) if (checkLock(aStudy)) break; if (vtkwnd) { EmitSignalDeactivateDialog(); - new SMESHGUI_EditMeshDlg( this, 1 ); + ( new SMESHGUI_EditMeshDlg( this, 1 ) )->show(); } else { - SUIT_MessageBox::warn1(desktop(), - tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"), - tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(SMESHGUI::desktop(), + tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK")); } break; } @@ -2233,7 +2181,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) case 5105: // Library of selection filters { - static QValueList aTypes; + static QList aTypes; if ( aTypes.isEmpty() ) { aTypes.append( SMESH::NODE ); @@ -2281,17 +2229,15 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) } } } - SUIT_MessageBox::warn1(desktop(), - tr( "SMESH_WRN_WARNING" ), - tr( "SMESH_BAD_SELECTION" ), - tr( "SMESH_BUT_OK" ) ); + SUIT_MessageBox::warning(desktop(), + tr( "SMESH_WRN_WARNING" ), + tr( "SMESH_BAD_SELECTION" ) ); break; } else { - SUIT_MessageBox::warn1(desktop(), - tr( "SMESH_WRN_WARNING" ), - tr( "NOT_A_VTK_VIEWER" ), - tr( "SMESH_BUT_OK" ) ); + SUIT_MessageBox::warning(desktop(), + tr( "SMESH_WRN_WARNING" ), + tr( "NOT_A_VTK_VIEWER" ) ); } break; case 9010: @@ -2300,7 +2246,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) SALOME_ListIO selected; mgr->selectedObjects( selected ); SALOME_ListIteratorOfListIO it(selected); - for(; it.More(); it.Next()) { + for( ; it.More(); it.Next()) { Handle(SALOME_InteractiveObject) anIObject = it.Value(); if(anIObject->hasEntry()) { if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIObject->getEntry())){ @@ -2381,20 +2327,20 @@ void SMESHGUI::BuildPresentation( const Handle(SALOME_InteractiveObject) & theIO //======================================================================= void SMESHGUI::createSMESHAction( const int id, const QString& po_id, const QString& icon_id, const int key, const bool toggle ) { - QIconSet icon; + QIcon icon; QWidget* parent = application()->desktop(); SUIT_ResourceMgr* resMgr = resourceMgr(); QPixmap pix; - if ( icon_id.length() ) - pix = resMgr->loadPixmap( "SMESH", tr( icon_id ) ); + if ( !icon_id.isEmpty() ) + pix = resMgr->loadPixmap( "SMESH", tr( icon_id.toLatin1().data() ) ); else - pix = resMgr->loadPixmap( "SMESH", tr( QString( "ICO_" )+po_id ), false ); + pix = resMgr->loadPixmap( "SMESH", tr( QString( "ICO_%1" ).arg( po_id ).toLatin1().data() ), false ); if ( !pix.isNull() ) - icon = QIconSet( pix ); + icon = QIcon( pix ); - QString tooltip = tr( QString( "TOP_" )+po_id ), - menu = tr( QString( "MEN_" )+po_id ), - status_bar = tr( QString( "STB_" )+po_id ); + QString tooltip = tr( QString( "TOP_%1" ).arg( po_id ).toLatin1().data() ), + menu = tr( QString( "MEN_%1" ).arg( po_id ).toLatin1().data() ), + status_bar = tr( QString( "STB_%1" ).arg( po_id ).toLatin1().data() ); createAction( id, tooltip, icon, menu, status_bar, key, parent, toggle, this, SLOT( OnGUIEvent() ) ); } @@ -2416,9 +2362,10 @@ void SMESHGUI::createPopupItem( const int id, if( !popupMgr()->contains( popupMgr()->actionId( action( id ) ) ) ) popupMgr()->insert( action( id ), parentId, 0 ); - QChar lc = QtxPopupMgr::Selection::defEquality(); + QString lc = "$"; // VSR : instead of QtxPopupSelection::defEquality(); + QString dc = "selcount"; // VSR : insetad of QtxPopupSelection::defSelCountParam() QString rule = "(%1) and (%2) and (%3)"; - rule = rule.arg( QString( "%1>0" ).arg( QtxPopupMgr::Selection::defSelCountParam() ) ); + rule = rule.arg( QString( "%1>0" ).arg( dc ) ); if( clients.isEmpty() ) rule = rule.arg( QString( "true" ) ); else @@ -2430,7 +2377,7 @@ void SMESHGUI::createPopupItem( const int id, if( cont ) rule = QString( "%1 or (%2)" ).arg( myRules[ id ] ).arg( rule ); - popupMgr()->setRule( action( id ), rule, true ); + popupMgr()->setRule( action( id ), rule, QtxPopupMgr::VisibleRule ); myRules[ id ] = QString( cont ? "%1" : "(%1)" ).arg( rule ); } @@ -2449,9 +2396,9 @@ void SMESHGUI::initialize( CAM_Application* app ) // ----- create actions -------------- - createSMESHAction( 111, "DAT", "", (CTRL+Key_B) ); - createSMESHAction( 112, "UNV", "", (CTRL+Key_U) ); - createSMESHAction( 113, "MED", "", (CTRL+Key_M) ); + createSMESHAction( 111, "DAT", "", (Qt::CTRL+Qt::Key_B) ); + createSMESHAction( 112, "UNV", "", (Qt::CTRL+Qt::Key_U) ); + createSMESHAction( 113, "MED", "", (Qt::CTRL+Qt::Key_M) ); createSMESHAction( 114, "NUM" ); createSMESHAction( 121, "DAT" ); createSMESHAction( 122, "MED" ); @@ -2461,7 +2408,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createSMESHAction( 125, "EXPORT_MED" ); createSMESHAction( 126, "EXPORT_UNV" ); createSMESHAction( 141, "EXPORT_STL" ); - createSMESHAction( 33, "DELETE", "ICON_DELETE", Key_Delete ); + createSMESHAction( 33, "DELETE", "ICON_DELETE", Qt::Key_Delete ); createSMESHAction( 5105, "SEL_FILTER_LIB" ); createSMESHAction( 701, "COMPUTE", "ICON_COMPUTE" ); createSMESHAction( 702, "CREATE_MESH", "ICON_DLG_INIT_MESH" ); @@ -2480,15 +2427,15 @@ void SMESHGUI::initialize( CAM_Application* app ) createSMESHAction( 900, "ADV_INFO", "ICON_ADV_INFO" ); createSMESHAction( 902, "STD_INFO", "ICON_STD_INFO" ); createSMESHAction( 903, "WHAT_IS", "ICON_WHAT_IS" ); - createSMESHAction( 6001, "LENGTH", "ICON_LENGTH" , 0, true ); - createSMESHAction( 6002, "FREE_EDGE", "ICON_FREE_EDGE" , 0, true ); - createSMESHAction( 6003, "FREE_BORDER", "ICON_FREE_EDGE_2D" , 0, true ); - createSMESHAction( 6004, "CONNECTION", "ICON_CONNECTION" , 0, true ); - createSMESHAction( 6011, "AREA", "ICON_AREA" , 0, true ); - createSMESHAction( 6012, "TAPER", "ICON_TAPER" , 0, true ); - createSMESHAction( 6013, "ASPECT", "ICON_ASPECT" , 0, true ); - createSMESHAction( 6014, "MIN_ANG", "ICON_ANGLE" , 0, true ); - createSMESHAction( 6015, "WARP", "ICON_WARP" , 0, true ); + createSMESHAction( 6001, "LENGTH", "ICON_LENGTH", 0, true ); + createSMESHAction( 6002, "FREE_EDGE", "ICON_FREE_EDGE", 0, true ); + createSMESHAction( 6003, "FREE_BORDER", "ICON_FREE_EDGE_2D", 0, true ); + createSMESHAction( 6004, "CONNECTION", "ICON_CONNECTION", 0, true ); + createSMESHAction( 6011, "AREA", "ICON_AREA", 0, true ); + createSMESHAction( 6012, "TAPER", "ICON_TAPER", 0, true ); + createSMESHAction( 6013, "ASPECT", "ICON_ASPECT", 0, true ); + createSMESHAction( 6014, "MIN_ANG", "ICON_ANGLE", 0, true ); + createSMESHAction( 6015, "WARP", "ICON_WARP", 0, true ); createSMESHAction( 6016, "SKEW", "ICON_SKEW", 0, true ); createSMESHAction( 6017, "ASPECT_3D", "ICON_ASPECT_3D", 0, true ); createSMESHAction( 6018, "LENGTH_2D", "ICON_LENGTH_2D", 0, true ); @@ -2536,7 +2483,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createSMESHAction( 219, "VOLUMES", "ICON_DLG_TETRAS", 0, true ); createSMESHAction( 220, "ALL" ); createSMESHAction( 1100, "EDIT_HYPO" ); - createSMESHAction( 1101, "RENAME", "", Key_F2 ); + createSMESHAction( 1101, "RENAME", "", Qt::Key_F2 ); createSMESHAction( 1102, "UNASSIGN" ); createSMESHAction( 9010, "NUM_NODES", "", 0, true ); createSMESHAction( 9011, "NUM_ELEMENTS", "", 0, true ); @@ -2768,6 +2715,8 @@ void SMESHGUI::initialize( CAM_Application* app ) createTool( 214, dispModeTb ); + QString lc = "$"; // VSR : instead of QtxPopupSelection::defEquality(); + QString dc = "selcount"; // VSR : insetad of QtxPopupSelection::defSelCountParam() myRules.clear(); QString OB = "'ObjectBrowser'", @@ -2808,7 +2757,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createPopupItem( 1101, OB, mesh_group + " " + hyp_alg, "" /*"&& $hasReference={false}"*/ ); // RENAME popupMgr()->insert( separator(), -1, 0 ); - QString only_one_non_empty = QString( " && %1=1 && numberOfNodes>0" ).arg( QtxPopupMgr::Selection::defSelCountParam() ); + QString only_one_non_empty = QString( " && %1=1 && numberOfNodes>0" ).arg( dc ); createPopupItem( 125, OB, mesh, only_one_non_empty ); // EXPORT_MED createPopupItem( 126, OB, mesh, only_one_non_empty ); // EXPORT_UNV createPopupItem( 141, OB, mesh, only_one_non_empty ); // EXPORT_STL @@ -2845,15 +2794,14 @@ void SMESHGUI::initialize( CAM_Application* app ) hasFaces("({'Face'} in elemTypes)"), hasVolumes("({'Volume'} in elemTypes)"); - QString lc = QtxPopupMgr::Selection::defEquality(); QString aClient = QString( "%1client in {%2}" ).arg( lc ).arg( "'VTKViewer'" ); - QString aType = QString( "%1type in {%2}" ).arg( QtxPopupMgr::Selection::defEquality() ); + QString aType = QString( "%1type in {%2}" ).arg( lc ); aType = aType.arg( mesh_group ); QString aMeshInVTK = aClient + "&&" + aType; aClient = "($client in {'VTKViewer' 'ObjectBrowser'})"; QString anActiveVTK = QString("activeView = '%1'").arg(SVTK_Viewer::Type()); - QString aSelCount = QString( "%1 > 0" ).arg( QtxPopupMgr::Selection::defSelCountParam() ); + QString aSelCount = QString( "%1 > 0" ).arg( dc ); //------------------------------------------------- // Numbering @@ -2861,12 +2809,12 @@ void SMESHGUI::initialize( CAM_Application* app ) anId = popupMgr()->insert( tr( "MEN_NUM" ), -1, -1 ); popupMgr()->insert( action( 9010 ), anId, -1 ); - popupMgr()->setRule( action( 9010 ), aMeshInVTK + "&& isVisible &&" + hasNodes, true ); - popupMgr()->setRule( action( 9010 ), "{'Point'} in labeledTypes", false ); + popupMgr()->setRule( action( 9010 ), aMeshInVTK + "&& isVisible &&" + hasNodes, QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( 9010 ), "{'Point'} in labeledTypes", QtxPopupMgr::ToggleRule ); popupMgr()->insert( action( 9011 ), anId, -1 ); - popupMgr()->setRule( action( 9011 ), aMeshInVTK + "&& isVisible &&" + hasElems, true ); - popupMgr()->setRule( action( 9011 ), "{'Cell'} in labeledTypes", false ); + popupMgr()->setRule( action( 9011 ), aMeshInVTK + "&& isVisible &&" + hasElems, QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( 9011 ), "{'Cell'} in labeledTypes", QtxPopupMgr::ToggleRule ); popupMgr()->insert( separator(), -1, -1 ); @@ -2876,22 +2824,22 @@ void SMESHGUI::initialize( CAM_Application* app ) anId = popupMgr()->insert( tr( "MEN_DISPMODE" ), -1, -1 ); popupMgr()->insert( action( 211 ), anId, -1 ); // WIRE - popupMgr()->setRule( action( 211 ), aMeshInVTK + "&&" + hasElems, true ); - popupMgr()->setRule( action( 211 ), "displayMode = 'eEdge'", false ); + popupMgr()->setRule( action( 211 ), aMeshInVTK + "&&" + hasElems, QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( 211 ), "displayMode = 'eEdge'", QtxPopupMgr::ToggleRule ); popupMgr()->insert( action( 212 ), anId, -1 ); // SHADE - popupMgr()->setRule( action( 212 ),aMeshInVTK+ "&& (" + hasFaces + "||" + hasVolumes + ")",true); - popupMgr()->setRule( action( 212 ), "displayMode = 'eSurface'", false ); + popupMgr()->setRule( action( 212 ),aMeshInVTK+ "&& (" + hasFaces + "||" + hasVolumes + ")", QtxPopupMgr::VisibleRule); + popupMgr()->setRule( action( 212 ), "displayMode = 'eSurface'", QtxPopupMgr::ToggleRule ); popupMgr()->insert( action( 215 ), anId, -1 ); // POINTS - popupMgr()->setRule( action( 215 ), aMeshInVTK + "&&" + hasNodes, true ); - popupMgr()->setRule( action( 215 ), "displayMode = 'ePoint'", false ); + popupMgr()->setRule( action( 215 ), aMeshInVTK + "&&" + hasNodes, QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( 215 ), "displayMode = 'ePoint'", QtxPopupMgr::ToggleRule ); popupMgr()->insert( separator(), anId, -1 ); popupMgr()->insert( action( 213 ), anId, -1 ); // SHRINK - popupMgr()->setRule( action( 213 ), aMeshInVTK + "&& shrinkMode <> 'IsNotShrinkable' && displayMode <> 'ePoint'",true); - popupMgr()->setRule( action( 213 ), "shrinkMode = 'IsShrunk'", false ); + popupMgr()->setRule( action( 213 ), aMeshInVTK + "&& shrinkMode <> 'IsNotShrinkable' && displayMode <> 'ePoint'", QtxPopupMgr::VisibleRule); + popupMgr()->setRule( action( 213 ), "shrinkMode = 'IsShrunk'", QtxPopupMgr::ToggleRule ); //------------------------------------------------- // Display Entity @@ -2901,39 +2849,39 @@ void SMESHGUI::initialize( CAM_Application* app ) anId = popupMgr()->insert( tr( "MEN_DISP_ENT" ), -1, -1 ); popupMgr()->insert( action( 217 ), anId, -1 ); // EDGES - popupMgr()->setRule( action( 217 ), aDiffElemsInVTK + "&& isVisible &&" + hasEdges, true ); - popupMgr()->setRule( action( 217 ), "{'Edge'} in entityMode", false ); + popupMgr()->setRule( action( 217 ), aDiffElemsInVTK + "&& isVisible &&" + hasEdges, QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( 217 ), "{'Edge'} in entityMode", QtxPopupMgr::ToggleRule ); popupMgr()->insert( action( 218 ), anId, -1 ); // FACES - popupMgr()->setRule( action( 218 ), aDiffElemsInVTK + "&& isVisible &&" + hasFaces, true ); - popupMgr()->setRule( action( 218 ), "{'Face'} in entityMode", false ); + popupMgr()->setRule( action( 218 ), aDiffElemsInVTK + "&& isVisible &&" + hasFaces, QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( 218 ), "{'Face'} in entityMode", QtxPopupMgr::ToggleRule ); popupMgr()->insert( action( 219 ), anId, -1 ); // VOLUMES - popupMgr()->setRule( action( 219 ), aDiffElemsInVTK + "&& isVisible &&" + hasVolumes, true ); - popupMgr()->setRule( action( 219 ), "{'Volume'} in entityMode", false ); + popupMgr()->setRule( action( 219 ), aDiffElemsInVTK + "&& isVisible &&" + hasVolumes, QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( 219 ), "{'Volume'} in entityMode", QtxPopupMgr::ToggleRule ); popupMgr()->insert( separator(), anId, -1 ); popupMgr()->insert( action( 220 ), anId, -1 ); // ALL - popupMgr()->setRule( action( 220 ), aDiffElemsInVTK + "&& isVisible && not( elemTypes in entityMode )", true ); + popupMgr()->setRule( action( 220 ), aDiffElemsInVTK + "&& isVisible && not( elemTypes in entityMode )", QtxPopupMgr::VisibleRule ); //------------------------------------------------- // Color / Size //------------------------------------------------- popupMgr()->insert( action( 1132 ), -1, -1 ); - popupMgr()->setRule( action( 1132 ), aMeshInVTK + "&& isVisible", true ); + popupMgr()->setRule( action( 1132 ), aMeshInVTK + "&& isVisible", QtxPopupMgr::VisibleRule ); //------------------------------------------------- // Transparency //------------------------------------------------- popupMgr()->insert( action( 1133 ), -1, -1 ); - popupMgr()->setRule( action( 1133 ), aMeshInVTK + "&& isVisible", true ); + popupMgr()->setRule( action( 1133 ), aMeshInVTK + "&& isVisible", QtxPopupMgr::VisibleRule ); //------------------------------------------------- // Clipping //------------------------------------------------- popupMgr()->insert( action( 1134 ), -1, -1 ); - popupMgr()->setRule( action( 1134 ), aMeshInVTK + "&& isVisible", true ); + popupMgr()->setRule( action( 1134 ), aMeshInVTK + "&& isVisible", QtxPopupMgr::VisibleRule ); popupMgr()->insert( separator(), -1, -1 ); @@ -2948,74 +2896,74 @@ void SMESHGUI::initialize( CAM_Application* app ) anId = popupMgr()->insert( tr( "MEN_CTRL" ), -1, -1 ); popupMgr()->insert( action( 200 ), anId, -1 ); // RESET - popupMgr()->setRule( action( 200 ), aMeshInVTK + "&& controlMode <> 'eNone'", true ); + popupMgr()->setRule( action( 200 ), aMeshInVTK + "&& controlMode <> 'eNone'", QtxPopupMgr::VisibleRule ); popupMgr()->insert( separator(), anId, -1 ); popupMgr()->insert( action( 6003 ), anId, -1 ); // FREE_BORDER - popupMgr()->setRule( action( 6003 ), aMeshInVtkHasEdges, true ); - popupMgr()->setRule( action( 6003 ), "controlMode = 'eFreeBorders'", false ); + popupMgr()->setRule( action( 6003 ), aMeshInVtkHasEdges, QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( 6003 ), "controlMode = 'eFreeBorders'", QtxPopupMgr::ToggleRule ); popupMgr()->insert( action( 6001 ), anId, -1 ); // LENGTH - popupMgr()->setRule( action( 6001 ), aMeshInVtkHasEdges, true ); - popupMgr()->setRule( action( 6001 ), "controlMode = 'eLength'", false ); + popupMgr()->setRule( action( 6001 ), aMeshInVtkHasEdges, QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( 6001 ), "controlMode = 'eLength'", QtxPopupMgr::ToggleRule ); popupMgr()->insert( action( 6004 ), anId, -1 ); // CONNECTION - popupMgr()->setRule( action( 6004 ), aMeshInVtkHasEdges, true ); - popupMgr()->setRule( action( 6004 ), "controlMode = 'eMultiConnection'", false ); + popupMgr()->setRule( action( 6004 ), aMeshInVtkHasEdges, QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( 6004 ), "controlMode = 'eMultiConnection'", QtxPopupMgr::ToggleRule ); popupMgr()->insert( separator(), anId, -1 ); popupMgr()->insert( action( 6002 ), anId, -1 ); // FREE_EDGE - popupMgr()->setRule( action( 6002 ), aMeshInVtkHasFaces, true ); - popupMgr()->setRule( action( 6002 ), "controlMode = 'eFreeEdges'", false ); + popupMgr()->setRule( action( 6002 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( 6002 ), "controlMode = 'eFreeEdges'", QtxPopupMgr::ToggleRule ); popupMgr()->insert( action( 6018 ), anId, -1 ); // LENGTH_2D - popupMgr()->setRule( action( 6018 ), aMeshInVtkHasFaces, true ); - popupMgr()->setRule( action( 6018 ), "controlMode = 'eLength2D'", false ); + popupMgr()->setRule( action( 6018 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( 6018 ), "controlMode = 'eLength2D'", QtxPopupMgr::ToggleRule ); popupMgr()->insert( action( 6019 ), anId, -1 ); // CONNECTION_2D - popupMgr()->setRule( action( 6019 ), aMeshInVtkHasFaces, true ); - popupMgr()->setRule( action( 6019 ), "controlMode = 'eMultiConnection2D'", false ); + popupMgr()->setRule( action( 6019 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( 6019 ), "controlMode = 'eMultiConnection2D'", QtxPopupMgr::ToggleRule ); popupMgr()->insert( action( 6011 ), anId, -1 ); // AREA - popupMgr()->setRule( action( 6011 ), aMeshInVtkHasFaces, true ); - popupMgr()->setRule( action( 6011 ), "controlMode = 'eArea'", false ); + popupMgr()->setRule( action( 6011 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( 6011 ), "controlMode = 'eArea'", QtxPopupMgr::ToggleRule ); popupMgr()->insert( action( 6012 ), anId, -1 ); // TAPER - popupMgr()->setRule( action( 6012 ), aMeshInVtkHasFaces, true ); - popupMgr()->setRule( action( 6012 ), "controlMode = 'eTaper'", false ); + popupMgr()->setRule( action( 6012 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( 6012 ), "controlMode = 'eTaper'", QtxPopupMgr::ToggleRule ); popupMgr()->insert( action( 6013 ), anId, -1 ); // ASPECT - popupMgr()->setRule( action( 6013 ), aMeshInVtkHasFaces, true ); - popupMgr()->setRule( action( 6013 ), "controlMode = 'eAspectRatio'", false ); + popupMgr()->setRule( action( 6013 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( 6013 ), "controlMode = 'eAspectRatio'", QtxPopupMgr::ToggleRule ); popupMgr()->insert( action( 6014 ), anId, -1 ); // MIN_ANG - popupMgr()->setRule( action( 6014 ), aMeshInVtkHasFaces, true ); - popupMgr()->setRule( action( 6014 ), "controlMode = 'eMinimumAngle'", false ); + popupMgr()->setRule( action( 6014 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( 6014 ), "controlMode = 'eMinimumAngle'", QtxPopupMgr::ToggleRule ); popupMgr()->insert( action( 6015 ), anId, -1 ); // WARP - popupMgr()->setRule( action( 6015 ), aMeshInVtkHasFaces, true ); - popupMgr()->setRule( action( 6015 ), "controlMode = 'eWarping'", false ); + popupMgr()->setRule( action( 6015 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( 6015 ), "controlMode = 'eWarping'", QtxPopupMgr::ToggleRule ); popupMgr()->insert( action( 6016 ), anId, -1 ); // SKEW - popupMgr()->setRule( action( 6016 ), aMeshInVtkHasFaces, true ); - popupMgr()->setRule( action( 6016 ), "controlMode = 'eSkew'", false ); + popupMgr()->setRule( action( 6016 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( 6016 ), "controlMode = 'eSkew'", QtxPopupMgr::ToggleRule ); popupMgr()->insert( separator(), anId, -1 ); popupMgr()->insert( action( 6017 ), anId, -1 ); // ASPECT_3D - popupMgr()->setRule( action( 6017 ), aMeshInVtkHasVolumes, true ); - popupMgr()->setRule( action( 6017 ), "controlMode = 'eAspectRatio3D'", false ); + popupMgr()->setRule( action( 6017 ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( 6017 ), "controlMode = 'eAspectRatio3D'", QtxPopupMgr::ToggleRule ); popupMgr()->insert ( action( 6009 ), anId, -1 ); // VOLUME_3D - popupMgr()->setRule( action( 6009 ), aMeshInVtkHasVolumes, true ); - popupMgr()->setRule( action( 6009 ), "controlMode = 'eVolume3D'", false ); + popupMgr()->setRule( action( 6009 ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( 6009 ), "controlMode = 'eVolume3D'", QtxPopupMgr::ToggleRule ); popupMgr()->insert( separator(), anId, -1 ); popupMgr()->insert( action( 201 ), anId, -1 ); // SCALAR_BAR_PROP - popupMgr()->setRule( action( 201 ), aMeshInVTK + "&& controlMode <> 'eNone'", true ); + popupMgr()->setRule( action( 201 ), aMeshInVTK + "&& controlMode <> 'eNone'", QtxPopupMgr::VisibleRule ); popupMgr()->insert( separator(), -1, -1 ); @@ -3025,13 +2973,13 @@ void SMESHGUI::initialize( CAM_Application* app ) QString aRule = "$component={'SMESH'} and ( type='Component' or (" + aClient + " and " + aType + " and " + aSelCount + " and " + anActiveVTK + " and " + isNotEmpty + " %1 ) )"; popupMgr()->insert( action( 301 ), -1, -1 ); // DISPLAY - popupMgr()->setRule( action( 301 ), aRule.arg( "and (not isVisible)" ), true); + popupMgr()->setRule( action( 301 ), aRule.arg( "and (not isVisible)" ), QtxPopupMgr::VisibleRule ); popupMgr()->insert( action( 300 ), -1, -1 ); // ERASE - popupMgr()->setRule( action( 300 ), aRule.arg( "and isVisible" ), true ); + popupMgr()->setRule( action( 300 ), aRule.arg( "and isVisible" ), QtxPopupMgr::VisibleRule ); popupMgr()->insert( action( 302 ), -1, -1 ); // DISPLAY_ONLY - popupMgr()->setRule( action( 302 ), aRule.arg( "" ), true ); + popupMgr()->setRule( action( 302 ), aRule.arg( "" ), QtxPopupMgr::VisibleRule ); popupMgr()->insert( separator(), -1, -1 ); @@ -3047,9 +2995,9 @@ bool SMESHGUI::activateModule( SUIT_Study* study ) setToolShown( true ); // Reset actions accelerator keys - action(111)->setAccel(QKeySequence(CTRL + Key_B)); // Import DAT - action(112)->setAccel(QKeySequence(CTRL + Key_U)); // Import UNV - action(113)->setAccel(QKeySequence(CTRL + Key_M)); // Import MED + action(111)->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_B)); // Import DAT + action(112)->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_U)); // Import UNV + action(113)->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M)); // Import MED return res; } @@ -3062,9 +3010,9 @@ bool SMESHGUI::deactivateModule( SUIT_Study* study ) EmitSignalCloseAllDialogs(); // Unset actions accelerator keys - action(111)->setAccel(QKeySequence()); // Import DAT - action(112)->setAccel(QKeySequence()); // Import UNV - action(113)->setAccel(QKeySequence()); // Import MED + action(111)->setShortcut(QKeySequence()); // Import DAT + action(112)->setShortcut(QKeySequence()); // Import UNV + action(113)->setShortcut(QKeySequence()); // Import MED return SalomeApp_Module::deactivateModule( study ); } @@ -3107,17 +3055,15 @@ QString SMESHGUI::engineIOR() const return QString( anIOR.in() ); } -void SMESHGUI::contextMenuPopup( const QString& client, QPopupMenu* menu, QString& /*title*/ ) +LightApp_Selection* SMESHGUI::createSelection( const QString& client, LightApp_SelectionMgr* mgr ) const { - SMESHGUI_Selection sel; - sel.init( client, selectionMgr() ); - popupMgr()->updatePopup( menu, &sel ); + return new SMESHGUI_Selection( client, mgr ); } void SMESHGUI::windows( QMap& aMap ) const { - aMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft ); - aMap.insert( SalomeApp_Application::WT_PyConsole, Qt::DockBottom ); + aMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea ); + aMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea ); } void SMESHGUI::viewManagers( QStringList& list ) const @@ -3157,7 +3103,7 @@ void SMESHGUI::createPreferences() modes.append( "Shading" ); modes.append( "Nodes" ); modes.append( "Shrink" ); - QValueList indices; + QList indices; indices.append( 0 ); indices.append( 1 ); indices.append( 2 ); @@ -3231,7 +3177,7 @@ void SMESHGUI::createPreferences() fam.append( tr( "SMESH_FONT_ARIAL" ) ); fam.append( tr( "SMESH_FONT_COURIER" ) ); fam.append( tr( "SMESH_FONT_TIMES" ) ); - int wflag = ( QtxListResourceEdit::FontItem::All & ( ~( QtxListResourceEdit::FontItem::Size | QtxListResourceEdit::FontItem::UserSize ) ) ); + int wflag = ( QtxFontEdit::Family | QtxFontEdit::Scripting ); setPreferenceProperty( tfont, "families", fam ); setPreferenceProperty( tfont, "system", false ); @@ -3356,10 +3302,9 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name ) if(aWarning.size() != 0){ aWarning += "The default values are applied instead."; - SUIT_MessageBox::warn1(SMESHGUI::desktop(), - QObject::tr("SMESH_ERR_SCALARBAR_PARAMS"), - QObject::tr(aWarning.c_str()), - QObject::tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(SMESHGUI::desktop(), + QObject::tr("SMESH_ERR_SCALARBAR_PARAMS"), + QObject::tr(aWarning.c_str())); } } } @@ -3475,7 +3420,7 @@ LightApp_Displayer* SMESHGUI::displayer() return myDisplayer; } -SALOMEDS::Color SMESHGUI::getUniqueColor( const QValueList& theReservedColors ) +SALOMEDS::Color SMESHGUI::getUniqueColor( const QList& theReservedColors ) { int aHue = -1; int aTolerance = 64; @@ -3498,8 +3443,8 @@ SALOMEDS::Color SMESHGUI::getUniqueColor( const QValueList& the //cout << "Auto colors : "; bool ok = true; - QValueList::const_iterator it = theReservedColors.constBegin(); - QValueList::const_iterator itEnd = theReservedColors.constEnd(); + QList::const_iterator it = theReservedColors.constBegin(); + QList::const_iterator itEnd = theReservedColors.constEnd(); for( ; it != itEnd; ++it ) { SALOMEDS::Color anAutoColor = *it; diff --git a/src/SMESHGUI/SMESHGUI.h b/src/SMESHGUI/SMESHGUI.h index 33ced9a76..9c5f591be 100644 --- a/src/SMESHGUI/SMESHGUI.h +++ b/src/SMESHGUI/SMESHGUI.h @@ -1,40 +1,39 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI.h +// Author : Nicolas REJNERI, Open CASCADE S.A.S. // -// -// File : SMESHGUI.h -// Author : Nicolas REJNERI -// Module : SMESH -// $Header$ -#ifndef SMESHGUI_HeaderFile -#define SMESHGUI_HeaderFile +#ifndef SMESHGUI_H +#define SMESHGUI_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -// SALOME Includes +// SALOME GUI includes #include #include +// IDL includes #include #include CORBA_SERVER_HEADER(SMESH_Gen) @@ -48,11 +47,11 @@ class SUIT_ViewManager; class LightApp_Operation; class SalomeApp_Study; +class LightApp_Selection; class LightApp_SelectionMgr; class SMESHGUI_FilterLibraryDlg; - //================================================================================= // class : SMESHGUI // purpose : @@ -69,84 +68,90 @@ public : static SMESHGUI* GetSMESHGUI(); static LightApp_SelectionMgr* selectionMgr(); static SUIT_ResourceMgr* resourceMgr(); - static SUIT_Desktop* desktop() ; + static SUIT_Desktop* desktop(); static SalomeApp_Study* activeStudy(); bool isActiveStudyLocked(); static bool automaticUpdate(); virtual LightApp_Displayer* displayer(); - virtual QString engineIOR() const; - virtual void initialize( CAM_Application* ); - virtual void windows( QMap& ) const; - virtual void viewManagers( QStringList& ) const; + virtual QString engineIOR() const; + virtual void initialize( CAM_Application* ); + virtual void windows( QMap& ) const; + virtual void viewManagers( QStringList& ) const; - QDialog* GetActiveDialogBox() ; - void SetActiveDialogBox(QDialog* aDlg) ; + QDialog* GetActiveDialogBox(); + void SetActiveDialogBox( QDialog* ); - void ResetState() ; - void SetState(int aState) ; - bool DefineDlgPosition(QWidget* aDlg, int& x, int& y) ; - void switchToOperation(int id) ; + void ResetState(); + void SetState( int ); + bool DefineDlgPosition( QWidget*, int&, int& ); + void switchToOperation( int ); - virtual bool OnGUIEvent ( int id ); - virtual bool OnMousePress ( QMouseEvent*, SUIT_ViewWindow* ); - virtual bool OnMouseMove ( QMouseEvent*, SUIT_ViewWindow* ); - virtual bool OnKeyPress ( QKeyEvent*, SUIT_ViewWindow* ); + virtual bool OnGUIEvent( int ); + virtual bool OnMousePress( QMouseEvent*, SUIT_ViewWindow* ); + virtual bool OnMouseMove( QMouseEvent*, SUIT_ViewWindow* ); + virtual bool OnKeyPress( QKeyEvent*, SUIT_ViewWindow* ); - virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& ); + virtual LightApp_Selection* createSelection( const QString&, LightApp_SelectionMgr* ) const; - virtual void BuildPresentation ( const Handle(SALOME_InteractiveObject)&, - SUIT_ViewWindow* = 0 ); + virtual void BuildPresentation ( const Handle(SALOME_InteractiveObject)&, + SUIT_ViewWindow* = 0 ); /* Non modal dialog boxes management */ - void EmitSignalDeactivateDialog() ; - void EmitSignalStudyFrameChanged() ; - void EmitSignalCloseAllDialogs() ; + void EmitSignalDeactivateDialog(); + void EmitSignalStudyFrameChanged(); + void EmitSignalCloseAllDialogs(); - virtual void createPreferences(); - virtual void preferencesChanged( const QString&, const QString& ); + virtual void createPreferences(); + virtual void preferencesChanged( const QString&, const QString& ); - virtual void update( const int ); + virtual void update( const int ); - static SALOMEDS::Color getUniqueColor( const QValueList& ); + static SALOMEDS::Color getUniqueColor( const QList& ); public slots: - virtual bool deactivateModule( SUIT_Study* ); - virtual bool activateModule( SUIT_Study* ); - virtual void studyClosed( SUIT_Study* ); + virtual bool deactivateModule( SUIT_Study* ); + virtual bool activateModule( SUIT_Study* ); + virtual void studyClosed( SUIT_Study* ); private slots: - void OnGUIEvent(); - void onViewManagerActivated( SUIT_ViewManager* ); - void onOperationCommited( SUIT_Operation* ); - void onOperationAborted( SUIT_Operation* ); + void OnGUIEvent(); + void onViewManagerActivated( SUIT_ViewManager* ); + void onOperationCommited( SUIT_Operation* ); + void onOperationAborted( SUIT_Operation* ); signals: - void SignalDeactivateActiveDialog() ; - void SignalStudyFrameChanged() ; - void SignalCloseAllDialogs() ; + void SignalDeactivateActiveDialog(); + void SignalStudyFrameChanged(); + void SignalCloseAllDialogs(); protected: - void createSMESHAction( const int, const QString&, const QString& = QString(""), - const int = 0, const bool = false ); - void createPopupItem( const int, const QString&, const QString&, - const QString& = QString::null, const int = -1 ); + void createSMESHAction( const int, + const QString&, + const QString& = QString(), + const int = 0, + const bool = false ); + void createPopupItem( const int, + const QString&, + const QString&, + const QString& = QString(), + const int = -1 ); - virtual LightApp_Operation* createOperation( const int ) const; + virtual LightApp_Operation* createOperation( const int ) const; private: - void OnEditDelete(); + void OnEditDelete(); private : - static SMESH::SMESH_Gen_var myComponentSMESH; - QDialog* myActiveDialogBox; - int myState; - QMap myRules; - LightApp_Displayer* myDisplayer; + static SMESH::SMESH_Gen_var myComponentSMESH; + QDialog* myActiveDialogBox; + int myState; + QMap myRules; + LightApp_Displayer* myDisplayer; - SMESHGUI_FilterLibraryDlg* myFilterLibraryDlg; + SMESHGUI_FilterLibraryDlg* myFilterLibraryDlg; }; -#endif +#endif // SMESHGUI_H diff --git a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx index 3d7781319..1267a44ce 100644 --- a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx @@ -1,31 +1,29 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_AddMeshElementDlg.cxx +// Author : Nicolas REJNERI, Open CASCADE S.A.S. // -// -// File : SMESHGUI_AddMeshElementDlg.cxx -// Author : Nicolas REJNERI -// Module : SMESH -// $Header$ +// SMESH includes #include "SMESHGUI_AddMeshElementDlg.h" #include "SMESHGUI.h" @@ -33,68 +31,56 @@ #include "SMESHGUI_VTKUtils.h" #include "SMESHGUI_MeshUtils.h" #include "SMESHGUI_IdValidator.h" -#include "SMESH_ActorUtils.h" - -#include "SMDS_Mesh.hxx" -#include "SMESH_Actor.h" - -#include "SUIT_Session.h" -#include "SUIT_MessageBox.h" -#include "LightApp_Application.h" - -#include "SVTK_Selection.h" -#include "SVTK_Selector.h" -#include "SALOME_ListIO.hxx" -#include "SALOME_ListIteratorOfListIO.hxx" - -#include "SalomeApp_Study.h" -#include "SalomeApp_Application.h" - -#include "SVTK_ViewModel.h" -#include "SVTK_ViewWindow.h" - -#include "utilities.h" +#include +#include +#include + +// SALOME GUI inclues +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// IDL incldues #include CORBA_SERVER_HEADER(SMESH_MeshEditor) -// OCCT Includes +// OCCT includes #include -#include -// VTK Includes +// VTK includes #include #include -#include -#include -#include #include #include #include -// QT Includes -#include -#include -#include -#include -#include -#include -#include +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include #include -#include -#include -#include -#include -#include -#include +#include +#include -// STL includes -#include +#define SPACING 6 +#define MARGIN 11 -using namespace std; - -namespace SMESH { - - class TElementSimulation { +namespace SMESH +{ + class TElementSimulation + { SalomeApp_Application* myApplication; SUIT_ViewWindow* myViewWindow; SVTK_ViewWindow* myVTKViewWindow; @@ -215,14 +201,15 @@ namespace SMESH { // purpose : constructor //================================================================================= SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule, - const char* name, - SMDSAbs_ElementType ElementType, int nbNodes, - bool modal, WFlags fl) - : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | - WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose), - mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) + SMDSAbs_ElementType ElementType, + int nbNodes ) + : QDialog( SMESH::GetDesktop( theModule ) ), + mySMESHGUI( theModule ), + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) { + setModal( false ); + setAttribute( Qt::WA_DeleteOnClose, true ); + SalomeApp_Application* anApp = dynamic_cast (SUIT_Session::session()->activeApplication()); myIsPoly = false; @@ -234,12 +221,12 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule, myElementType = ElementType; switch (ElementType) { case SMDSAbs_Face: -// if (myNbNodes != 3 && myNbNodes != 4) -// myNbNodes = 3; -// break; + // if (myNbNodes != 3 && myNbNodes != 4) + // myNbNodes = 3; + // break; case SMDSAbs_Volume: -// if (myNbNodes != 4 && myNbNodes != 8) //(nbNodes < 4 || nbNodes > 8 || nbNodes == 7) -// myNbNodes = 4; + // if (myNbNodes != 4 && myNbNodes != 8) //(nbNodes < 4 || nbNodes > 8 || nbNodes == 7) + // myNbNodes = 4; break; default: myElementType = SMDSAbs_Edge; @@ -277,120 +264,83 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule, myHelpFileName = "adding_nodes_and_elements_page.html#adding_polyhedrons_anchor"; } - QString iconName = tr(QString("ICON_DLG_%1").arg(elemName)); - QString buttonGrTitle = tr(QString("SMESH_%1").arg(elemName)); - QString caption = tr(QString("SMESH_ADD_%1_TITLE").arg(elemName)); - QString grBoxTitle = tr(QString("SMESH_ADD_%1").arg(elemName)); + QString iconName = tr(QString("ICON_DLG_%1").arg(elemName).toLatin1().data()); + QString buttonGrTitle = tr(QString("SMESH_%1").arg(elemName).toLatin1().data()); + QString caption = tr(QString("SMESH_ADD_%1_TITLE").arg(elemName).toLatin1().data()); + QString grBoxTitle = tr(QString("SMESH_ADD_%1").arg(elemName).toLatin1().data()); QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", iconName)); QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT"))); - if (!name) - setName("SMESHGUI_AddMeshElementDlg"); - resize(303, 185); - setCaption(caption); + setWindowTitle(caption); + setSizeGripEnabled(true); - setSizeGripEnabled(TRUE); - SMESHGUI_AddMeshElementDlgLayout = new QGridLayout(this); - SMESHGUI_AddMeshElementDlgLayout->setSpacing(6); - SMESHGUI_AddMeshElementDlgLayout->setMargin(11); + QVBoxLayout* aTopLayout = new QVBoxLayout(this); + aTopLayout->setSpacing(SPACING); + aTopLayout->setMargin(MARGIN); /***************************************************************/ - GroupConstructors = new QButtonGroup(this, "GroupConstructors"); - GroupConstructors->setTitle(buttonGrTitle); - - GroupConstructors->setExclusive(TRUE); - GroupConstructors->setColumnLayout(0, Qt::Vertical); - GroupConstructors->layout()->setSpacing(0); - GroupConstructors->layout()->setMargin(0); - GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout()); - GroupConstructorsLayout->setAlignment(Qt::AlignTop); - GroupConstructorsLayout->setSpacing(6); - GroupConstructorsLayout->setMargin(11); - Constructor1 = new QRadioButton(GroupConstructors, "Constructor1"); - Constructor1->setText(tr("" )); - Constructor1->setPixmap(image0); - Constructor1->setChecked(TRUE); - Constructor1->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth())); - Constructor1->setMinimumSize(QSize(50, 0)); - GroupConstructorsLayout->addWidget(Constructor1, 0, 0); - QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - GroupConstructorsLayout->addItem(spacer, 0, 1); - SMESHGUI_AddMeshElementDlgLayout->addWidget(GroupConstructors, 0, 0); + GroupConstructors = new QGroupBox(buttonGrTitle, this); + QHBoxLayout* GroupConstructorsLayout = new QHBoxLayout(GroupConstructors); + GroupConstructorsLayout->setSpacing(SPACING); + GroupConstructorsLayout->setMargin(MARGIN); - /***************************************************************/ - GroupButtons = new QGroupBox(this, "GroupButtons"); - GroupButtons->setGeometry(QRect(10, 10, 281, 48)); - GroupButtons->setTitle(tr("" )); - GroupButtons->setColumnLayout(0, Qt::Vertical); - GroupButtons->layout()->setSpacing(0); - GroupButtons->layout()->setMargin(0); - GroupButtonsLayout = new QGridLayout(GroupButtons->layout()); - GroupButtonsLayout->setAlignment(Qt::AlignTop); - GroupButtonsLayout->setSpacing(6); - GroupButtonsLayout->setMargin(11); - buttonCancel = new QPushButton(GroupButtons, "buttonCancel"); - buttonCancel->setText(tr("SMESH_BUT_CLOSE" )); - buttonCancel->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonCancel, 0, 3); - buttonApply = new QPushButton(GroupButtons, "buttonApply"); - buttonApply->setText(tr("SMESH_BUT_APPLY" )); - buttonApply->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonApply, 0, 1); - QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - GroupButtonsLayout->addItem(spacer_9, 0, 2); - buttonOk = new QPushButton(GroupButtons, "buttonOk"); - buttonOk->setText(tr("SMESH_BUT_OK" )); - buttonOk->setAutoDefault(TRUE); - buttonOk->setDefault(TRUE); - GroupButtonsLayout->addWidget(buttonOk, 0, 0); - buttonHelp = new QPushButton(GroupButtons, "buttonHelp"); - buttonHelp->setText(tr("SMESH_BUT_HELP" )); - buttonHelp->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonHelp, 0, 4); - - SMESHGUI_AddMeshElementDlgLayout->addWidget(GroupButtons, 2, 0); + Constructor1 = new QRadioButton(GroupConstructors); + Constructor1->setIcon(image0); + Constructor1->setChecked(true); + + GroupConstructorsLayout->addWidget(Constructor1); + GroupConstructorsLayout->addStretch(); /***************************************************************/ - GroupC1 = new QGroupBox(this, "GroupC1"); - GroupC1->setTitle(grBoxTitle); - - GroupC1->setMinimumSize(QSize(0, 0)); - GroupC1->setFrameShape(QGroupBox::Box); - GroupC1->setFrameShadow(QGroupBox::Sunken); - GroupC1->setColumnLayout(0, Qt::Vertical); - GroupC1->layout()->setSpacing(0); - GroupC1->layout()->setMargin(0); - GroupC1Layout = new QGridLayout(GroupC1->layout()); - GroupC1Layout->setAlignment(Qt::AlignTop); - GroupC1Layout->setSpacing(6); - GroupC1Layout->setMargin(11); - TextLabelC1A1 = new QLabel(GroupC1, "TextLabelC1A1"); - TextLabelC1A1->setText(tr("SMESH_ID_NODES" )); - TextLabelC1A1->setMinimumSize(QSize(50, 0)); - TextLabelC1A1->setFrameShape(QLabel::NoFrame); - TextLabelC1A1->setFrameShadow(QLabel::Plain); - GroupC1Layout->addWidget(TextLabelC1A1, 0, 0); - SelectButtonC1A1 = new QPushButton(GroupC1, "SelectButtonC1A1"); - SelectButtonC1A1->setText(tr("" )); - SelectButtonC1A1->setPixmap(image1); - SelectButtonC1A1->setToggleButton(FALSE); - GroupC1Layout->addWidget(SelectButtonC1A1, 0, 1); - LineEditC1A1 = new QLineEdit(GroupC1, "LineEditC1A1"); -// LineEditC1A1->setReadOnly(TRUE); + GroupC1 = new QGroupBox(grBoxTitle, this); + QGridLayout* GroupC1Layout = new QGridLayout(GroupC1); + GroupC1Layout->setSpacing(SPACING); + GroupC1Layout->setMargin(MARGIN); + + TextLabelC1A1 = new QLabel(tr("SMESH_ID_NODES"), GroupC1); + SelectButtonC1A1 = new QPushButton(GroupC1); + SelectButtonC1A1->setIcon(image1); + LineEditC1A1 = new QLineEdit(GroupC1); + // LineEditC1A1->setReadOnly(true); if (!myIsPoly) - LineEditC1A1->setValidator(new SMESHGUI_IdValidator(this, "validator", myNbNodes)); - GroupC1Layout->addWidget(LineEditC1A1, 0, 2); + LineEditC1A1->setValidator(new SMESHGUI_IdValidator(this, myNbNodes)); - if (myElementType == SMDSAbs_Face) { - Reverse = new QCheckBox(GroupC1, "Reverse"); - Reverse->setText(tr("SMESH_REVERSE" )); - GroupC1Layout->addWidget(Reverse, 1, 0); - } - else - Reverse = 0; + Reverse = myElementType == SMDSAbs_Face ? new QCheckBox(tr("SMESH_REVERSE"), GroupC1) : 0; + + GroupC1Layout->addWidget(TextLabelC1A1, 0, 0); + GroupC1Layout->addWidget(SelectButtonC1A1, 0, 1); + GroupC1Layout->addWidget(LineEditC1A1, 0, 2); + if ( Reverse ) GroupC1Layout->addWidget(Reverse, 1, 0, 1, 3); - SMESHGUI_AddMeshElementDlgLayout->addWidget(GroupC1, 1, 0); + /***************************************************************/ + GroupButtons = new QGroupBox(this); + QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons); + GroupButtonsLayout->setSpacing(SPACING); + GroupButtonsLayout->setMargin(MARGIN); + + buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk->setAutoDefault(true); + buttonOk->setDefault(true); + buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); + buttonApply->setAutoDefault(true); + buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons); + buttonCancel->setAutoDefault(true); + buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons); + buttonHelp->setAutoDefault(true); + + GroupButtonsLayout->addWidget(buttonOk); + GroupButtonsLayout->addSpacing(10); + GroupButtonsLayout->addWidget(buttonApply); + GroupButtonsLayout->addSpacing(10); + GroupButtonsLayout->addStretch(); + GroupButtonsLayout->addWidget(buttonCancel); + GroupButtonsLayout->addWidget(buttonHelp); + + /***************************************************************/ + aTopLayout->addWidget(GroupConstructors); + aTopLayout->addWidget(GroupC1); + aTopLayout->addWidget(GroupButtons); Init(); /* Initialisations */ } @@ -401,7 +351,6 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule, //================================================================================= SMESHGUI_AddMeshElementDlg::~SMESHGUI_AddMeshElementDlg() { - // no need to delete child widgets, Qt does it all for us delete mySimulation; } @@ -412,7 +361,7 @@ SMESHGUI_AddMeshElementDlg::~SMESHGUI_AddMeshElementDlg() void SMESHGUI_AddMeshElementDlg::Init() { GroupC1->show(); - Constructor1->setChecked(TRUE); + Constructor1->setChecked(true); myEditCurrentArgument = LineEditC1A1; mySMESHGUI->SetActiveDialogBox((QDialog*)this); @@ -435,8 +384,6 @@ void SMESHGUI_AddMeshElementDlg::Init() if (Reverse) connect(Reverse, SIGNAL(stateChanged(int)), SLOT(CheckBox(int))); - this->show(); // displays Dialog - // set selection mode SMESH::SetPointRepresentation(true); @@ -459,7 +406,7 @@ void SMESHGUI_AddMeshElementDlg::ClickOnApply() SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array; anArrayOfIdeces->length(myNbNodes); bool reverse = (Reverse && Reverse->isChecked()); - QStringList aListId = QStringList::split(" ", myEditCurrentArgument->text(), false); + QStringList aListId = myEditCurrentArgument->text().split(" ", QString::SkipEmptyParts); for (int i = 0; i < aListId.count(); i++) if (reverse) anArrayOfIdeces[i] = aListId[ myNbNodes - i - 1 ].toInt(); @@ -505,9 +452,8 @@ void SMESHGUI_AddMeshElementDlg::ClickOnApply() //================================================================================= void SMESHGUI_AddMeshElementDlg::ClickOnOk() { - this->ClickOnApply(); - this->ClickOnCancel(); - return; + ClickOnApply(); + ClickOnCancel(); } //================================================================================= @@ -524,7 +470,6 @@ void SMESHGUI_AddMeshElementDlg::ClickOnCancel() disconnect(mySelectionMgr, 0, this, 0); mySMESHGUI->ResetState(); reject(); - return; } //================================================================================= @@ -537,16 +482,17 @@ void SMESHGUI_AddMeshElementDlg::ClickOnHelp() if (app) app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); else { - QString platform; + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName)); } } @@ -574,14 +520,14 @@ void SMESHGUI_AddMeshElementDlg::onTextChange (const QString& theNewText) if (aMesh) { TColStd_MapOfInteger newIndices; - QStringList aListId = QStringList::split(" ", theNewText, false); + QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts); bool allOk = true; for (int i = 0; i < aListId.count(); i++) { if( const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ) ) - { - newIndices.Add( n->GetID() ); - myNbOkNodes++; - } + { + newIndices.Add( n->GetID() ); + myNbOkNodes++; + } else allOk = false; } @@ -633,7 +579,7 @@ void SMESHGUI_AddMeshElementDlg::SelectionIntoArgument() buttonApply->setEnabled(false); mySimulation->SetVisibility(false); -// SMESH::SetPointRepresentation(true); + // SMESH::SetPointRepresentation(true); // get selected mesh SALOME_ListIO aList; @@ -680,7 +626,7 @@ void SMESHGUI_AddMeshElementDlg::displaySimulation() { if (myNbOkNodes && GroupButtons->isEnabled()) { SMESH::TElementSimulation::TVTKIds anIds; - QStringList aListId = QStringList::split(" ", myEditCurrentArgument->text(), false); + QStringList aListId = myEditCurrentArgument->text().split(" ", QString::SkipEmptyParts); for (int i = 0; i < aListId.count(); i++) anIds.push_back(myActor->GetObject()->GetNodeVTKId(aListId[ i ].toInt())); @@ -767,7 +713,6 @@ void SMESHGUI_AddMeshElementDlg::enterEvent (QEvent*) if (GroupConstructors->isEnabled()) return; ActivateThisDialog(); - return; } //================================================================================= @@ -777,8 +722,7 @@ void SMESHGUI_AddMeshElementDlg::enterEvent (QEvent*) void SMESHGUI_AddMeshElementDlg::closeEvent (QCloseEvent*) { /* same than click on cancel button */ - this->ClickOnCancel(); - return; + ClickOnCancel(); } //================================================================================= @@ -816,9 +760,8 @@ void SMESHGUI_AddMeshElementDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) - { - e->accept(); - ClickOnHelp(); - } + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + ClickOnHelp(); + } } diff --git a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.h b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.h index 3f4722315..a214237e9 100644 --- a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.h +++ b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.h @@ -1,49 +1,43 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_AddMeshElementDlg.h +// Author : Nicolas REJNERI, Open CASCADE S.A.S. // -// File : SMESHGUI_AddMeshElementDlg.h -// Author : Nicolas REJNERI -// Module : SMESH -// $Header$ -#ifndef DIALOGBOX_ADD_FACE_H -#define DIALOGBOX_ADD_FACE_H +#ifndef SMESHGUI_ADDMESHELEMENTDLG_H +#define SMESHGUI_ADDMESHELEMENTDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include "LightApp_SelectionMgr.h" - -#include "SMDSAbs_ElementType.hxx" +#include +// Qt includes +#include -// QT Includes -#include -#include +// IDL includes +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; class QGroupBox; class QLabel; class QLineEdit; @@ -52,91 +46,76 @@ class QRadioButton; class QCheckBox; class SMESHGUI; class SMESH_Actor; -class SMDS_Mesh; -class SVTK_ViewWindow; class SVTK_Selector; +class LightApp_SelectionMgr; -namespace SMESH{ +namespace SMESH +{ struct TElementSimulation; } -// IDL Headers -#include -#include CORBA_SERVER_HEADER(SMESH_Mesh) - //================================================================================= // class : SMESHGUI_AddMeshElementDlg // purpose : //================================================================================= class SMESHGUI_EXPORT SMESHGUI_AddMeshElementDlg : public QDialog { - Q_OBJECT + Q_OBJECT public: - SMESHGUI_AddMeshElementDlg( SMESHGUI*, - const char* = 0, - SMDSAbs_ElementType ElementType = SMDSAbs_Edge, - int nbNodes = 2, bool modal = FALSE, WFlags fl = 0 ); - ~SMESHGUI_AddMeshElementDlg(); - + SMESHGUI_AddMeshElementDlg( SMESHGUI*, SMDSAbs_ElementType = SMDSAbs_Edge, int = 2 ); + ~SMESHGUI_AddMeshElementDlg(); + private: - void Init (); - void closeEvent (QCloseEvent*); - void hideEvent (QHideEvent*); /* ESC key */ - void enterEvent (QEvent*); /* mouse enter the QWidget */ - void keyPressEvent(QKeyEvent*); - void displaySimulation(); - - SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ - LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ - int myNbOkNodes; /* to check when arguments is defined */ - bool myBusy; - SVTK_Selector* mySelector; - - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - int myElementType; - int myNbNodes; - bool myIsPoly; - - SMESH::SMESH_Mesh_var myMesh; - SMESH_Actor* myActor; - SMESH::TElementSimulation* mySimulation; - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox * GroupButtons; - QPushButton * buttonOk; - QPushButton * buttonCancel; - QPushButton * buttonApply; - QPushButton * buttonHelp; - QGroupBox * GroupC1; - QLabel * TextLabelC1A1; - QPushButton * SelectButtonC1A1; - QLineEdit * LineEditC1A1; - - QCheckBox * Reverse; - - QString myHelpFileName; - + void Init(); + void closeEvent( QCloseEvent* ); + void hideEvent( QHideEvent* ); /* ESC key */ + void enterEvent( QEvent* ); /* mouse enter the QWidget */ + void keyPressEvent( QKeyEvent* ); + void displaySimulation(); + + SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ + LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ + int myNbOkNodes; /* to check when arguments is defined */ + bool myBusy; + SVTK_Selector* mySelector; + + QLineEdit* myEditCurrentArgument; /* Current LineEdit */ + + int myElementType; + int myNbNodes; + bool myIsPoly; + + SMESH::SMESH_Mesh_var myMesh; + SMESH_Actor* myActor; + SMESH::TElementSimulation* mySimulation; + + QGroupBox* GroupConstructors; + QRadioButton* Constructor1; + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QPushButton* buttonApply; + QPushButton* buttonHelp; + QGroupBox* GroupC1; + QLabel* TextLabelC1A1; + QPushButton* SelectButtonC1A1; + QLineEdit* LineEditC1A1; + QCheckBox* Reverse; + + QString myHelpFileName; + private slots: - - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void ClickOnHelp(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void CheckBox( int ); - void onTextChange(const QString&); - -protected: - QGridLayout* SMESHGUI_AddMeshElementDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void ClickOnHelp(); + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void DeactivateActiveDialog(); + void ActivateThisDialog(); + void CheckBox( int ); + void onTextChange( const QString& ); }; -#endif // DIALOGBOX_ADD_FACE_H +#endif // SMESHGUI_ADDMESHELEMENTDLG_H diff --git a/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx b/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx index 1f1e5bd14..35465fb07 100644 --- a/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.cxx @@ -1,22 +1,29 @@ +// SMESH SMESHGUI : GUI for SMESH component +// // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_AddMeshElementDlg.cxx +// Author : Nicolas REJNERI, Open CASCADE S.A.S. +// + +// SMESH includes #include "SMESHGUI_AddQuadraticElementDlg.h" #include "SMESHGUI.h" @@ -24,69 +31,63 @@ #include "SMESHGUI_VTKUtils.h" #include "SMESHGUI_MeshUtils.h" #include "SMESHGUI_IdValidator.h" -#include "SMESH_ActorUtils.h" -#include "SMDS_Mesh.hxx" -#include "SMESH_Actor.h" +#include +#include +#include -#include "SUIT_Session.h" -#include "SUIT_MessageBox.h" -#include "LightApp_Application.h" +// SALOME GUI includes +#include +#include +#include +#include +#include -#include "SVTK_Selection.h" -#include "SVTK_Selector.h" -#include "SALOME_ListIO.hxx" -#include "SALOME_ListIteratorOfListIO.hxx" +#include -#include "SalomeApp_Study.h" -#include "SalomeApp_Application.h" +#include +#include -#include "SVTK_ViewModel.h" -#include "SVTK_ViewWindow.h" +#include -#include "utilities.h" +#include +// IDL includes +#include #include CORBA_SERVER_HEADER(SMESH_MeshEditor) -// OCCT Includes +// OCCT includes #include -#include -// VTK Includes -#include +// VTK includes #include -#include -#include -#include #include #include #include - -#include -#include -#include -#include -#include - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // STL includes -#include - -using namespace std; +#include -namespace SMESH { +#define SPACING 6 +#define MARGIN 11 - void ReverseConnectivity( vector & ids, int type ) +namespace SMESH +{ + void ReverseConnectivity( std::vector & ids, int type ) { // for reverse connectivity of other types keeping the first id, see // void SMESH_VisualObjDef::buildElemPrs() in SMESH_Object.cxx:900 @@ -134,7 +135,7 @@ namespace SMESH { reverse( ids.begin(), ids.end() ); } else { - vector aRevIds( ids.size() ); + std::vector aRevIds( ids.size() ); for ( int i = 0; i < ids.size(); i++) aRevIds[ i ] = ids[ conn[ i ]]; ids = aRevIds; @@ -317,20 +318,37 @@ static int LastHexahedronIds[] = {1,2,3,0,5,6,7,4,4,5,6,7}; +class SMESHGUI_IdEditItem: public QTableWidgetItem +{ +public: + SMESHGUI_IdEditItem(const QString& text ): + QTableWidgetItem(text, QTableWidgetItem::UserType+100) {}; + ~SMESHGUI_IdEditItem() {}; + + QWidget* createEditor() const; +}; + +QWidget* SMESHGUI_IdEditItem::createEditor() const +{ + QLineEdit *aLineEdit = new QLineEdit(text(), tableWidget()); + aLineEdit->setValidator( new SMESHGUI_IdValidator(tableWidget(), 1) ); + return aLineEdit; +} + //================================================================================= // function : SMESHGUI_AddQuadraticElementDlg() // purpose : constructor //================================================================================= SMESHGUI_AddQuadraticElementDlg::SMESHGUI_AddQuadraticElementDlg( SMESHGUI* theModule, - const int theType, - const char* name, - bool modal, WFlags fl) - : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | - WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose), - mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), - myType( theType ) + const int theType ) + : QDialog( SMESH::GetDesktop( theModule ) ), + mySMESHGUI( theModule ), + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), + myType( theType ) { + setModal( false ); + setAttribute( Qt::WA_DeleteOnClose, true ); + SalomeApp_Application* anApp = dynamic_cast (SUIT_Session::session()->activeApplication()); @@ -366,105 +384,82 @@ SMESHGUI_AddQuadraticElementDlg::SMESHGUI_AddQuadraticElementDlg( SMESHGUI* theM anElementName = QString("QUADRATIC_EDGE"); } - QString iconName = tr(QString("ICON_DLG_%1").arg(anElementName)); - QString caption = tr(QString("SMESH_ADD_%1_TITLE").arg(anElementName)); - QString argumentsGrTitle = tr(QString("SMESH_ADD_%1").arg(anElementName)); - QString constructorGrTitle = tr(QString("SMESH_%1").arg(anElementName)); + QString iconName = tr(QString("ICON_DLG_%1").arg(anElementName).toLatin1().data()); + QString caption = tr(QString("SMESH_ADD_%1_TITLE").arg(anElementName).toLatin1().data()); + QString argumentsGrTitle = tr(QString("SMESH_ADD_%1").arg(anElementName).toLatin1().data()); + QString constructorGrTitle = tr(QString("SMESH_%1").arg(anElementName).toLatin1().data()); QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", iconName)); QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT"))); - if (!name) - setName("SMESHGUI_AddQuadraticElementDlg"); - setCaption(caption); + setWindowTitle(caption); - setSizeGripEnabled(TRUE); - QGridLayout* aDialogLayout = new QGridLayout(this); - aDialogLayout->setSpacing(6); - aDialogLayout->setMargin(11); + setSizeGripEnabled(true); + + QVBoxLayout* aDialogLayout = new QVBoxLayout(this); + aDialogLayout->setSpacing(SPACING); + aDialogLayout->setMargin(MARGIN); /***************************************************************/ - GroupConstructors = new QButtonGroup(this, "GroupConstructors"); - GroupConstructors->setTitle(constructorGrTitle); - - GroupConstructors->setExclusive(TRUE); - GroupConstructors->setColumnLayout(0, Qt::Vertical); - GroupConstructors->layout()->setSpacing(0); - GroupConstructors->layout()->setMargin(0); - GroupConstructors->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed)); - QGridLayout* aGroupConstructorsLayout = new QGridLayout(GroupConstructors->layout()); - aGroupConstructorsLayout->setAlignment(Qt::AlignTop); - aGroupConstructorsLayout->setSpacing(6); - aGroupConstructorsLayout->setMargin(11); - myRadioButton1 = new QRadioButton(GroupConstructors, "myRadioButton1"); - myRadioButton1->setText(tr("" )); - myRadioButton1->setPixmap(image0); - myRadioButton1->setChecked(TRUE); - myRadioButton1->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, myRadioButton1->sizePolicy().hasHeightForWidth())); - aGroupConstructorsLayout->addWidget(myRadioButton1, 0, 0); - aGroupConstructorsLayout->addItem( new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1); - aDialogLayout->addWidget(GroupConstructors, 0, 0); + GroupConstructors = new QGroupBox(constructorGrTitle, this); + QHBoxLayout* aGroupConstructorsLayout = new QHBoxLayout(GroupConstructors); + aGroupConstructorsLayout->setSpacing(SPACING); + aGroupConstructorsLayout->setMargin(MARGIN); + + myRadioButton1 = new QRadioButton(GroupConstructors); + myRadioButton1->setIcon(image0); + aGroupConstructorsLayout->addWidget(myRadioButton1); + aGroupConstructorsLayout->addStretch(); /***************************************************************/ - GroupArguments = new QGroupBox(this, "GroupArguments"); - GroupArguments->setTitle(argumentsGrTitle); - GroupArguments->setColumnLayout(0, Qt::Vertical); - GroupArguments->layout()->setSpacing(0); - GroupArguments->layout()->setMargin(0); - GroupArguments->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding)); - QGridLayout* aGroupArgumentsLayout = new QGridLayout(GroupArguments->layout()); - aGroupArgumentsLayout->setAlignment(Qt::AlignTop); - aGroupArgumentsLayout->setSpacing(6); - aGroupArgumentsLayout->setMargin(11); - QLabel* aCornerNodesLabel = new QLabel(GroupArguments, "aCornerNodesLabel"); - aCornerNodesLabel->setText(tr("SMESH_CORNER_NODES" )); - aGroupArgumentsLayout->addWidget(aCornerNodesLabel, 0, 0); - mySelectButton = new QPushButton(GroupArguments, "mySelectButton"); - mySelectButton->setPixmap(image1); - aGroupArgumentsLayout->addWidget(mySelectButton, 0, 1); - myCornerNodes = new QLineEdit(GroupArguments, "myCornerNodes"); - aGroupArgumentsLayout->addWidget(myCornerNodes, 0, 2); - - myTable = new QTable(GroupArguments); - aGroupArgumentsLayout->addMultiCellWidget(myTable, 1, 1, 0, 2); - - myReverseCB = new QCheckBox(GroupArguments, "myReverseCB"); - myReverseCB->setText(tr("SMESH_REVERSE" )); - aGroupArgumentsLayout->addWidget(myReverseCB, 2, 0); - - aDialogLayout->addWidget(GroupArguments, 1, 0); + GroupArguments = new QGroupBox(argumentsGrTitle, this); + QGridLayout* aGroupArgumentsLayout = new QGridLayout(GroupArguments); + aGroupArgumentsLayout->setSpacing(SPACING); + aGroupArgumentsLayout->setMargin(MARGIN); + + QLabel* aCornerNodesLabel = new QLabel(tr("SMESH_CORNER_NODES"), GroupArguments); + mySelectButton = new QPushButton(GroupArguments); + mySelectButton->setIcon(image1); + myCornerNodes = new QLineEdit(GroupArguments); + myTable = new QTableWidget(GroupArguments); + + myReverseCB = new QCheckBox(tr("SMESH_REVERSE"), GroupArguments); + + aGroupArgumentsLayout->addWidget(aCornerNodesLabel, 0, 0); + aGroupArgumentsLayout->addWidget(mySelectButton, 0, 1); + aGroupArgumentsLayout->addWidget(myCornerNodes, 0, 2); + aGroupArgumentsLayout->addWidget(myTable, 1, 0, 1, 3); + aGroupArgumentsLayout->addWidget(myReverseCB, 2, 0, 1, 3); /***************************************************************/ - GroupButtons = new QGroupBox(this, "GroupButtons"); - GroupButtons->setColumnLayout(0, Qt::Vertical); - GroupButtons->layout()->setSpacing(0); - GroupButtons->layout()->setMargin(0); - GroupButtons->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); - QGridLayout* aGroupButtonsLayout = new QGridLayout(GroupButtons->layout()); - aGroupButtonsLayout->setAlignment(Qt::AlignTop); - aGroupButtonsLayout->setSpacing(6); - aGroupButtonsLayout->setMargin(11); - buttonCancel = new QPushButton(GroupButtons, "buttonCancel"); - buttonCancel->setText(tr("SMESH_BUT_CLOSE" )); - buttonCancel->setAutoDefault(TRUE); - aGroupButtonsLayout->addWidget(buttonCancel, 0, 3); - buttonApply = new QPushButton(GroupButtons, "buttonApply"); - buttonApply->setText(tr("SMESH_BUT_APPLY" )); - buttonApply->setAutoDefault(TRUE); - aGroupButtonsLayout->addWidget(buttonApply, 0, 1); - aGroupButtonsLayout->addItem( new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 2); - buttonOk = new QPushButton(GroupButtons, "buttonOk"); - buttonOk->setText(tr("SMESH_BUT_OK" )); - buttonOk->setAutoDefault(TRUE); - buttonOk->setDefault(TRUE); - aGroupButtonsLayout->addWidget(buttonOk, 0, 0); - buttonHelp = new QPushButton(GroupButtons, "buttonHelp"); - buttonHelp->setText(tr("SMESH_BUT_HELP" )); - buttonHelp->setAutoDefault(TRUE); - aGroupButtonsLayout->addWidget(buttonHelp, 0, 4); - - aDialogLayout->addWidget(GroupButtons, 2, 0); + GroupButtons = new QGroupBox(this); + QHBoxLayout* aGroupButtonsLayout = new QHBoxLayout(GroupButtons); + aGroupButtonsLayout->setSpacing(SPACING); + aGroupButtonsLayout->setMargin(MARGIN); + + buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk->setAutoDefault(true); + buttonOk->setDefault(true); + buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); + buttonApply->setAutoDefault(true); + buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons); + buttonCancel->setAutoDefault(true); + buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons); + buttonHelp->setAutoDefault(true); + + aGroupButtonsLayout->addWidget(buttonOk); + aGroupButtonsLayout->addSpacing(10); + aGroupButtonsLayout->addWidget(buttonApply); + aGroupButtonsLayout->addSpacing(10); + aGroupButtonsLayout->addStretch(); + aGroupButtonsLayout->addWidget(buttonCancel); + aGroupButtonsLayout->addWidget(buttonHelp); + + /***************************************************************/ + aDialogLayout->addWidget(GroupConstructors); + aDialogLayout->addWidget(GroupArguments); + aDialogLayout->addWidget(GroupButtons); Init(); /* Initialisations */ } @@ -475,7 +470,6 @@ SMESHGUI_AddQuadraticElementDlg::SMESHGUI_AddQuadraticElementDlg( SMESHGUI* theM //================================================================================= SMESHGUI_AddQuadraticElementDlg::~SMESHGUI_AddQuadraticElementDlg() { - // no need to delete child widgets, Qt does it all for us delete mySimulation; } @@ -485,8 +479,7 @@ SMESHGUI_AddQuadraticElementDlg::~SMESHGUI_AddQuadraticElementDlg() //================================================================================= void SMESHGUI_AddQuadraticElementDlg::Init() { - GroupArguments->show(); - myRadioButton1->setChecked(TRUE); + myRadioButton1->setChecked(true); myIsEditCorners = true; mySMESHGUI->SetActiveDialogBox((QDialog*)this); @@ -532,38 +525,38 @@ void SMESHGUI_AddQuadraticElementDlg::Init() break; } - myCornerNodes->setValidator(new SMESHGUI_IdValidator(this, "validator", myNbCorners)); + myCornerNodes->setValidator(new SMESHGUI_IdValidator(this, myNbCorners)); /* initialize table */ - myTable->setNumCols(3); - myTable->setNumRows(aNumRows); + myTable->setColumnCount(3); + myTable->setRowCount(aNumRows); QStringList aColLabels; aColLabels.append(tr("SMESH_FIRST")); aColLabels.append(tr("SMESH_MIDDLE")); aColLabels.append(tr("SMESH_LAST")); - myTable->setColumnLabels(aColLabels); + myTable->setHorizontalHeaderLabels(aColLabels); - for ( int col = 0; col < myTable->numCols(); col++ ) + for ( int col = 0; col < myTable->columnCount(); col++ ) myTable->setColumnWidth(col, 80); - myTable->setColumnReadOnly(0, true); - myTable->setColumnReadOnly(2, true); + //myTable->setColumnReadOnly(0, true); // VSR: TODO + //myTable->setColumnReadOnly(2, true); // VSR: TODO myTable->setEnabled( false ); - for ( int row = 0; row < myTable->numRows(); row++ ) - { - SMESHGUI_IdEditItem* anEditItem = new SMESHGUI_IdEditItem( myTable, QTableItem::OnTyping, "" ); - anEditItem->setReplaceable(false); - myTable->setItem(row, 1, anEditItem); - } + for ( int row = 0; row < myTable->rowCount(); row++ ) + { + SMESHGUI_IdEditItem* anEditItem = new SMESHGUI_IdEditItem( "" ); + anEditItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled); + myTable->setItem(row, 1, anEditItem); + } /* signals and slots connections */ connect(mySelectButton, SIGNAL(clicked()), SLOT(SetEditCorners())); connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(SelectionIntoArgument())); - connect(myTable, SIGNAL(doubleClicked(int, int, int, const QPoint&)), SLOT(onCellDoubleClicked(int, int, int, const QPoint&))); - connect(myTable, SIGNAL(valueChanged (int, int)), SLOT(onCellTextChange(int, int))); + connect(myTable, SIGNAL(cellDoubleClicked(int, int)), SLOT(onCellDoubleClicked(int, int))); + connect(myTable, SIGNAL(cellChanged (int, int)), SLOT(onCellTextChange(int, int))); connect(myCornerNodes, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&))); connect(myReverseCB, SIGNAL(stateChanged(int)), SLOT(onReverse(int))); @@ -575,8 +568,6 @@ void SMESHGUI_AddQuadraticElementDlg::Init() connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), SLOT(DeactivateActiveDialog())); connect(mySMESHGUI, SIGNAL (SignalStudyFrameChanged()), SLOT(ClickOnCancel())); - this->show(); // displays Dialog - // set selection mode SMESH::SetPointRepresentation(true); @@ -597,13 +588,13 @@ void SMESHGUI_AddQuadraticElementDlg::ClickOnApply() if (IsValid() && !mySMESHGUI->isActiveStudyLocked()) { myBusy = true; - vector anIds; + std::vector anIds; switch (myType) { case QUAD_EDGE: - anIds.push_back(myTable->text(0, 0).toInt()); - anIds.push_back(myTable->text(0, 2).toInt()); - anIds.push_back(myTable->text(0, 1).toInt()); + anIds.push_back(myTable->item(0, 0)->text().toInt()); + anIds.push_back(myTable->item(0, 2)->text().toInt()); + anIds.push_back(myTable->item(0, 1)->text().toInt()); break; case QUAD_TRIANGLE: case QUAD_QUADRANGLE: @@ -612,9 +603,9 @@ void SMESHGUI_AddQuadraticElementDlg::ClickOnApply() case QUAD_PENTAHEDRON: case QUAD_HEXAHEDRON: for ( int row = 0; row < myNbCorners; row++ ) - anIds.push_back(myTable->text(row, 0).toInt()); - for ( int row = 0; row < myTable->numRows(); row++ ) - anIds.push_back(myTable->text(row, 1).toInt()); + anIds.push_back(myTable->item(row, 0)->text().toInt()); + for ( int row = 0; row < myTable->rowCount(); row++ ) + anIds.push_back(myTable->item(row, 1)->text().toInt()); break; } if ( myReverseCB->isChecked()) @@ -666,7 +657,6 @@ void SMESHGUI_AddQuadraticElementDlg::ClickOnOk() { ClickOnApply(); ClickOnCancel(); - return; } //================================================================================= @@ -683,7 +673,6 @@ void SMESHGUI_AddQuadraticElementDlg::ClickOnCancel() disconnect(mySelectionMgr, 0, this, 0); mySMESHGUI->ResetState(); reject(); - return; } //================================================================================= @@ -696,16 +685,17 @@ void SMESHGUI_AddQuadraticElementDlg::ClickOnHelp() if (app) app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); else { - QString platform; + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName)); } } @@ -731,7 +721,7 @@ void SMESHGUI_AddQuadraticElementDlg::onTextChange (const QString& theNewText) if (aMesh) { TColStd_MapOfInteger newIndices; - QStringList aListId = QStringList::split(" ", theNewText, false); + QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts); bool allOk = true; for (int i = 0; i < aListId.count(); i++) { if( const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ) ) @@ -826,7 +816,7 @@ void SMESHGUI_AddQuadraticElementDlg::SelectionIntoArgument() myBusy = true; int theRow = myTable->currentRow(), theCol = myTable->currentColumn(); if ( theCol == 1 ) - myTable->setText(theRow, 1, aString); + myTable->item(theRow, 1)->setText(aString); myBusy = false; } @@ -855,23 +845,23 @@ void SMESHGUI_AddQuadraticElementDlg::displaySimulation() if ( myType == QUAD_EDGE ) { - anIds.push_back( myActor->GetObject()->GetNodeVTKId( myTable->text(0, 0).toInt() ) ); - anIds.push_back( myActor->GetObject()->GetNodeVTKId( myTable->text(0, 2).toInt() ) ); - anID = (myTable->text(0, 1)).toInt(&ok); - if (!ok) anID = (myTable->text(0, 0)).toInt(); + anIds.push_back( myActor->GetObject()->GetNodeVTKId( myTable->item(0, 0)->text().toInt() ) ); + anIds.push_back( myActor->GetObject()->GetNodeVTKId( myTable->item(0, 2)->text().toInt() ) ); + anID = myTable->item(0, 1)->text().toInt(&ok); + if (!ok) anID = myTable->item(0, 0)->text().toInt(); anIds.push_back( myActor->GetObject()->GetNodeVTKId(anID) ); aDisplayMode = VTK_WIREFRAME; } else { for ( int row = 0; row < myNbCorners; row++ ) - anIds.push_back( myActor->GetObject()->GetNodeVTKId( myTable->text(row, 0).toInt() ) ); + anIds.push_back( myActor->GetObject()->GetNodeVTKId( myTable->item(row, 0)->text().toInt() ) ); - for ( int row = 0; row < myTable->numRows(); row++ ) + for ( int row = 0; row < myTable->rowCount(); row++ ) { - anID = (myTable->text(row, 1)).toInt(&ok); + anID = myTable->item(row, 1)->text().toInt(&ok); if (!ok) { - anID = (myTable->text(row, 0)).toInt(); + anID = myTable->item(row, 0)->text().toInt(); aDisplayMode = VTK_WIREFRAME; } anIds.push_back( myActor->GetObject()->GetNodeVTKId(anID) ); @@ -940,7 +930,6 @@ void SMESHGUI_AddQuadraticElementDlg::enterEvent (QEvent*) if (GroupConstructors->isEnabled()) return; ActivateThisDialog(); - return; } //================================================================================= @@ -951,7 +940,6 @@ void SMESHGUI_AddQuadraticElementDlg::closeEvent (QCloseEvent*) { /* same than click on cancel button */ ClickOnCancel(); - return; } //================================================================================= @@ -994,9 +982,9 @@ bool SMESHGUI_AddQuadraticElementDlg::IsValid() bool ok; - for ( int row = 0; row < myTable->numRows(); row++ ) + for ( int row = 0; row < myTable->rowCount(); row++ ) { - int anID = (myTable->text(row, 1)).toInt(&ok); + int anID = myTable->item(row, 1)->text().toInt(&ok); if ( !ok ) return false; @@ -1014,15 +1002,15 @@ bool SMESHGUI_AddQuadraticElementDlg::IsValid() //================================================================================= void SMESHGUI_AddQuadraticElementDlg::UpdateTable( bool theConersValidity ) { - QStringList aListCorners = QStringList::split(" ", myCornerNodes->text(), false); + QStringList aListCorners = myCornerNodes->text().split(" ", QString::SkipEmptyParts); if ( aListCorners.count() == myNbCorners && theConersValidity ) { myTable->setEnabled( true ); // clear the Middle column - for ( int row = 0; row < myTable->numRows(); row++ ) - myTable->setText( row, 1, ""); + for ( int row = 0; row < myTable->rowCount(); row++ ) + myTable->item( row, 1 )->setText(""); int* aFirstColIds; int* aLastColIds; @@ -1059,18 +1047,18 @@ void SMESHGUI_AddQuadraticElementDlg::UpdateTable( bool theConersValidity ) } // fill the First and the Last columns - for (int i = 0, iEnd = myTable->numRows(); i < iEnd; i++) - myTable->setText( i, 0, aListCorners[ aFirstColIds[i] ] ); + for (int i = 0, iEnd = myTable->rowCount(); i < iEnd; i++) + myTable->item( i, 0 )->setText( aListCorners[ aFirstColIds[i] ] ); - for (int i = 0, iEnd = myTable->numRows(); i < iEnd; i++) - myTable->setText( i, 2, aListCorners[ aLastColIds[i] ] ); + for (int i = 0, iEnd = myTable->rowCount(); i < iEnd; i++) + myTable->item( i, 2 )->setText( aListCorners[ aLastColIds[i] ] ); } else { // clear table - for ( int row = 0; row < myTable->numRows(); row++ ) - for ( int col = 0; col < myTable->numCols(); col++ ) - myTable->setText(row, col, ""); + for ( int row = 0; row < myTable->rowCount(); row++ ) + for ( int col = 0; col < myTable->columnCount(); col++ ) + myTable->item(row, col)->setText(""); myTable->setEnabled( false ); } @@ -1081,13 +1069,12 @@ void SMESHGUI_AddQuadraticElementDlg::UpdateTable( bool theConersValidity ) // function : onTableActivate() // purpose : //================================================================================= -void SMESHGUI_AddQuadraticElementDlg::onCellDoubleClicked( int theRow, int theCol, int theButton, const QPoint& theMousePos ) +void SMESHGUI_AddQuadraticElementDlg::onCellDoubleClicked( int theRow, int theCol ) { - if ( theButton == 1 && theCol == 1 ) + if ( theCol == 1 ) myIsEditCorners = false; displaySimulation(); - return; } @@ -1097,15 +1084,7 @@ void SMESHGUI_AddQuadraticElementDlg::onCellDoubleClicked( int theRow, int theCo //================================================================================= void SMESHGUI_AddQuadraticElementDlg::onCellTextChange(int theRow, int theCol) { - onTextChange( myTable->text(theRow, theCol) ); -} - - -QWidget* SMESHGUI_IdEditItem::createEditor() const -{ - QLineEdit *aLineEdit = new QLineEdit(text(), table()->viewport()); - aLineEdit->setValidator( new SMESHGUI_IdValidator(table()->viewport(), "validator", 1) ); - return aLineEdit; + onTextChange( myTable->item(theRow, theCol)->text() ); } //================================================================================= @@ -1118,9 +1097,8 @@ void SMESHGUI_AddQuadraticElementDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) - { - e->accept(); - ClickOnHelp(); - } + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + ClickOnHelp(); + } } diff --git a/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.h b/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.h index 5a80c5e0b..f610dd9a6 100644 --- a/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.h +++ b/src/SMESHGUI/SMESHGUI_AddQuadraticElementDlg.h @@ -1,133 +1,126 @@ +// SMESH SMESHGUI : GUI for SMESH component +// // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#ifndef DIALOGBOX_ADD_QUADRATIC_ELEMENT_H -#define DIALOGBOX_ADD_QUADRATIC_ELEMENT_H +// File : SMESHGUI_AddMeshElementDlg.h +// Author : Nicolas REJNERI, Open CASCADE S.A.S. +// + +#ifndef SMESHGUI_ADDQUADRATICELEMENTDLG_H +#define SMESHGUI_ADDQUADRATICELEMENTDLG_H -#include "LightApp_SelectionMgr.h" +// SMESH includes +#include "SMESH_SMESHGUI.hxx" -// QT Includes -#include -#include +// Qt includes +#include + +// IDL includes +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) -class QButtonGroup; class QGroupBox; class QLineEdit; class QPushButton; class QRadioButton; class QCheckBox; -class QTable; +class QTableWidget; class SMESHGUI; class SMESH_Actor; class SVTK_Selector; +class LightApp_SelectionMgr; -namespace SMESH{ +namespace SMESH +{ struct TElementSimulation; } -// IDL Headers -#include -#include CORBA_SERVER_HEADER(SMESH_Mesh) - -enum { QUAD_EDGE, QUAD_TRIANGLE, QUAD_QUADRANGLE, QUAD_TETRAHEDRON, QUAD_PYRAMID, QUAD_PENTAHEDRON, QUAD_HEXAHEDRON }; +enum { QUAD_EDGE, QUAD_TRIANGLE, QUAD_QUADRANGLE, QUAD_TETRAHEDRON, + QUAD_PYRAMID, QUAD_PENTAHEDRON, QUAD_HEXAHEDRON }; //================================================================================= // class : SMESHGUI_AddQuadraticElementDlg // purpose : //================================================================================= -class SMESHGUI_AddQuadraticElementDlg : public QDialog +class SMESHGUI_EXPORT SMESHGUI_AddQuadraticElementDlg : public QDialog { - Q_OBJECT + Q_OBJECT public: - SMESHGUI_AddQuadraticElementDlg( SMESHGUI* theModule, - const int theType, - const char* = 0, - bool modal = FALSE, WFlags fl = 0 ); - ~SMESHGUI_AddQuadraticElementDlg(); - + SMESHGUI_AddQuadraticElementDlg( SMESHGUI*, const int ); + ~SMESHGUI_AddQuadraticElementDlg(); + private: - void Init (); - void closeEvent (QCloseEvent*); - void hideEvent (QHideEvent*); /* ESC key */ - void enterEvent (QEvent*); /* mouse enter the QWidget */ - void keyPressEvent(QKeyEvent*); - void displaySimulation(); - void UpdateTable( bool theConersValidity = true ); - bool IsValid(); - - SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ - LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ - int myNbCorners; /* The required number of corners */ - bool myBusy; - SVTK_Selector* mySelector; - - SMESH::SMESH_Mesh_var myMesh; - SMESH_Actor* myActor; - SMESH::TElementSimulation* mySimulation; - - int myType; - bool myIsEditCorners; - - QButtonGroup* GroupConstructors; - QRadioButton* myRadioButton1; - - QGroupBox* GroupArguments; - QLineEdit* myCornerNodes; - QPushButton* mySelectButton; - QTable* myTable; - QCheckBox* myReverseCB; - - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QPushButton * buttonHelp; - - QString myHelpFileName; - -private slots: + void Init(); + void closeEvent( QCloseEvent* ); + void hideEvent( QHideEvent* ); /* ESC key */ + void enterEvent( QEvent* ); /* mouse enter the QWidget */ + void keyPressEvent( QKeyEvent* ); + void displaySimulation(); + void UpdateTable( bool = true ); + bool IsValid(); + + SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ + LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ + int myNbCorners; /* The required number of corners */ + bool myBusy; + SVTK_Selector* mySelector; - void onTextChange(const QString&); - void onCellTextChange(int, int); - void onReverse( int ); - void onCellDoubleClicked(int, int, int, const QPoint&); + SMESH::SMESH_Mesh_var myMesh; + SMESH_Actor* myActor; + SMESH::TElementSimulation* mySimulation; - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void ClickOnHelp(); - void SetEditCorners() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; -}; - -class SMESHGUI_IdEditItem: public QTableItem -{ -public: - SMESHGUI_IdEditItem(QTable* table, EditType et, const QString& text ): - QTableItem(table, et, text) {}; - ~SMESHGUI_IdEditItem() {}; - - QWidget* createEditor() const; + int myType; + bool myIsEditCorners; + + QGroupBox* GroupConstructors; + QRadioButton* myRadioButton1; + + QGroupBox* GroupArguments; + QLineEdit* myCornerNodes; + QPushButton* mySelectButton; + QTableWidget* myTable; + QCheckBox* myReverseCB; + + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QPushButton* buttonApply; + QPushButton* buttonHelp; + + QString myHelpFileName; + +private slots: + void onTextChange( const QString& ); + void onCellTextChange( int, int ); + void onReverse( int ); + void onCellDoubleClicked( int, int ); + + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void ClickOnHelp(); + void SetEditCorners(); + void SelectionIntoArgument(); + void DeactivateActiveDialog(); + void ActivateThisDialog(); }; - -#endif // DIALOGBOX_ADD_QUADRATIC_ELEMENT_H +#endif // SMESHGUI_ADDQUADRATICELEMENTDLG_H diff --git a/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx b/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx index 781959abb..7e88164ac 100644 --- a/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx @@ -1,30 +1,29 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_BuildCompoundDlg.cxx +// Author : Alexander KOVALEV, Open CASCADE S.A.S. // -// -// File : SMESHGUI_BuildCompoundDlg.cxx -// Author : Alexander KOVALEV -// Module : SMESH +// SMESH includes #include "SMESHGUI_BuildCompoundDlg.h" #include "SMESHGUI.h" @@ -32,169 +31,145 @@ #include "SMESHGUI_SpinBox.h" #include "SMESHGUI_VTKUtils.h" -#include "SMESH_TypeFilter.hxx" - -#include "SUIT_Desktop.h" -#include "SUIT_Session.h" -#include "SUIT_MessageBox.h" -#include "SalomeApp_Study.h" - -#include "LightApp_Application.h" - -#include "SALOME_ListIO.hxx" - -#include "utilities.h" - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include +#include + +// SALOME GUI includes +#include +#include +#include +#include +#include +#include +#include +#include + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// STL includes #include +#define SPACING 6 +#define MARGIN 11 + //================================================================================= // name : SMESHGUI_BuildCompoundDlg // Purpose : //================================================================================= -SMESHGUI_BuildCompoundDlg::SMESHGUI_BuildCompoundDlg( SMESHGUI* theModule) - : QDialog(SMESH::GetDesktop(theModule), "SMESHGUI_BuildCompoundDlg", false, WStyle_Customize | - WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose), +SMESHGUI_BuildCompoundDlg::SMESHGUI_BuildCompoundDlg( SMESHGUI* theModule ) + : QDialog(SMESH::GetDesktop(theModule)), mySMESHGUI(theModule), mySelectionMgr(SMESH::GetSelectionMgr(theModule)) { - setCaption(tr("SMESH_BUILD_COMPOUND_TITLE")); + setModal(false); + setAttribute(Qt::WA_DeleteOnClose, true); + setWindowTitle(tr("SMESH_BUILD_COMPOUND_TITLE")); SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); QPixmap image0 (aResMgr->loadPixmap("SMESH", tr("ICON_DLG_BUILD_COMPOUND_MESH"))); QPixmap image1 (aResMgr->loadPixmap("SMESH", tr("ICON_SELECT"))); - setSizeGripEnabled(TRUE); - SMESHGUI_BuildCompoundDlgLayout = new QGridLayout (this); - SMESHGUI_BuildCompoundDlgLayout->setSpacing(6); - SMESHGUI_BuildCompoundDlgLayout->setMargin(11); + setSizeGripEnabled(true); + + QVBoxLayout* aTopLayout = new QVBoxLayout(this); + aTopLayout->setSpacing(SPACING); + aTopLayout->setMargin(MARGIN); /***************************************************************/ - GroupConstructors = new QButtonGroup (this, "GroupConstructors"); - GroupConstructors->setTitle(tr("COMPOUND" )); - GroupConstructors->setExclusive(TRUE); - GroupConstructors->setColumnLayout(0, Qt::Vertical); - GroupConstructors->layout()->setSpacing(0); - GroupConstructors->layout()->setMargin(0); - GroupConstructorsLayout = new QGridLayout (GroupConstructors->layout()); - GroupConstructorsLayout->setAlignment(Qt::AlignTop); - GroupConstructorsLayout->setSpacing(6); - GroupConstructorsLayout->setMargin(11); - Constructor1 = new QRadioButton (GroupConstructors, "Constructor1"); - Constructor1->setText(tr("")); - Constructor1->setPixmap(image0); - Constructor1->setChecked(TRUE); - GroupConstructorsLayout->addWidget(Constructor1, 0, 0); - SMESHGUI_BuildCompoundDlgLayout->addWidget(GroupConstructors, 0, 0); + GroupConstructors = new QGroupBox(tr("COMPOUND"), this); + QHBoxLayout* GroupConstructorsLayout = new QHBoxLayout(GroupConstructors); + GroupConstructorsLayout->setSpacing(SPACING); + GroupConstructorsLayout->setMargin(MARGIN); + + Constructor1 = new QRadioButton(GroupConstructors); + Constructor1->setIcon(image0); + Constructor1->setChecked(true); + GroupConstructorsLayout->addWidget(Constructor1); + GroupConstructorsLayout->addStretch(); /***************************************************************/ - GroupName = new QGroupBox (this, "GroupName"); - GroupName->setTitle(tr("RESULT_NAME" )); - GroupName->setColumnLayout(0, Qt::Vertical); - GroupName->layout()->setSpacing(0); - GroupName->layout()->setMargin(0); - GroupNameLayout = new QGridLayout (GroupName->layout()); - GroupNameLayout->setAlignment(Qt::AlignTop); - GroupNameLayout->setSpacing(6); - GroupNameLayout->setMargin(11); - TextLabelName = new QLabel (GroupName, "TextLabelName"); - TextLabelName->setText(tr("SMESH_NAME")); - GroupNameLayout->addWidget(TextLabelName, 0, 0); - LineEditName = new QLineEdit (GroupName, "LineEditName"); - GroupNameLayout->addWidget(LineEditName, 0, 1); - SMESHGUI_BuildCompoundDlgLayout->addWidget(GroupName, 1, 0); + GroupName = new QGroupBox(tr("RESULT_NAME"), this); + QHBoxLayout* GroupNameLayout = new QHBoxLayout(GroupName); + GroupNameLayout->setSpacing(SPACING); + GroupNameLayout->setMargin(MARGIN); + + TextLabelName = new QLabel(tr("SMESH_NAME"), GroupName); + LineEditName = new QLineEdit(GroupName); + + GroupNameLayout->addWidget(TextLabelName); + GroupNameLayout->addWidget(LineEditName); /***************************************************************/ - GroupArgs = new QGroupBox (this, "GroupArgs"); - GroupArgs->setTitle(tr("SMESH_ARGUMENTS" )); - GroupArgs->setColumnLayout(0, Qt::Vertical); - GroupArgs->layout()->setSpacing(0); - GroupArgs->layout()->setMargin(0); - GroupArgsLayout = new QGridLayout (GroupArgs->layout()); - GroupArgsLayout->setAlignment(Qt::AlignTop); - GroupArgsLayout->setSpacing(6); - GroupArgsLayout->setMargin(11); - - TextLabelMeshes = new QLabel (GroupArgs, "TextLabelMeshes"); - TextLabelMeshes->setText(tr("MESHES")); - TextLabelMeshes->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); - GroupArgsLayout->addWidget(TextLabelMeshes, 0, 0); - SelectButton = new QPushButton (GroupArgs, "SelectButton"); - SelectButton->setText(tr("")); - SelectButton->setPixmap(image1); - SelectButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); - GroupArgsLayout->addWidget(SelectButton, 0, 1); - LineEditMeshes = new QLineEdit (GroupArgs, "LineEditMeshes"); + GroupArgs = new QGroupBox(tr("SMESH_ARGUMENTS"), this); + QGridLayout* GroupArgsLayout = new QGridLayout(GroupArgs); + GroupArgsLayout->setSpacing(SPACING); + GroupArgsLayout->setMargin(MARGIN); + + TextLabelMeshes = new QLabel(tr("MESHES"), GroupArgs); + SelectButton = new QPushButton(GroupArgs); + SelectButton->setIcon(image1); + LineEditMeshes = new QLineEdit(GroupArgs); LineEditMeshes->setReadOnly(true); - GroupArgsLayout->addMultiCellWidget(LineEditMeshes, 0, 0, 2, 3); - TextLabelUnion = new QLabel (GroupArgs, "TextLabelUnion"); - TextLabelUnion->setText(tr("PROCESSING_IDENTICAL_GROUPS")); - TextLabelUnion->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); - GroupArgsLayout->addMultiCellWidget(TextLabelUnion, 1, 1, 0, 2); - ComboBoxUnion = new QComboBox(GroupArgs, "ComboBoxUnion"); - GroupArgsLayout->addMultiCellWidget(ComboBoxUnion, 1, 1, 3, 3); + TextLabelUnion = new QLabel(tr("PROCESSING_IDENTICAL_GROUPS"), GroupArgs); + ComboBoxUnion = new QComboBox(GroupArgs); - CheckBoxMerge = new QCheckBox(GroupArgs, "CheckBoxMerge"); - CheckBoxMerge->setText(tr("MERGE_NODES_AND_ELEMENTS" )); - GroupArgsLayout->addMultiCellWidget(CheckBoxMerge, 2, 2, 0, 3); + CheckBoxMerge = new QCheckBox(tr("MERGE_NODES_AND_ELEMENTS"), GroupArgs); - TextLabelTol = new QLabel (GroupArgs, "TextLabelTol"); - TextLabelTol->setText(tr("SMESH_TOLERANCE")); + TextLabelTol = new QLabel(tr("SMESH_TOLERANCE"), GroupArgs); TextLabelTol->setAlignment(Qt::AlignCenter); - GroupArgsLayout->addMultiCellWidget(TextLabelTol, 3, 3, 0, 1); - SpinBoxTol = new SMESHGUI_SpinBox (GroupArgs, "SpinBoxTol"); + SpinBoxTol = new SMESHGUI_SpinBox(GroupArgs); SpinBoxTol->RangeStepAndValidator(0.0, COORD_MAX, 0.1, 6); - GroupArgsLayout->addMultiCellWidget(SpinBoxTol, 3, 3, 2, 3); - SMESHGUI_BuildCompoundDlgLayout->addWidget(GroupArgs, 2, 0); + GroupArgsLayout->addWidget(TextLabelMeshes, 0, 0); + GroupArgsLayout->addWidget(SelectButton, 0, 1); + GroupArgsLayout->addWidget(LineEditMeshes, 0, 2, 1, 2); + GroupArgsLayout->addWidget(TextLabelUnion, 1, 0, 1, 3); + GroupArgsLayout->addWidget(ComboBoxUnion, 1, 3); + GroupArgsLayout->addWidget(CheckBoxMerge, 2, 0, 1, 4); + GroupArgsLayout->addWidget(TextLabelTol, 3, 0, 1, 2); + GroupArgsLayout->addWidget(SpinBoxTol, 3, 2, 1, 2); /***************************************************************/ - GroupButtons = new QGroupBox (this, "GroupButtons"); - GroupButtons->setGeometry(QRect(10, 10, 281, 48)); - GroupButtons->setTitle(tr("" )); - GroupButtons->setColumnLayout(0, Qt::Vertical); - GroupButtons->layout()->setSpacing(0); - GroupButtons->layout()->setMargin(0); - GroupButtonsLayout = new QGridLayout (GroupButtons->layout()); - GroupButtonsLayout->setAlignment(Qt::AlignTop); - GroupButtonsLayout->setSpacing(6); - GroupButtonsLayout->setMargin(11); - buttonHelp = new QPushButton(GroupButtons, "buttonHelp"); - buttonHelp->setText(tr("SMESH_BUT_HELP" )); - buttonHelp->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonHelp, 0, 4); - buttonCancel = new QPushButton (GroupButtons, "buttonCancel"); - buttonCancel->setText(tr("SMESH_BUT_CLOSE" )); - buttonCancel->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonCancel, 0, 3); - buttonApply = new QPushButton (GroupButtons, "buttonApply"); - buttonApply->setText(tr("SMESH_BUT_APPLY" )); - buttonApply->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonApply, 0, 1); - QSpacerItem* spacer_9 = new QSpacerItem (20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - GroupButtonsLayout->addItem(spacer_9, 0, 2); - buttonOk = new QPushButton (GroupButtons, "buttonOk"); - buttonOk->setText(tr("SMESH_BUT_OK" )); - buttonOk->setAutoDefault(TRUE); - buttonOk->setDefault(TRUE); - GroupButtonsLayout->addWidget(buttonOk, 0, 0); - SMESHGUI_BuildCompoundDlgLayout->addWidget(GroupButtons, 3, 0); + GroupButtons = new QGroupBox(this); + QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons); + GroupButtonsLayout->setSpacing(SPACING); + GroupButtonsLayout->setMargin(MARGIN); + + buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk->setAutoDefault(true); + buttonOk->setDefault(true); + buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); + buttonApply->setAutoDefault(true); + buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons); + buttonCancel->setAutoDefault(true); + buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons); + buttonHelp->setAutoDefault(true); + + GroupButtonsLayout->addWidget(buttonOk); + GroupButtonsLayout->addSpacing(10); + GroupButtonsLayout->addWidget(buttonApply); + GroupButtonsLayout->addSpacing(10); + GroupButtonsLayout->addStretch(); + GroupButtonsLayout->addWidget(buttonCancel); + GroupButtonsLayout->addWidget(buttonHelp); + + /***************************************************************/ + aTopLayout->addWidget(GroupConstructors); + aTopLayout->addWidget(GroupName); + aTopLayout->addWidget(GroupArgs); + aTopLayout->addWidget(GroupButtons); myHelpFileName = "building_compounds_page.html"; @@ -207,7 +182,6 @@ SMESHGUI_BuildCompoundDlg::SMESHGUI_BuildCompoundDlg( SMESHGUI* theModule) //================================================================================= SMESHGUI_BuildCompoundDlg::~SMESHGUI_BuildCompoundDlg() { - // no need to delete child widgets, Qt does it all for us } //================================================================================= @@ -216,8 +190,6 @@ SMESHGUI_BuildCompoundDlg::~SMESHGUI_BuildCompoundDlg() //================================================================================= void SMESHGUI_BuildCompoundDlg::Init() { - GroupName->show(); - GroupArgs->show(); mySMESHGUI->SetActiveDialogBox((QDialog*)this); myMesh = SMESH::SMESH_Mesh::_nil(); @@ -227,9 +199,9 @@ void SMESHGUI_BuildCompoundDlg::Init() myMeshArray = new SMESH::mesh_array(); // signals and slots connections - connect(buttonOk , SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - connect(buttonApply , SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); connect(SelectButton, SIGNAL(clicked()), this, SLOT(SelectionIntoArgument())); @@ -239,16 +211,14 @@ void SMESHGUI_BuildCompoundDlg::Init() connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); - connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()) , this, SLOT(ClickOnCancel())); - - this->show(); // displays Dialog + connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); LineEditName->setText(GetDefaultName(tr("COMPOUND_MESH"))); LineEditMeshes->setFocus(); - ComboBoxUnion->insertItem(tr("UNITE")); - ComboBoxUnion->insertItem(tr("RENAME")); - ComboBoxUnion->setCurrentItem(0); + ComboBoxUnion->addItem(tr("UNITE")); + ComboBoxUnion->addItem(tr("RENAME")); + ComboBoxUnion->setCurrentIndex(0); CheckBoxMerge->setChecked(false); @@ -293,7 +263,7 @@ QString SMESHGUI_BuildCompoundDlg::GetDefaultName(const QString& theOperation) bool isUnique = false; while (!isUnique) { aName = theOperation + "_" + QString::number(++aNumber); - isUnique = (aSet.count(aName.latin1()) == 0); + isUnique = (aSet.count(aName.toLatin1().data()) == 0); } return aName; @@ -309,17 +279,17 @@ bool SMESHGUI_BuildCompoundDlg::ClickOnApply() return false; if (!myMesh->_is_nil()) { try { - QApplication::setOverrideCursor(Qt::waitCursor); + QApplication::setOverrideCursor(Qt::WaitCursor); SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen(); // concatenate meshes SMESH::SMESH_Mesh_var aCompoundMesh = aSMESHGen->Concatenate(myMeshArray, - !(ComboBoxUnion->currentItem()), + !(ComboBoxUnion->currentIndex()), CheckBoxMerge->isChecked(), SpinBoxTol->GetValue()); - SMESH::SetName( SMESH::FindSObject( aCompoundMesh ), LineEditName->text().latin1() ); + SMESH::SetName( SMESH::FindSObject( aCompoundMesh ), LineEditName->text() ); QApplication::restoreOverrideCursor(); mySMESHGUI->updateObjBrowser(); } catch(...) { @@ -368,10 +338,11 @@ void SMESHGUI_BuildCompoundDlg::ClickOnHelp() if (app) app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); else { - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + "application")). + arg(myHelpFileName)); } } @@ -448,7 +419,7 @@ void SMESHGUI_BuildCompoundDlg::ActivateThisDialog() // function : enterEvent() // purpose : //================================================================================= -void SMESHGUI_BuildCompoundDlg::enterEvent(QEvent* e) +void SMESHGUI_BuildCompoundDlg::enterEvent( QEvent* ) { if (GroupConstructors->isEnabled()) return; @@ -459,17 +430,17 @@ void SMESHGUI_BuildCompoundDlg::enterEvent(QEvent* e) // function : closeEvent() // purpose : //================================================================================= -void SMESHGUI_BuildCompoundDlg::closeEvent(QCloseEvent* e) +void SMESHGUI_BuildCompoundDlg::closeEvent( QCloseEvent* ) { /* same than click on cancel button */ - this->ClickOnCancel(); + ClickOnCancel(); } //======================================================================= //function : hideEvent //purpose : caused by ESC key //======================================================================= -void SMESHGUI_BuildCompoundDlg::hideEvent (QHideEvent * e) +void SMESHGUI_BuildCompoundDlg::hideEvent( QHideEvent* ) { if (!isMinimized()) ClickOnCancel(); @@ -486,11 +457,10 @@ void SMESHGUI_BuildCompoundDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) - { - e->accept(); - ClickOnHelp(); - } + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + ClickOnHelp(); + } } @@ -502,5 +472,4 @@ void SMESHGUI_BuildCompoundDlg::onSelectMerge(bool toMerge) { TextLabelTol->setEnabled(toMerge); SpinBoxTol->setEnabled(toMerge); - } diff --git a/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.h b/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.h index c7bc29cda..f71222064 100644 --- a/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.h +++ b/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.h @@ -1,86 +1,78 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_BuildCompoundDlg.h +// Author : Alexander KOVALEV, Open CASCADE S.A.S. // -// File : SMESHGUI_BuildCompoundDlg.h -// Author : Alexander KOVALEV -// Module : SMESH - -#ifndef SMESHGUI_BuildCompoundDlg_H -#define SMESHGUI_BuildCompoundDlg_H -#include "LightApp_SelectionMgr.h" -#include "SUIT_SelectionFilter.h" +#ifndef SMESHGUI_BUILDCOMPOUNDDLG_H +#define SMESHGUI_BUILDCOMPOUNDDLG_H -// QT Includes -#include +// SMESH includes +#include "SMESH_SMESHGUI.hxx" -#include +// Qt includes +#include -// Open CASCADE Includes +// IDL includes +#include +#include CORBA_SERVER_HEADER(SMESH_Gen) +#include CORBA_SERVER_HEADER(SMESH_Mesh) -class QGridLayout; -class QButtonGroup; class QGroupBox; class QLabel; class QLineEdit; class QPushButton; class QRadioButton; -class SMESHGUI; class QCheckBox; -class SMESHGUI_SpinBox; class QComboBox; -class QSizePolicy; -class QString; - -// IDL Headers -#include -#include CORBA_SERVER_HEADER(SMESH_Mesh) -#include CORBA_SERVER_HEADER(SMESH_Gen) +class SMESHGUI; +class SMESHGUI_SpinBox; +class LightApp_SelectionMgr; +class SUIT_SelectionFilter; //================================================================================= // class : SMESHGUI_BuildCompoundDlg // purpose : //================================================================================= -class SMESHGUI_BuildCompoundDlg : public QDialog +class SMESHGUI_EXPORT SMESHGUI_BuildCompoundDlg : public QDialog { Q_OBJECT; - public: +public: - SMESHGUI_BuildCompoundDlg (SMESHGUI * theModule); + SMESHGUI_BuildCompoundDlg( SMESHGUI* ); ~SMESHGUI_BuildCompoundDlg(); -public : - static QString GetDefaultName(const QString& theOperation); +public: + static QString GetDefaultName( const QString& ); - private: - void Init(); - void closeEvent (QCloseEvent*); - void enterEvent (QEvent*); /* mouse enter the QWidget */ - void hideEvent (QHideEvent*); /* ESC key */ - void keyPressEvent(QKeyEvent*); +private: + void Init(); + void closeEvent( QCloseEvent* ); + void enterEvent( QEvent* ); /* mouse enter the QWidget */ + void hideEvent( QHideEvent* ); /* ESC key */ + void keyPressEvent( QKeyEvent* ); - private: +private: SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ @@ -89,47 +81,40 @@ public : SMESH::mesh_array_var myMeshArray; // Widgets - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QPushButton* buttonHelp; - - QGroupBox* GroupName; - QLabel* TextLabelName; - QLineEdit* LineEditName; - - QGroupBox* GroupArgs; - QLabel* TextLabelMeshes; - QPushButton* SelectButton; - QLineEdit* LineEditMeshes; - QLabel* TextLabelUnion; - QComboBox* ComboBoxUnion; - QCheckBox* CheckBoxMerge; - QLabel* TextLabelTol; - SMESHGUI_SpinBox* SpinBoxTol; - - //protected: - QGridLayout* SMESHGUI_BuildCompoundDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupNameLayout; - QGridLayout* GroupArgsLayout; - - QString myHelpFileName; - - private slots: - void ClickOnOk(); - void ClickOnCancel(); - bool ClickOnApply(); - void ClickOnHelp(); - void SelectionIntoArgument(); - void DeactivateActiveDialog(); - void ActivateThisDialog(); - void onSelectMerge(bool); + QGroupBox* GroupConstructors; + QRadioButton* Constructor1; + + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QPushButton* buttonApply; + QPushButton* buttonHelp; + + QGroupBox* GroupName; + QLabel* TextLabelName; + QLineEdit* LineEditName; + + QGroupBox* GroupArgs; + QLabel* TextLabelMeshes; + QPushButton* SelectButton; + QLineEdit* LineEditMeshes; + QLabel* TextLabelUnion; + QComboBox* ComboBoxUnion; + QCheckBox* CheckBoxMerge; + QLabel* TextLabelTol; + SMESHGUI_SpinBox* SpinBoxTol; + + QString myHelpFileName; + +private slots: + void ClickOnOk(); + void ClickOnCancel(); + bool ClickOnApply(); + void ClickOnHelp(); + void SelectionIntoArgument(); + void DeactivateActiveDialog(); + void ActivateThisDialog(); + void onSelectMerge( bool ); }; -#endif // SMESHGUI_BuildCompoundDlg_H +#endif // SMESHGUI_BUILDCOMPOUNDDLG_H diff --git a/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx b/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx index a35b10388..b573cf688 100644 --- a/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx @@ -1,82 +1,74 @@ -// SMESH SMESHGUI : GUI for SMESH component -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// SMESH SMESHGUI : GUI for SMESH component // +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_ClippingDlg.cxx +// Author : Nicolas REJNERI, Open CASCADE S.A.S. // -// -// File : SMESHGUI_ClippingDlg.cxx -// Author : Nicolas REJNERI -// Module : SMESH -// $Header$ +// SMESH includes #include "SMESHGUI_ClippingDlg.h" #include "SMESHGUI.h" #include "SMESHGUI_Utils.h" #include "SMESHGUI_VTKUtils.h" +#include "SMESHGUI_SpinBox.h" -#include "SMESH_Actor.h" -#include "SMESH_ActorUtils.h" +#include +#include -#include "SUIT_Session.h" -#include "SUIT_OverrideCursor.h" -#include "SUIT_MessageBox.h" +// SALOME GUI includes +#include +#include +#include +#include +#include -#include "SALOME_ListIO.hxx" -#include "SALOME_InteractiveObject.hxx" -#include "SALOME_ListIteratorOfListIO.hxx" +#include -#include "LightApp_Application.h" -#include "LightApp_SelectionMgr.h" +#include +#include -#include "SVTK_Selector.h" -#include "SVTK_ViewWindow.h" +#include -// QT Includes -#include -#include -#include -#include -#include -#include +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include -// VTK Includes +// VTK includes #include -#include -#include -#include -#include -#include - +#include #include #include #include -#include -#include #include -// STL includes -#include - -using namespace std; - +#define SPACING 6 +#define MARGIN 11 class OrientedPlane: public vtkPlane { @@ -207,142 +199,112 @@ struct TSetVisiblity { // purpose : // //================================================================================= -SMESHGUI_ClippingDlg::SMESHGUI_ClippingDlg (SMESHGUI* theModule, - const char* name, - bool modal, - WFlags fl): - QDialog(SMESH::GetDesktop(theModule), - name, - modal, - WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose), +SMESHGUI_ClippingDlg::SMESHGUI_ClippingDlg( SMESHGUI* theModule ): + QDialog( SMESH::GetDesktop(theModule) ), mySelector(SMESH::GetViewWindow(theModule)->GetSelector()), mySelectionMgr(SMESH::GetSelectionMgr(theModule)), mySMESHGUI(theModule) { - if (!name) - setName("SMESHGUI_ClippingDlg"); - setCaption(tr("SMESH_CLIPPING_TITLE")); - setSizeGripEnabled(TRUE); - QGridLayout* SMESHGUI_ClippingDlgLayout = new QGridLayout(this); - SMESHGUI_ClippingDlgLayout->setSpacing(6); - SMESHGUI_ClippingDlgLayout->setMargin(11); + setModal( false ); + setAttribute( Qt::WA_DeleteOnClose, true ); + setWindowTitle(tr("SMESH_CLIPPING_TITLE")); + setSizeGripEnabled(true); + + QVBoxLayout* SMESHGUI_ClippingDlgLayout = new QVBoxLayout(this); + SMESHGUI_ClippingDlgLayout->setSpacing(SPACING); + SMESHGUI_ClippingDlgLayout->setMargin(MARGIN); // Controls for selecting, creating, deleting planes - QGroupBox* GroupPlanes = new QGroupBox (this, "GroupPlanes"); - GroupPlanes->setTitle(tr("Clipping planes")); - GroupPlanes->setColumnLayout(0, Qt::Vertical); - GroupPlanes->layout()->setSpacing(0); - GroupPlanes->layout()->setMargin(0); - QGridLayout* GroupPlanesLayout = new QGridLayout (GroupPlanes->layout()); - GroupPlanesLayout->setAlignment(Qt::AlignTop); - GroupPlanesLayout->setSpacing(6); - GroupPlanesLayout->setMargin(11); - - ComboBoxPlanes = new QComboBox(GroupPlanes, "ComboBoxPlanes"); - GroupPlanesLayout->addWidget(ComboBoxPlanes, 0, 0); - - QSpacerItem* spacerGP = new QSpacerItem (20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - GroupPlanesLayout->addItem(spacerGP, 0, 1); - - buttonNew = new QPushButton (GroupPlanes, "buttonNew"); - buttonNew->setText(tr("SMESH_BUT_NEW")); - GroupPlanesLayout->addWidget(buttonNew, 0, 2); - - buttonDelete = new QPushButton (GroupPlanes, "buttonDelete"); - buttonDelete->setText(tr("SMESH_BUT_DELETE")); - GroupPlanesLayout->addWidget(buttonDelete, 0, 3); + QGroupBox* GroupPlanes = new QGroupBox(tr("Clipping planes"), this); + QHBoxLayout* GroupPlanesLayout = new QHBoxLayout(GroupPlanes); + GroupPlanesLayout->setSpacing(SPACING); + GroupPlanesLayout->setMargin(MARGIN); + + ComboBoxPlanes = new QComboBox(GroupPlanes); + + buttonNew = new QPushButton(tr("SMESH_BUT_NEW"), GroupPlanes); + + buttonDelete = new QPushButton(tr("SMESH_BUT_DELETE"), GroupPlanes); + + GroupPlanesLayout->addWidget(ComboBoxPlanes); + GroupPlanesLayout->addStretch(); + GroupPlanesLayout->addWidget(buttonNew); + GroupPlanesLayout->addWidget(buttonDelete); // Controls for defining plane parameters - QGroupBox* GroupParameters = new QGroupBox (this, "GroupParameters"); - GroupParameters->setTitle(tr("SMESH_PARAMETERS")); - GroupParameters->setColumnLayout(0, Qt::Vertical); - GroupParameters->layout()->setSpacing(0); - GroupParameters->layout()->setMargin(0); - QGridLayout* GroupParametersLayout = new QGridLayout (GroupParameters->layout()); - GroupParametersLayout->setAlignment(Qt::AlignTop); - GroupParametersLayout->setSpacing(6); - GroupParametersLayout->setMargin(11); - - TextLabelOrientation = new QLabel(GroupParameters, "TextLabelOrientation"); - TextLabelOrientation->setText(tr("SMESH_ORIENTATION")); - GroupParametersLayout->addWidget(TextLabelOrientation, 0, 0); + QGroupBox* GroupParameters = new QGroupBox(tr("SMESH_PARAMETERS"), this); + QGridLayout* GroupParametersLayout = new QGridLayout(GroupParameters); + GroupParametersLayout->setSpacing(SPACING); + GroupParametersLayout->setMargin(MARGIN); - ComboBoxOrientation = new QComboBox(GroupParameters, "ComboBoxOrientation"); - GroupParametersLayout->addWidget(ComboBoxOrientation, 0, 1); + TextLabelOrientation = new QLabel(tr("SMESH_ORIENTATION"), GroupParameters); - TextLabelDistance = new QLabel(GroupParameters, "TextLabelDistance"); - TextLabelDistance->setText(tr("SMESH_DISTANCE")); - GroupParametersLayout->addWidget(TextLabelDistance, 1, 0); + ComboBoxOrientation = new QComboBox(GroupParameters); - SpinBoxDistance = new SMESHGUI_SpinBox(GroupParameters, "SpinBoxDistance"); - GroupParametersLayout->addWidget(SpinBoxDistance, 1, 1); + TextLabelDistance = new QLabel(tr("SMESH_DISTANCE"), GroupParameters); - TextLabelRot1 = new QLabel(GroupParameters, "TextLabelRot1"); - TextLabelRot1->setText(tr("Rotation around X (Y to Z):")); - GroupParametersLayout->addWidget(TextLabelRot1, 2, 0); + SpinBoxDistance = new SMESHGUI_SpinBox(GroupParameters); - SpinBoxRot1 = new SMESHGUI_SpinBox(GroupParameters, "SpinBoxRot1"); - GroupParametersLayout->addWidget(SpinBoxRot1, 2, 1); + TextLabelRot1 = new QLabel(tr("Rotation around X (Y to Z):"), GroupParameters); - TextLabelRot2 = new QLabel(GroupParameters, "TextLabelRot2"); - TextLabelRot2->setText(tr("Rotation around Y (X to Z):")); - GroupParametersLayout->addWidget(TextLabelRot2, 3, 0); + SpinBoxRot1 = new SMESHGUI_SpinBox(GroupParameters); - SpinBoxRot2 = new SMESHGUI_SpinBox(GroupParameters, "SpinBoxRot2"); - GroupParametersLayout->addWidget(SpinBoxRot2, 3, 1); + TextLabelRot2 = new QLabel(tr("Rotation around Y (X to Z):"), GroupParameters); + + SpinBoxRot2 = new SMESHGUI_SpinBox(GroupParameters); PreviewCheckBox = new QCheckBox(tr("Show preview"), GroupParameters); PreviewCheckBox->setChecked(true); - GroupParametersLayout->addWidget(PreviewCheckBox, 4, 0); AutoApplyCheckBox = new QCheckBox(tr("Auto Apply"), GroupParameters); AutoApplyCheckBox->setChecked(false); - GroupParametersLayout->addWidget(AutoApplyCheckBox, 4, 1); + + GroupParametersLayout->addWidget(TextLabelOrientation, 0, 0); + GroupParametersLayout->addWidget(ComboBoxOrientation, 0, 1); + GroupParametersLayout->addWidget(TextLabelDistance, 1, 0); + GroupParametersLayout->addWidget(SpinBoxDistance, 1, 1); + GroupParametersLayout->addWidget(TextLabelRot1, 2, 0); + GroupParametersLayout->addWidget(SpinBoxRot1, 2, 1); + GroupParametersLayout->addWidget(TextLabelRot2, 3, 0); + GroupParametersLayout->addWidget(SpinBoxRot2, 3, 1); + GroupParametersLayout->addWidget(PreviewCheckBox, 4, 0); + GroupParametersLayout->addWidget(AutoApplyCheckBox, 4, 1); // Controls for "Ok", "Apply" and "Close" button - QGroupBox* GroupButtons = new QGroupBox(this, "GroupButtons"); - GroupButtons->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth())); - GroupButtons->setGeometry(QRect(10, 10, 281, 48)); - GroupButtons->setTitle(tr("" )); - GroupButtons->setColumnLayout(0, Qt::Vertical); - GroupButtons->layout()->setSpacing(0); - GroupButtons->layout()->setMargin(0); - QGridLayout* GroupButtonsLayout = new QGridLayout(GroupButtons->layout()); - GroupButtonsLayout->setAlignment(Qt::AlignTop); - GroupButtonsLayout->setSpacing(6); - GroupButtonsLayout->setMargin(11); - buttonCancel = new QPushButton(GroupButtons, "buttonCancel"); - buttonCancel->setText(tr("SMESH_BUT_CLOSE" )); - buttonCancel->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonCancel, 0, 3); - buttonApply = new QPushButton(GroupButtons, "buttonApply"); - buttonApply->setText(tr("SMESH_BUT_APPLY" )); - buttonApply->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonApply, 0, 1); - QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - GroupButtonsLayout->addItem(spacer_9, 0, 2); - buttonOk = new QPushButton(GroupButtons, "buttonOk"); - buttonOk->setText(tr("SMESH_BUT_OK" )); - buttonOk->setAutoDefault(TRUE); - buttonOk->setDefault(TRUE); - GroupButtonsLayout->addWidget(buttonOk, 0, 0); - buttonHelp = new QPushButton(GroupButtons, "buttonHelp"); - buttonHelp->setText(tr("SMESH_BUT_HELP" )); - buttonHelp->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonHelp, 0, 4); - - SMESHGUI_ClippingDlgLayout->addWidget(GroupPlanes, 0, 0); - SMESHGUI_ClippingDlgLayout->addWidget(GroupParameters, 1, 0); - SMESHGUI_ClippingDlgLayout->addWidget(GroupButtons, 2, 0); + QGroupBox* GroupButtons = new QGroupBox(this); + QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons); + GroupButtonsLayout->setSpacing(SPACING); + GroupButtonsLayout->setMargin(MARGIN); + + buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk->setAutoDefault(true); + buttonOk->setDefault(true); + buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); + buttonApply->setAutoDefault(true); + buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons); + buttonCancel->setAutoDefault(true); + buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons); + buttonHelp->setAutoDefault(true); + GroupButtonsLayout->addWidget(buttonOk); + GroupButtonsLayout->addSpacing(10); + GroupButtonsLayout->addWidget(buttonApply); + GroupButtonsLayout->addSpacing(10); + GroupButtonsLayout->addStretch(); + GroupButtonsLayout->addWidget(buttonCancel); + GroupButtonsLayout->addWidget(buttonHelp); + + SMESHGUI_ClippingDlgLayout->addWidget(GroupPlanes); + SMESHGUI_ClippingDlgLayout->addWidget(GroupParameters); + SMESHGUI_ClippingDlgLayout->addWidget(GroupButtons); // Initial state SpinBoxDistance->RangeStepAndValidator(0.0, 1.0, 0.01, 3); SpinBoxRot1->RangeStepAndValidator(-180.0, 180.0, 1, 3); SpinBoxRot2->RangeStepAndValidator(-180.0, 180.0, 1, 3); - ComboBoxOrientation->insertItem(tr("|| X-Y")); - ComboBoxOrientation->insertItem(tr("|| Y-Z")); - ComboBoxOrientation->insertItem(tr("|| Z-X")); + ComboBoxOrientation->addItem(tr("|| X-Y")); + ComboBoxOrientation->addItem(tr("|| Y-Z")); + ComboBoxOrientation->addItem(tr("|| Z-X")); SpinBoxDistance->SetValue(0.5); @@ -385,6 +347,26 @@ SMESHGUI_ClippingDlg::~SMESHGUI_ClippingDlg() SMESH::RenderViewWindow(SMESH::GetViewWindow(mySMESHGUI)); } +double SMESHGUI_ClippingDlg::getDistance() const +{ + return SpinBoxDistance->GetValue(); +} + +void SMESHGUI_ClippingDlg::setDistance( const double theDistance ) +{ + SpinBoxDistance->SetValue( theDistance ); +} + +double SMESHGUI_ClippingDlg::getRotation1() const +{ + return SpinBoxRot1->GetValue(); +} + +double SMESHGUI_ClippingDlg::getRotation2() const +{ + return SpinBoxRot2->GetValue(); +} + //======================================================================= // function : ClickOnApply() // purpose : @@ -404,7 +386,7 @@ void SMESHGUI_ClippingDlg::ClickOnApply() myActor->RemoveAllClippingPlanes(); SMESH::TPlanes::iterator anIter = myPlanes.begin(); - for (; anIter != myPlanes.end(); anIter++) { + for ( ; anIter != myPlanes.end(); anIter++) { OrientedPlane* anOrientedPlane = OrientedPlane::New(aViewWindow); anOrientedPlane->ShallowCopy(anIter->GetPointer()); myActor->AddClippingPlane(anOrientedPlane); @@ -450,10 +432,11 @@ void SMESHGUI_ClippingDlg::ClickOnHelp() #else platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName)); } } @@ -473,7 +456,7 @@ void SMESHGUI_ClippingDlg::onSelectionChanged() myPlanes.clear(); vtkIdType anId = 0, anEnd = myActor->GetNumberOfClippingPlanes(); - for (; anId < anEnd; anId++) { + for ( ; anId < anEnd; anId++) { if (vtkImplicitFunction* aFunction = myActor->GetClippingPlane(anId)) { if(OrientedPlane* aPlane = OrientedPlane::SafeDownCast(aFunction)){ OrientedPlane* anOrientedPlane = OrientedPlane::New(aViewWindow); @@ -517,15 +500,15 @@ void SMESHGUI_ClippingDlg::onSelectPlane (int theIndex) setRotation(aRot[0], aRot[1]); switch (anOrientation) { case SMESH::XY: - ComboBoxOrientation->setCurrentItem(0); + ComboBoxOrientation->setCurrentIndex(0); onSelectOrientation(0); break; case SMESH::YZ: - ComboBoxOrientation->setCurrentItem(1); + ComboBoxOrientation->setCurrentIndex(1); onSelectOrientation(1); break; case SMESH::ZX: - ComboBoxOrientation->setCurrentItem(2); + ComboBoxOrientation->setCurrentIndex(2); onSelectOrientation(2); break; } @@ -563,7 +546,7 @@ void SMESHGUI_ClippingDlg::ClickOnDelete() if (!myActor || myPlanes.empty()) return; - int aPlaneIndex = ComboBoxPlanes->currentItem(); + int aPlaneIndex = ComboBoxPlanes->currentIndex(); SMESH::TPlanes::iterator anIter = myPlanes.begin() + aPlaneIndex; anIter->GetPointer()->myActor->SetVisibility(false); @@ -614,17 +597,17 @@ void SMESHGUI_ClippingDlg::Sinchronize() QString aName; for(int i = 1; i<=aNbPlanes; i++) { aName = QString(tr("Plane# %1")).arg(i); - ComboBoxPlanes->insertItem(aName); + ComboBoxPlanes->addItem(aName); } int aPos = ComboBoxPlanes->count() - 1; - ComboBoxPlanes->setCurrentItem(aPos); + ComboBoxPlanes->setCurrentIndex(aPos); bool anIsControlsEnable = (aPos >= 0); if (anIsControlsEnable) { onSelectPlane(aPos); } else { - ComboBoxPlanes->insertItem(tr("No planes")); + ComboBoxPlanes->addItem(tr("No planes")); SpinBoxRot1->SetValue(0.0); SpinBoxRot2->SetValue(0.0); SpinBoxDistance->SetValue(0.5); @@ -659,7 +642,7 @@ void SMESHGUI_ClippingDlg::SetCurrentPlaneParam() if (myPlanes.empty() || myIsSelectPlane) return; - int aCurPlaneIndex = ComboBoxPlanes->currentItem(); + int aCurPlaneIndex = ComboBoxPlanes->currentIndex(); OrientedPlane* aPlane = myPlanes[aCurPlaneIndex].GetPointer(); @@ -678,7 +661,7 @@ void SMESHGUI_ClippingDlg::SetCurrentPlaneParam() aV[0] = aRot[0] > 0? aV[0]: -aV[0]; aV[1] = aRot[1] > 0? aV[1]: -aV[1]; - switch (ComboBoxOrientation->currentItem()) { + switch (ComboBoxOrientation->currentIndex()) { case 0: anOrientation = SMESH::XY; @@ -787,9 +770,8 @@ void SMESHGUI_ClippingDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) - { - e->accept(); - ClickOnHelp(); - } + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + ClickOnHelp(); + } } diff --git a/src/SMESHGUI/SMESHGUI_ClippingDlg.h b/src/SMESHGUI/SMESHGUI_ClippingDlg.h index a0f221bda..a8692b371 100644 --- a/src/SMESHGUI/SMESHGUI_ClippingDlg.h +++ b/src/SMESHGUI/SMESHGUI_ClippingDlg.h @@ -1,68 +1,59 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_ClippingDlg.h +// Author : Nicolas REJNERI, Open CASCADE S.A.S. // -// -// File : SMESHGUI_TransparencyDlg.h -// Author : Nicolas REJNERI -// Module : SMESH -// $Header$ -#ifndef DIALOGBOX_CLIPPING_H -#define DIALOGBOX_CLIPPING_H +#ifndef SMESHGUI_CLIPPINGDLG_H +#define SMESHGUI_CLIPPINGDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include +// Qt includes +#include +// VTK includes #include -#include +// STL includes #include -// QT Includes -#include -#include - class QLabel; class QPushButton; -class QTable; class QCheckBox; class QComboBox; - class LightApp_SelectionMgr; class SVTK_Selector; - class SMESHGUI; class SMESH_Actor; - class OrientedPlane; +class SMESHGUI_SpinBox; - -namespace SMESH { - +namespace SMESH +{ typedef vtkSmartPointer TVTKPlane; typedef std::vector TPlanes; - enum Orientation {XY, YZ, ZX}; - + enum Orientation { XY, YZ, ZX }; }; @@ -72,67 +63,62 @@ namespace SMESH { //================================================================================= class SMESHGUI_EXPORT SMESHGUI_ClippingDlg : public QDialog { - Q_OBJECT + Q_OBJECT public: - SMESHGUI_ClippingDlg (SMESHGUI* theModule, - const char* name = 0, - bool modal = false, - WFlags fl = 0); - - float getDistance() { return (float)SpinBoxDistance->GetValue(); } - void setDistance (const float theDistance) { SpinBoxDistance->SetValue(theDistance); } - double getRotation1() { return SpinBoxRot1->GetValue(); } - double getRotation2() { return SpinBoxRot2->GetValue(); } - void setRotation (const double theRot1, const double theRot2); - void Sinchronize(); - - void keyPressEvent(QKeyEvent*); - - ~SMESHGUI_ClippingDlg(); + SMESHGUI_ClippingDlg( SMESHGUI* ); + ~SMESHGUI_ClippingDlg(); + + double getDistance() const; + void setDistance( const double ); + double getRotation1() const; + double getRotation2() const; + void setRotation( const double, const double ); + void Sinchronize(); + +protected: + void keyPressEvent( QKeyEvent* ); private: - - LightApp_SelectionMgr* mySelectionMgr; - SVTK_Selector* mySelector; - SMESHGUI* mySMESHGUI; - SMESH_Actor* myActor; - SMESH::TPlanes myPlanes; - - QComboBox* ComboBoxPlanes; - QPushButton* buttonNew; - QPushButton* buttonDelete; - QLabel* TextLabelOrientation; - QComboBox* ComboBoxOrientation; - QLabel* TextLabelDistance; - SMESHGUI_SpinBox* SpinBoxDistance; - QLabel* TextLabelRot1; - SMESHGUI_SpinBox* SpinBoxRot1; - QLabel* TextLabelRot2; - SMESHGUI_SpinBox* SpinBoxRot2; - QCheckBox* PreviewCheckBox; - QCheckBox* AutoApplyCheckBox; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QPushButton* buttonHelp; - - bool myIsSelectPlane; - QString myHelpFileName; + LightApp_SelectionMgr* mySelectionMgr; + SVTK_Selector* mySelector; + SMESHGUI* mySMESHGUI; + SMESH_Actor* myActor; + SMESH::TPlanes myPlanes; + + QComboBox* ComboBoxPlanes; + QPushButton* buttonNew; + QPushButton* buttonDelete; + QLabel* TextLabelOrientation; + QComboBox* ComboBoxOrientation; + QLabel* TextLabelDistance; + SMESHGUI_SpinBox* SpinBoxDistance; + QLabel* TextLabelRot1; + SMESHGUI_SpinBox* SpinBoxRot1; + QLabel* TextLabelRot2; + SMESHGUI_SpinBox* SpinBoxRot2; + QCheckBox* PreviewCheckBox; + QCheckBox* AutoApplyCheckBox; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QPushButton* buttonApply; + QPushButton* buttonHelp; + + bool myIsSelectPlane; + QString myHelpFileName; public slots: - - void onSelectPlane (int theIndex); - void ClickOnNew(); - void ClickOnDelete(); - void onSelectOrientation (int theItem); - void SetCurrentPlaneParam(); - void onSelectionChanged(); - void OnPreviewToggle (bool theIsToggled); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void ClickOnHelp(); + void onSelectPlane( int ); + void ClickOnNew(); + void ClickOnDelete(); + void onSelectOrientation( int ); + void SetCurrentPlaneParam(); + void onSelectionChanged(); + void OnPreviewToggle( bool ); + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void ClickOnHelp(); }; -#endif // DIALOGBOX_TRANSPARENCYDLG_H +#endif // SMESHGUI_CLIPPINGDLG_H diff --git a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx index 51d62037b..05dbee717 100644 --- a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx @@ -1,61 +1,58 @@ -// SMESH SMESHGUI : GUI for SMESH component +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_ComputeDlg.cxx +// Author : Edward AGAPOV, Open CASCADE S.A.S. // -// -// File : SMESHGUI_ComputeDlg.cxx -// Author : Edward AGAPOV -// Module : SMESH +// SMESH includes #include "SMESHGUI_ComputeDlg.h" #include "SMESHGUI.h" #include "SMESHGUI_GEOMGenUtils.h" #include "SMESHGUI_MeshUtils.h" -#include "SMESHGUI_Utils.h" #include "SMESHGUI_VTKUtils.h" #include "SMESHGUI_HypothesesUtils.h" -#include "SMDS_SetIterator.hxx" +#include #include -#include "GEOMBase.h" -#include "GEOM_Actor.h" - -#include "LightApp_SelectionMgr.h" -#include "LightApp_UpdateFlags.h" -#include "SALOMEDSClient_SObject.hxx" -#include "SALOME_ListIO.hxx" -#include "SVTK_ViewWindow.h" -#include "SVTK_ViewModel.h" -#include "SalomeApp_Tools.h" -#include "SalomeApp_Application.h" -#include "SUIT_ResourceMgr.h" -#include "SUIT_OverrideCursor.h" -#include "SUIT_MessageBox.h" -#include "SUIT_Desktop.h" -#include "SUIT_Study.h" -#include "OB_Browser.h" - -// OCCT Includes +// SALOME GEOM includes +#include +#include + +// SALOME GUI includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// SALOME KERNEL includes +#include + +// OCCT includes #include #include #include @@ -70,49 +67,51 @@ #include -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// VTK includes #include -// IDL Headers +// IDL includes #include #include CORBA_SERVER_HEADER(SMESH_Gen) -#include CORBA_SERVER_HEADER(SMESH_Mesh) +// STL includes #include #include - -#define SPACING 5 -#define MARGIN 10 +#define SPACING 6 +#define MARGIN 11 #define COLONIZE(str) (QString(str).contains(":") > 0 ? QString(str) : QString(str) + " :" ) -#define _SEPARATOR(father) \ -{\ - /*new QLabel(father); new QLabel(father); new QLabel(father)*/;\ - (new QFrame(father))->setFrameStyle(QFrame::HLine | QFrame::Sunken);\ - (new QFrame(father))->setFrameStyle(QFrame::HLine | QFrame::Sunken);\ - (new QFrame(father))->setFrameStyle(QFrame::HLine | QFrame::Sunken);\ - (new QFrame(father))->setFrameStyle(QFrame::HLine | QFrame::Sunken);\ +static void addSeparator( QWidget* parent ) +{ + QGridLayout* l = qobject_cast( parent->layout() ); + int row = l->rowCount(); + int cols = l->columnCount(); + for ( int i = 0; i < cols; i++ ) { + QFrame* hline = new QFrame( parent ); + hline->setFrameStyle( QFrame::HLine | QFrame::Sunken ); + l->addWidget( hline, row, i ); + } } enum TCol { COL_ALGO = 0, COL_SHAPE, COL_ERROR, COL_SHAPEID, COL_PUBLISHED, NB_COLUMNS }; -using namespace SMESH; +//using namespace SMESH; -namespace SMESH { - +namespace SMESH +{ //============================================================================= /*! * \brief Allocate some memory at construction and release it at destruction. @@ -286,7 +285,7 @@ namespace SMESH { Standard_Boolean alreadymesh = Standard_True; TopExp_Explorer ex(shape, TopAbs_FACE); if ( ex.More() ) - for (; ex.More(); ex.Next()) { + for ( ; ex.More(); ex.Next()) { const TopoDS_Face& aFace = TopoDS::Face(ex.Current()); Handle(Poly_Triangulation) aPoly = BRep_Tool::Triangulation(aFace,aLoc); if(aPoly.IsNull()) { alreadymesh = Standard_False; break; } @@ -303,7 +302,7 @@ namespace SMESH { BRepBndLib::Add(shape, B); Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax; B.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax); - double deflection = Max( aXmax-aXmin , Max ( aYmax-aYmin , aZmax-aZmin)) * 0.01 *4; + double deflection = Max( aXmax-aXmin, Max ( aYmax-aYmin, aZmax-aZmin)) * 0.01 *4; BRepMesh_IncrementalMesh MESH(shape,deflection); } // ----------------------------------------------------------------------- @@ -416,7 +415,7 @@ namespace SMESH { { QString text; if ( _PTR(SObject) aSO = getSubShapeSO( subShapeID, aMainShape )) - text = aSO->GetName(); + text = aSO->GetName().c_str(); else { text = QString("#%1").arg( subShapeID ); QString typeName = shapeTypeName( getSubShape( subShapeID, aMainShape )); @@ -429,21 +428,20 @@ namespace SMESH { /*! * \brief Return a list of selected rows */ - bool getSelectedRows(QTable* table, list< int > & rows) + bool getSelectedRows(QTableWidget* table, QList& rows) { rows.clear(); - int nbSel = table->numSelections(); - for ( int i = 0; i < nbSel; ++i ) + QList selRanges = table->selectedRanges(); + QTableWidgetSelectionRange range; + foreach( range, selRanges ) { - QTableSelection selected = table->selection(i); - if ( !selected.isActive() ) continue; - for ( int row = selected.topRow(); row <= selected.bottomRow(); ++row ) - rows.push_back( row ); + for ( int row = range.topRow(); row <= range.bottomRow(); ++row ) + rows.append( row ); } - if (rows.empty() && table->currentRow() > -1 ) - rows.push_back( table->currentRow() ); + if ( rows.isEmpty() && table->currentRow() > -1 ) + rows.append( table->currentRow() ); - return !rows.empty(); + return !rows.isEmpty(); } } // namespace SMESH @@ -456,119 +454,255 @@ namespace SMESH { // ========================================================================================= SMESHGUI_MeshInfosBox::SMESHGUI_MeshInfosBox(const bool full, QWidget* theParent) - :QGroupBox( 4, Qt::Horizontal, tr("SMESH_MESHINFO_TITLE"), theParent ), myFull( full ) + : QGroupBox( tr("SMESH_MESHINFO_TITLE"), theParent ), myFull( full ) { - // title - QLabel* lab1 = new QLabel(this); - QLabel* lab2 = new QLabel(tr("SMESH_MESHINFO_ORDER0"), this ); - QLabel* lab3 = new QLabel(tr("SMESH_MESHINFO_ORDER1"), this ); - QLabel* lab4 = new QLabel(tr("SMESH_MESHINFO_ORDER2"), this ); + QGridLayout* l = new QGridLayout(this); + l->setMargin( 0 ); + l->setSpacing( 0 ); + + QFont italic = font(); italic.setItalic(true); + QFont bold = font(); bold.setBold(true); - QFont italic = lab1->font(); italic.setItalic(true); - QFont bold = lab1->font(); bold.setBold(true); + QLabel* lab; + int row = 0; - lab1->setMinimumWidth(100); lab1->setFont( italic ); - lab2->setMinimumWidth(100); lab2->setFont( italic ); - lab3->setMinimumWidth(100); lab3->setFont( italic ); - lab4->setMinimumWidth(100); lab4->setFont( italic ); + // title + lab = new QLabel( this ); + lab->setMinimumWidth(100); lab->setFont( italic ); + l->addWidget( lab, row, 0 ); + // -- + lab = new QLabel(tr("SMESH_MESHINFO_ORDER0"), this ); + lab->setMinimumWidth(100); lab->setFont( italic ); + l->addWidget( lab, row, 1 ); + // -- + lab = new QLabel(tr("SMESH_MESHINFO_ORDER1"), this ); + lab->setMinimumWidth(100); lab->setFont( italic ); + l->addWidget( lab, row, 2 ); + // -- + lab = new QLabel(tr("SMESH_MESHINFO_ORDER2"), this ); + lab->setMinimumWidth(100); lab->setFont( italic ); + l->addWidget( lab, row, 3 ); if ( myFull ) { // nodes - (new QLabel(COLONIZE(tr("SMESH_MESHINFO_NODES")), this ))->setFont( bold ); + row = l->rowCount(); // retrieve current row count + // -- + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NODES")), this ); + lab->setFont( bold ); + l->addWidget( lab, row, 0 ); + // -- myNbNode = new QLabel( this ); - new QLabel(this); - new QLabel(this); + l->addWidget( myNbNode, row, 1 ); - _SEPARATOR(this); + addSeparator(this); // add separator // edges - (new QLabel(COLONIZE(tr("SMESH_MESHINFO_EDGES")), this ))->setFont( bold ); + row = l->rowCount(); // retrieve current row count + // -- + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_EDGES")), this ); + lab->setFont( bold ); + l->addWidget( lab, row, 0 ); + // -- myNbEdge = new QLabel( this ); + l->addWidget( myNbEdge, row, 1 ); + // -- myNbLinEdge = new QLabel( this ); + l->addWidget( myNbLinEdge, row, 2 ); + // -- myNbQuadEdge = new QLabel( this ); + l->addWidget( myNbQuadEdge, row, 3 ); - _SEPARATOR(this); + addSeparator(this); // add separator // faces - (new QLabel(COLONIZE(tr("SMESH_MESHINFO_FACES")), this))->setFont( bold ); + row = l->rowCount(); // retrieve current row count + // -- + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_FACES")), this); + lab->setFont( bold ); + l->addWidget( lab, row, 0 ); + // -- myNbFace = new QLabel( this ); + l->addWidget( myNbFace, row, 1 ); + // -- myNbLinFace = new QLabel( this ); + l->addWidget( myNbLinFace, row, 2 ); + // -- myNbQuadFace = new QLabel( this ); - // triangles - new QLabel(COLONIZE(tr("SMESH_MESHINFO_TRIANGLES")), this ); + l->addWidget( myNbQuadFace, row, 3 ); + // -- + row++; // increment row count + // ... triangles + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TRIANGLES")), this ); + l->addWidget( lab, row, 0 ); + // -- myNbTrai = new QLabel( this ); + l->addWidget( myNbTrai, row, 1 ); + // -- myNbLinTrai = new QLabel( this ); + l->addWidget( myNbLinTrai, row, 2 ); + // -- myNbQuadTrai = new QLabel( this ); - // quadrangles - new QLabel(COLONIZE(tr("SMESH_MESHINFO_QUADRANGLES")), this ); + l->addWidget( myNbQuadTrai, row, 3 ); + // -- + row++; // increment row count + // ... quadrangles + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_QUADRANGLES")), this ); + l->addWidget( lab, row, 0 ); + // -- myNbQuad = new QLabel( this ); + l->addWidget( myNbQuad, row, 1 ); + // -- myNbLinQuad = new QLabel( this ); + l->addWidget( myNbLinQuad, row, 2 ); + // -- myNbQuadQuad = new QLabel( this ); - // poligones - new QLabel(COLONIZE(tr("SMESH_MESHINFO_POLYGONES")), this ); + l->addWidget( myNbQuadQuad, row, 3 ); + // -- + row++; // increment row count + // ... poligones + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_POLYGONES")), this ); + l->addWidget( lab, row, 0 ); myNbPolyg = new QLabel( this ); - new QLabel("",this ); - new QLabel("", this ); + l->addWidget( myNbPolyg, row, 1 ); - _SEPARATOR(this); + addSeparator(this); // add separator // volumes - (new QLabel(COLONIZE(tr("SMESH_MESHINFO_VOLUMES")), this))->setFont( bold ); + row = l->rowCount(); // retrieve current row count + // -- + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_VOLUMES")), this); + lab->setFont( bold ); + l->addWidget( lab, row, 0 ); + // -- myNbVolum = new QLabel( this ); + l->addWidget( myNbVolum, row, 1 ); + // -- myNbLinVolum = new QLabel( this ); + l->addWidget( myNbLinVolum, row, 2 ); + // -- myNbQuadVolum = new QLabel( this ); - // tetras - new QLabel(COLONIZE(tr("SMESH_MESHINFO_TETRAS")), this ); + l->addWidget( myNbQuadVolum, row, 3 ); + // -- + row++; // increment row count + // ... tetras + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TETRAS")), this ); + l->addWidget( lab, row, 0 ); + // -- myNbTetra = new QLabel( this ); + l->addWidget( myNbTetra, row, 1 ); + // -- myNbLinTetra = new QLabel( this ); + l->addWidget( myNbLinTetra, row, 2 ); + // -- myNbQuadTetra = new QLabel( this ); - // hexas - new QLabel(COLONIZE(tr("SMESH_MESHINFO_HEXAS")), this ); + l->addWidget( myNbQuadTetra, row, 3 ); + // -- + row++; // increment row count + // ... hexas + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_HEXAS")), this ); + l->addWidget( lab, row, 0 ); + // -- myNbHexa = new QLabel( this ); + l->addWidget( myNbHexa, row, 1 ); + // -- myNbLinHexa = new QLabel( this ); + l->addWidget( myNbLinHexa, row, 2 ); + // -- myNbQuadHexa = new QLabel( this ); - // pyras - new QLabel(COLONIZE(tr("SMESH_MESHINFO_PYRAS")), this ); + l->addWidget( myNbQuadHexa, row, 3 ); + // -- + row++; // increment row count + // ... pyras + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_PYRAS")), this ); + l->addWidget( lab, row, 0 ); + // -- myNbPyra = new QLabel( this ); + l->addWidget( myNbPyra, row, 1 ); + // -- myNbLinPyra = new QLabel( this ); + l->addWidget( myNbLinPyra, row, 2 ); + // -- myNbQuadPyra = new QLabel( this ); - // prisms - new QLabel(COLONIZE(tr("SMESH_MESHINFO_PRISMS")), this ); + l->addWidget( myNbQuadPyra, row, 3 ); + // -- + row++; // increment row count + // ... prisms + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_PRISMS")), this ); + l->addWidget( lab, row, 0 ); + // -- myNbPrism = new QLabel( this ); + l->addWidget( myNbPrism, row, 1 ); + // -- myNbLinPrism = new QLabel( this ); + l->addWidget( myNbLinPrism, row, 2 ); + // -- myNbQuadPrism = new QLabel( this ); - // polyedres - new QLabel(COLONIZE(tr("SMESH_MESHINFO_POLYEDRES")), this ); + l->addWidget( myNbQuadPrism, row, 3 ); + // -- + row++; // increment row count + // ... polyedres + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_POLYEDRES")), this ); + l->addWidget( lab, row, 0 ); + // -- myNbPolyh = new QLabel( this ); - new QLabel("", this ); - new QLabel("", this ); + l->addWidget( myNbPolyh, row, 1 ); } else { // nodes - new QLabel(COLONIZE(tr("SMESH_MESHINFO_NODES")), this ); + row = l->rowCount(); // retrieve current row count + // -- + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NODES")), this ); + l->addWidget( lab, row, 0 ); + // -- myNbNode = new QLabel( this ); - new QLabel(this); - new QLabel(this); + l->addWidget( myNbNode, row, 1 ); // edges - new QLabel(COLONIZE(tr("SMESH_MESHINFO_EDGES")), this ); + row = l->rowCount(); // retrieve current row count + // -- + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_EDGES")), this ); + l->addWidget( lab, row, 0 ); + // -- myNbEdge = new QLabel( this ); + l->addWidget( myNbEdge, row, 1 ); + // -- myNbLinEdge = new QLabel( this ); + l->addWidget( myNbLinEdge, row, 2 ); + // -- myNbQuadEdge = new QLabel( this ); + l->addWidget( myNbQuadEdge, row, 3 ); // faces - new QLabel(COLONIZE(tr("SMESH_MESHINFO_FACES")), this); + row = l->rowCount(); // retrieve current row count + // -- + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_FACES")), this); + l->addWidget( lab, row, 0 ); + // -- myNbFace = new QLabel( this ); + l->addWidget( myNbFace, row, 1 ); + // -- myNbLinFace = new QLabel( this ); + l->addWidget( myNbLinFace, row, 2 ); + // -- myNbQuadFace = new QLabel( this ); + l->addWidget( myNbQuadFace, row, 3 ); // volumes - new QLabel(COLONIZE(tr("SMESH_MESHINFO_VOLUMES")), this); + row = l->rowCount(); // retrieve current row count + // -- + lab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_VOLUMES")), this); + l->addWidget( lab, row, 0 ); + // -- myNbVolum = new QLabel( this ); + l->addWidget( myNbVolum, row, 1 ); + // -- myNbLinVolum = new QLabel( this ); + l->addWidget( myNbLinVolum, row, 2 ); + // -- myNbQuadVolum = new QLabel( this ); + l->addWidget( myNbQuadVolum, row, 3 ); } } @@ -595,7 +729,7 @@ void SMESHGUI_MeshInfosBox::SetInfoByMesh(SMESH::SMESH_Mesh_var mesh) // faces nbTot = mesh->NbFaces(), nbLin = mesh->NbFacesOfOrder(lin); myNbFace ->setText( QString("%1").arg( nbTot )); - myNbLinFace ->setText( QString("%1").arg( nbLin )); + myNbLinFace ->setText( QString("%1").arg( nbLin )); myNbQuadFace ->setText( QString("%1").arg( nbTot - nbLin )); // volumes @@ -652,7 +786,9 @@ void SMESHGUI_MeshInfosBox::SetInfoByMesh(SMESH::SMESH_Mesh_var mesh) SMESHGUI_ComputeDlg::SMESHGUI_ComputeDlg(): SMESHGUI_Dialog( 0, false, true, OK/* | Help*/ ) { - QVBoxLayout* aDlgLay = new QVBoxLayout (mainFrame(), 0, SPACING); + QVBoxLayout* aDlgLay = new QVBoxLayout (mainFrame()); + aDlgLay->setMargin( 0 ); + aDlgLay->setSpacing( SPACING ); QFrame* aMainFrame = createMainFrame (mainFrame()); @@ -666,8 +802,6 @@ SMESHGUI_ComputeDlg::SMESHGUI_ComputeDlg(): SMESHGUI_Dialog( 0, false, true, OK/ // purpose : Create frame containing dialog's fields //======================================================================= -#define CASE2HEADER(enum) case enum: header = QObject::tr( #enum "_HEADER" ); break; - QFrame* SMESHGUI_ComputeDlg::createMainFrame (QWidget* theParent) { QFrame* aFrame = new QFrame(theParent); @@ -677,16 +811,23 @@ QFrame* SMESHGUI_ComputeDlg::createMainFrame (QWidget* theParent) // constructor - QButtonGroup* aPixGrp = new QButtonGroup(1, Qt::Vertical, tr("CONSTRUCTOR"), aFrame); - aPixGrp->setExclusive(TRUE); + QGroupBox* aPixGrp = new QGroupBox(tr("CONSTRUCTOR"), aFrame); + QHBoxLayout* aPixGrpLayout = new QHBoxLayout(aPixGrp); + aPixGrpLayout->setMargin(MARGIN); aPixGrpLayout->setSpacing(SPACING); + QRadioButton* aRBut = new QRadioButton(aPixGrp); - aRBut->setPixmap(iconCompute); - aRBut->setChecked(TRUE); + aRBut->setIcon(iconCompute); + aRBut->setChecked(true); + aPixGrpLayout->addWidget(aRBut); + aPixGrpLayout->addStretch(); // Mesh name - QHGroupBox* nameBox = new QHGroupBox(tr("SMESH_MESHINFO_NAME"), aFrame ); + QGroupBox* nameBox = new QGroupBox(tr("SMESH_MESHINFO_NAME"), aFrame ); + QHBoxLayout* nameBoxLayout = new QHBoxLayout(nameBox); + nameBoxLayout->setMargin(MARGIN); nameBoxLayout->setSpacing(SPACING); myMeshName = new QLabel(nameBox); + nameBoxLayout->addWidget(myMeshName); // Mesh Info @@ -695,54 +836,60 @@ QFrame* SMESHGUI_ComputeDlg::createMainFrame (QWidget* theParent) // Computation errors - myCompErrorGroup = new QGroupBox(tr("ERRORS"), aFrame, "myCompErrorGroup"); - myTable = new QTable( 1, NB_COLUMNS, myCompErrorGroup, "myTable"); - myShowBtn = new QPushButton(tr("SHOW_SHAPE"), myCompErrorGroup, "myShowBtn"); - myPublishBtn = new QPushButton(tr("PUBLISH_SHAPE"), myCompErrorGroup, "myPublishBtn"); + myCompErrorGroup = new QGroupBox(tr("ERRORS"), aFrame); + myTable = new QTableWidget( 1, NB_COLUMNS, myCompErrorGroup); + myShowBtn = new QPushButton(tr("SHOW_SHAPE"), myCompErrorGroup); + myPublishBtn = new QPushButton(tr("PUBLISH_SHAPE"), myCompErrorGroup); - myTable->setReadOnly( TRUE ); + //myTable->setReadOnly( true ); // VSR: check + myTable->setEditTriggers( QAbstractItemView::NoEditTriggers ); myTable->hideColumn( COL_PUBLISHED ); myTable->hideColumn( COL_SHAPEID ); - myTable->setColumnStretchable( COL_ERROR, 1 ); - for ( int col = 0; col < NB_COLUMNS; ++col ) { - QString header; - switch ( col ) { - CASE2HEADER( COL_ALGO ); - CASE2HEADER( COL_SHAPE ); - CASE2HEADER( COL_ERROR ); - CASE2HEADER( COL_SHAPEID ); - CASE2HEADER( COL_PUBLISHED); - } - myTable->horizontalHeader()->setLabel( col, header ); - } + myTable->horizontalHeader()->setResizeMode( COL_ERROR, QHeaderView::Interactive ); + + QStringList headers; + headers << tr( "COL_ALGO_HEADER" ); + headers << tr( "COL_SHAPE_HEADER" ); + headers << tr( "COL_ERROR_HEADER" ); + headers << tr( "COL_SHAPEID_HEADER" ); + headers << tr( "COL_PUBLISHED_HEADER" ); + + myTable->setHorizontalHeaderLabels( headers ); + // layouting - myCompErrorGroup->setColumnLayout(0, Qt::Vertical); - myCompErrorGroup->layout()->setSpacing(0); - myCompErrorGroup->layout()->setMargin(0); - QGridLayout* grpLayout = new QGridLayout(myCompErrorGroup->layout()); - grpLayout->setAlignment(Qt::AlignTop); + QGridLayout* grpLayout = new QGridLayout(myCompErrorGroup); grpLayout->setSpacing(SPACING); grpLayout->setMargin(MARGIN); - grpLayout->addMultiCellWidget( myTable, 0, 2, 0, 0 ); - grpLayout->addWidget ( myShowBtn, 0, 1 ); - grpLayout->addWidget ( myPublishBtn, 1, 1 ); + grpLayout->addWidget( myTable, 0, 0, 3, 1 ); + grpLayout->addWidget( myShowBtn, 0, 1 ); + grpLayout->addWidget( myPublishBtn, 1, 1 ); grpLayout->setRowStretch( 2, 1 ); // Hypothesis definition errors - myHypErrorGroup = new QGroupBox(1,Qt::Vertical, tr("SMESH_WRN_MISSING_PARAMETERS"),aFrame); + myHypErrorGroup = new QGroupBox(tr("SMESH_WRN_MISSING_PARAMETERS"), aFrame); + QHBoxLayout* myHypErrorGroupLayout = new QHBoxLayout(myHypErrorGroup); + myHypErrorGroupLayout->setMargin(MARGIN); + myHypErrorGroupLayout->setSpacing(SPACING); myHypErrorLabel = new QLabel(myHypErrorGroup); + myHypErrorGroupLayout->addWidget(myHypErrorLabel); // Memory Lack Label - myMemoryLackGroup = new QVGroupBox(tr("ERRORS"), aFrame, "memlackGrBox"); + myMemoryLackGroup = new QGroupBox(tr("ERRORS"), aFrame); + QVBoxLayout* myMemoryLackGroupLayout = new QVBoxLayout(myMemoryLackGroup); + myMemoryLackGroupLayout->setMargin(MARGIN); + myMemoryLackGroupLayout->setSpacing(SPACING); QLabel* memLackLabel = new QLabel(tr("MEMORY_LACK"), myMemoryLackGroup); QFont bold = memLackLabel->font(); bold.setBold(true); memLackLabel->setFont( bold ); memLackLabel->setMinimumWidth(300); + myMemoryLackGroupLayout->addWidget(memLackLabel); // add all widgets to aFrame QVBoxLayout* aLay = new QVBoxLayout(aFrame); + aLay->setMargin( 0 ); + aLay->setSpacing( 0 ); aLay->addWidget( aPixGrp ); aLay->addWidget( nameBox ); aLay->addWidget( myBriefInfo ); @@ -766,15 +913,15 @@ QFrame* SMESHGUI_ComputeDlg::createMainFrame (QWidget* theParent) SMESHGUI_ComputeOp::SMESHGUI_ComputeOp() { myDlg = new SMESHGUI_ComputeDlg; - myTShapeDisplayer = new TShapeDisplayer(); + myTShapeDisplayer = new SMESH::TShapeDisplayer(); //myHelpFileName = "/files/about_meshes.htm"; // V3 myHelpFileName = "about_meshes_page.html"; // V4 // connect signals and slots connect(myDlg->myShowBtn, SIGNAL (clicked()), SLOT(onPreviewShape())); connect(myDlg->myPublishBtn, SIGNAL (clicked()), SLOT(onPublishShape())); - connect(table(),SIGNAL(selectionChanged()), SLOT(currentCellChanged())); - connect(table(),SIGNAL(currentChanged(int,int)), SLOT(currentCellChanged())); + connect(table(), SIGNAL(itemSelectionChanged()), SLOT(currentCellChanged())); + connect(table(), SIGNAL(currentCellChanged(int,int,int,int)), SLOT(currentCellChanged())); } //======================================================================= @@ -796,10 +943,9 @@ void SMESHGUI_ComputeOp::startOperation() int nbSel = selected.Extent(); if (nbSel != 1) { - SUIT_MessageBox::warn1(desktop(), - tr("SMESH_WRN_WARNING"), - tr("SMESH_WRN_NO_AVAILABLE_DATA"), - tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(desktop(), + tr("SMESH_WRN_WARNING"), + tr("SMESH_WRN_NO_AVAILABLE_DATA")); onCancel(); return; } @@ -807,17 +953,16 @@ void SMESHGUI_ComputeOp::startOperation() Handle(SALOME_InteractiveObject) IObject = selected.First(); aMesh = SMESH::GetMeshByIO(IObject); if (aMesh->_is_nil()) { - SUIT_MessageBox::warn1(desktop(), - tr("SMESH_WRN_WARNING"), - tr("SMESH_WRN_NO_AVAILABLE_DATA"), - tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(desktop(), + tr("SMESH_WRN_WARNING"), + tr("SMESH_WRN_NO_AVAILABLE_DATA")); onCancel(); return; } // COMPUTE MESH - MemoryReserve aMemoryReserve; + SMESH::MemoryReserve aMemoryReserve; SMESH::compute_error_array_var aCompErrors; QString aHypErrors; @@ -830,7 +975,7 @@ void SMESHGUI_ComputeOp::startOperation() bool shapeOK = myMainShape->_is_nil() ? !hasShape : hasShape; if ( shapeOK && aMeshSObj ) { - myDlg->myMeshName->setText( aMeshSObj->GetName() ); + myDlg->myMeshName->setText( aMeshSObj->GetName().c_str() ); SMESH::SMESH_Gen_var gen = getSMESHGUI()->GetSMESHGen(); SMESH::algo_error_array_var errors = gen->GetAlgoState(aMesh,myMainShape); if ( errors->length() > 0 ) { @@ -890,7 +1035,7 @@ void SMESHGUI_ComputeOp::startOperation() Sel->setSelectedObjects( selected ); } } - myDlg->setCaption(tr( computeFailed ? "SMESH_WRN_COMPUTE_FAILED" : "SMESH_COMPUTE_SUCCEED")); + myDlg->setWindowTitle(tr( computeFailed ? "SMESH_WRN_COMPUTE_FAILED" : "SMESH_COMPUTE_SUCCEED")); myDlg->myMemoryLackGroup->hide(); // SHOW ERRORS @@ -916,7 +1061,7 @@ void SMESHGUI_ComputeOp::startOperation() } else { - QTable* tbl = myDlg->myTable; + QTableWidget* tbl = myDlg->myTable; myDlg->myBriefInfo->SetInfoByMesh( aMesh ); myDlg->myBriefInfo->show(); myDlg->myFullInfo->hide(); @@ -945,7 +1090,7 @@ void SMESHGUI_ComputeOp::startOperation() } // fill table of errors - tbl->setNumRows( aCompErrors->length() ); + tbl->setRowCount( aCompErrors->length() ); if ( !hasShape ) tbl->hideColumn( COL_SHAPE ); else tbl->showColumn( COL_SHAPE ); tbl->setColumnWidth( COL_ERROR, 200 ); @@ -953,21 +1098,21 @@ void SMESHGUI_ComputeOp::startOperation() for ( int row = 0; row < aCompErrors->length(); ++row ) { SMESH::ComputeError & err = aCompErrors[ row ]; - tbl->setText( row, COL_ALGO, err.algoName.in() ); - tbl->setText( row, COL_ERROR, errorText( err.code, err.comment.in() )); - tbl->setText( row, COL_SHAPEID, QString("%1").arg( err.subShapeID )); + tbl->item( row, COL_ALGO )->setText( err.algoName.in() ); + tbl->item( row, COL_ERROR )->setText( SMESH::errorText( err.code, err.comment.in() )); + tbl->item( row, COL_SHAPEID )->setText( QString("%1").arg( err.subShapeID )); - QString text = hasShape ? shapeText( err.subShapeID, myMainShape ) : QString(""); - tbl->setText( row, COL_SHAPE, text ); + QString text = hasShape ? SMESH::shapeText( err.subShapeID, myMainShape ) : QString(""); + tbl->item( row, COL_SHAPE )->setText( text ); - text = ( !hasShape || getSubShapeSO( err.subShapeID, myMainShape )) ? "PUBLISHED" : ""; - tbl->setText( row, COL_PUBLISHED, text ); // if text=="", "PUBLISH" button enabled + text = ( !hasShape || SMESH::getSubShapeSO( err.subShapeID, myMainShape )) ? "PUBLISHED" : ""; + tbl->item( row, COL_PUBLISHED )->setText( text ); // if text=="", "PUBLISH" button enabled - tbl->item( row, COL_ERROR )->setWordWrap( TRUE ); - tbl->adjustRow( row ); + //tbl->item( row, COL_ERROR )->setWordWrap( true ); // VSR: TODO ??? + tbl->resizeRowToContents( row ); } - tbl->adjustColumn( COL_ALGO ); - tbl->adjustColumn( COL_SHAPE ); + tbl->resizeColumnToContents( COL_ALGO ); + tbl->resizeColumnToContents( COL_SHAPE ); tbl->setCurrentCell(0,0); currentCellChanged(); // to update buttons @@ -999,37 +1144,37 @@ void SMESHGUI_ComputeOp::onPublishShape() GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen(); SALOMEDS::Study_var study = SMESHGUI::GetSMESHGen()->GetCurrentStudy(); - list< int > rows; - list< int >::iterator row; - getSelectedRows( table(), rows ); - for ( row = rows.begin(); row != rows.end(); ++row ) + QList rows; + SMESH::getSelectedRows( table(), rows ); + int row; + foreach ( row, rows ) { - int curSub = table()->text(*row, COL_SHAPEID).toInt(); - GEOM::GEOM_Object_var shape = getSubShape( curSub, myMainShape ); - if ( !shape->_is_nil() && ! getSubShapeSO( curSub, myMainShape )) + int curSub = table()->item(row, COL_SHAPEID)->text().toInt(); + GEOM::GEOM_Object_var shape = SMESH::getSubShape( curSub, myMainShape ); + if ( !shape->_is_nil() && ! SMESH::getSubShapeSO( curSub, myMainShape )) { - if ( !getSubShapeSO( 1, myMainShape )) // the main shape not published + if ( !SMESH::getSubShapeSO( 1, myMainShape )) // the main shape not published { - QString name = GEOMBase::GetDefaultName( shapeTypeName( myMainShape, "MAIN_SHAPE" )); + QString name = GEOMBase::GetDefaultName( SMESH::shapeTypeName( myMainShape, "MAIN_SHAPE" )); SALOMEDS::SObject_var so = - geomGen->AddInStudy( study, myMainShape, name, GEOM::GEOM_Object::_nil()); + geomGen->AddInStudy( study, myMainShape, name.toLatin1().data(), GEOM::GEOM_Object::_nil()); // look for myMainShape in the table - for ( int r = 0, nr = table()->numRows(); r < nr; ++r ) { - if ( table()->text(r, COL_SHAPEID) == "1" ) { + for ( int r = 0, nr = table()->rowCount(); r < nr; ++r ) { + if ( table()->item( r, COL_SHAPEID )->text() == "1" ) { if ( so->_is_nil() ) { - table()->setText( r, COL_SHAPE, so->GetName() ); - table()->setText( r, COL_PUBLISHED, so->GetID() ); + table()->item( r, COL_SHAPE )->setText( so->GetName() ); + table()->item( r, COL_PUBLISHED )->setText( so->GetID() ); } break; } } if ( curSub == 1 ) continue; } - QString name = GEOMBase::GetDefaultName( shapeTypeName( shape, "ERROR_SHAPE" )); - SALOMEDS::SObject_var so = geomGen->AddInStudy( study, shape, name, myMainShape); + QString name = GEOMBase::GetDefaultName( SMESH::shapeTypeName( shape, "ERROR_SHAPE" )); + SALOMEDS::SObject_var so = geomGen->AddInStudy( study, shape, name.toLatin1().data(), myMainShape); if ( !so->_is_nil() ) { - table()->setText( *row, COL_SHAPE, so->GetName() ); - table()->setText( *row, COL_PUBLISHED, so->GetID() ); + table()->item( row, COL_SHAPE )->setText( so->GetName() ); + table()->item( row, COL_PUBLISHED )->setText( so->GetID() ); } } } @@ -1048,17 +1193,17 @@ void SMESHGUI_ComputeOp::currentCellChanged() myTShapeDisplayer->SetVisibility( false ); bool publishEnable = 0, showEnable = 0, showOnly = 1; - list< int > rows; - list< int >::iterator row; - getSelectedRows( table(), rows ); - for ( row = rows.begin(); row != rows.end(); ++row ) + QList rows; + SMESH::getSelectedRows( table(), rows ); + int row; + foreach ( row, rows ) { - bool hasData = ( !table()->text(*row, COL_SHAPE).isEmpty() ); - bool isPublished = ( !table()->text(*row, COL_PUBLISHED).isEmpty() ); + bool hasData = ( !table()->item( row, COL_SHAPE )->text().isEmpty() ); + bool isPublished = ( !table()->item( row, COL_PUBLISHED )->text().isEmpty() ); if ( hasData && !isPublished ) publishEnable = true; - int curSub = table()->text(*row, COL_SHAPEID).toInt(); + int curSub = table()->item( row, COL_SHAPEID )->text().toInt(); bool prsReady = myTShapeDisplayer->HasReadyActorsFor( curSub, myMainShape ); if ( prsReady ) { myTShapeDisplayer->Show( curSub, myMainShape, showOnly ); @@ -1083,14 +1228,14 @@ void SMESHGUI_ComputeOp::onPreviewShape() if ( myTShapeDisplayer ) { SUIT_OverrideCursor aWaitCursor; - list< int > rows; - list< int >::iterator row; - getSelectedRows( table(), rows ); + QList rows; + SMESH::getSelectedRows( table(), rows ); bool showOnly = true; - for ( row = rows.begin(); row != rows.end(); ++row ) + int row; + foreach ( row, rows ) { - int curSub = table()->text(*row, COL_SHAPEID).toInt(); + int curSub = table()->item( row, COL_SHAPEID )->text().toInt(); if ( curSub > 0 ) { myTShapeDisplayer->Show( curSub, myMainShape, showOnly ); showOnly = false; @@ -1140,7 +1285,7 @@ bool SMESHGUI_ComputeOp::onApply() */ //================================================================================ -QTable* SMESHGUI_ComputeOp::table() +QTableWidget* SMESHGUI_ComputeOp::table() { return myDlg->myTable; } diff --git a/src/SMESHGUI/SMESHGUI_ComputeDlg.h b/src/SMESHGUI/SMESHGUI_ComputeDlg.h index 5ea7a662b..6413a4d23 100644 --- a/src/SMESHGUI/SMESHGUI_ComputeDlg.h +++ b/src/SMESHGUI/SMESHGUI_ComputeDlg.h @@ -1,57 +1,57 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_ComputeDlg.h +// Author : Edward AGAPOV, Open CASCADE S.A.S. // -// -// File : SMESHGUI_ComputeDlg.h -// Author : Edward AGAPOV -// Module : SMESH +#ifndef SMESHGUI_COMPUTEDLG_H +#define SMESHGUI_COMPUTEDLG_H -#ifndef SMESHGUI_ComputeDlg_H -#define SMESHGUI_ComputeDlg_H +// SMESH includes +#include "SMESH_SMESHGUI.hxx" #include "SMESHGUI_Dialog.h" -#include "SMESHGUI_SelectionOp.h" - -#include "VTKViewer.h" +#include "SMESHGUI_Operation.h" -#include "SALOMEconfig.h" -#include CORBA_SERVER_HEADER(GEOM_Gen) +// Qt includes +#include -#include +// IDL includes +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) class QFrame; class QPushButton; -class QTable; +class QTableWidget; class QLabel; class SMESHGUI_ComputeDlg; -class GEOM_Actor; -namespace SMESH { +namespace SMESH +{ class TShapeDisplayer; } /*! * \brief Operation to compute a mesh and show computation errors */ -class SMESHGUI_ComputeOp: public SMESHGUI_Operation +class SMESHGUI_EXPORT SMESHGUI_ComputeOp: public SMESHGUI_Operation { Q_OBJECT @@ -62,7 +62,6 @@ public: virtual LightApp_Dialog* dlg() const; protected: - virtual void startOperation(); virtual void stopOperation(); @@ -70,47 +69,63 @@ protected slots: virtual bool onApply(); private slots: - void onPreviewShape(); void onPublishShape(); void currentCellChanged(); private: + QTableWidget* table(); - QTable* table(); + SMESHGUI_ComputeDlg* myDlg; - SMESHGUI_ComputeDlg* myDlg; - - GEOM::GEOM_Object_var myMainShape; - SMESH::TShapeDisplayer* myTShapeDisplayer; + GEOM::GEOM_Object_var myMainShape; + SMESH::TShapeDisplayer* myTShapeDisplayer; }; /*! * \brief Box showing mesh info */ -class SMESHGUI_MeshInfosBox : public QGroupBox +class SMESHGUI_EXPORT SMESHGUI_MeshInfosBox : public QGroupBox { Q_OBJECT + public: + SMESHGUI_MeshInfosBox( const bool, QWidget* ); - SMESHGUI_MeshInfosBox(const bool full, QWidget* theParent); - void SetInfoByMesh(SMESH::SMESH_Mesh_var mesh); + void SetInfoByMesh( SMESH::SMESH_Mesh_var ); private: - bool myFull; QLabel* myNbNode; - QLabel* myNbEdge, *myNbLinEdge, *myNbQuadEdge; - QLabel* myNbTrai, *myNbLinTrai, *myNbQuadTrai; - QLabel* myNbQuad, *myNbLinQuad, *myNbQuadQuad; - QLabel* myNbFace, *myNbLinFace, *myNbQuadFace; + QLabel* myNbEdge; + QLabel* myNbLinEdge; + QLabel* myNbQuadEdge; + QLabel* myNbTrai; + QLabel* myNbLinTrai; + QLabel* myNbQuadTrai; + QLabel* myNbQuad; + QLabel* myNbLinQuad; + QLabel* myNbQuadQuad; + QLabel* myNbFace; + QLabel* myNbLinFace; + QLabel* myNbQuadFace; QLabel* myNbPolyg; - QLabel* myNbHexa, *myNbLinHexa, *myNbQuadHexa; - QLabel* myNbTetra, *myNbLinTetra, *myNbQuadTetra; - QLabel* myNbPyra, *myNbLinPyra, *myNbQuadPyra; - QLabel* myNbPrism, *myNbLinPrism, *myNbQuadPrism; - QLabel* myNbVolum, *myNbLinVolum, *myNbQuadVolum; + QLabel* myNbHexa; + QLabel* myNbLinHexa; + QLabel* myNbQuadHexa; + QLabel* myNbTetra; + QLabel* myNbLinTetra; + QLabel* myNbQuadTetra; + QLabel* myNbPyra; + QLabel* myNbLinPyra; + QLabel* myNbQuadPyra; + QLabel* myNbPrism; + QLabel* myNbLinPrism; + QLabel* myNbQuadPrism; + QLabel* myNbVolum; + QLabel* myNbLinVolum; + QLabel* myNbQuadVolum; QLabel* myNbPolyh; }; @@ -118,23 +133,22 @@ private: * \brief Dialog to compute a mesh and show computation errors */ -class SMESHGUI_ComputeDlg : public SMESHGUI_Dialog +class SMESHGUI_EXPORT SMESHGUI_ComputeDlg : public SMESHGUI_Dialog { Q_OBJECT public: - SMESHGUI_ComputeDlg(); + SMESHGUI_ComputeDlg(); private: - - QFrame* createMainFrame (QWidget*); + QFrame* createMainFrame( QWidget* ); QLabel* myMeshName; QGroupBox* myMemoryLackGroup; QGroupBox* myCompErrorGroup; QGroupBox* myHypErrorGroup; QLabel* myHypErrorLabel; - QTable* myTable; + QTableWidget* myTable; QPushButton* myShowBtn; QPushButton* myPublishBtn; @@ -142,7 +156,6 @@ private: SMESHGUI_MeshInfosBox* myFullInfo; friend class SMESHGUI_ComputeOp; - }; -#endif +#endif // SMESHGUI_COMPUTEDLG_H diff --git a/src/SMESHGUI/SMESHGUI_ConvToQuadDlg.cxx b/src/SMESHGUI/SMESHGUI_ConvToQuadDlg.cxx index 6c2cf5dab..cdb4a7348 100644 --- a/src/SMESHGUI/SMESHGUI_ConvToQuadDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ConvToQuadDlg.cxx @@ -1,77 +1,85 @@ +// SMESH SMESHGUI : GUI for SMESH component +// // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public +// You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -/** -* SMESH SMESHGUI -* -* Copyright (C) 2005 CEA/DEN, EDF R&D -* -* -* -* File : SMESHGUI_ConvToQuadDlg.cxx -* Module : SMESH -*/ - -#include -#include - -#include -#include -#include -#include -#include +// File : SMESHGUI_ConvToQuadDlg.cxx +// Author : Open CASCADE S.A.S. +// + +// SMESH includes +#include "SMESHGUI_ConvToQuadDlg.h" + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include + +#define SPACING 6 +#define MARGIN 11 SMESHGUI_ConvToQuadDlg::SMESHGUI_ConvToQuadDlg() -: SMESHGUI_Dialog( 0, false, true ) + : SMESHGUI_Dialog( 0, false, true ) { - - setCaption( tr( "CAPTION" ) ); + setWindowTitle( tr( "CAPTION" ) ); // Create top controls - QGroupBox* aGrp = new QGroupBox( 3, Qt::Horizontal, mainFrame() ); - aGrp->setFrameStyle( QFrame::NoFrame ); - aGrp->setInsideMargin( 0 ); // mesh - createObject( tr( "MESH" ), aGrp, 0 ); + createObject( tr( "MESH" ), mainFrame(), 0 ); //Create check box - myMedNdsOnGeom = new QCheckBox( tr( "MEDIUMNDS" ), mainFrame() ); + myMedNdsOnGeom = new QCheckBox( tr( "MEDIUMNDS" ), mainFrame() ); //Create RadioButtons - myBG = new QButtonGroup( 2, Qt::Vertical, "", mainFrame() ); - myBG->setExclusive( true ); + myBGBox = new QGroupBox( mainFrame() ); + myBG = new QButtonGroup( mainFrame() ); + QHBoxLayout* aBGLayout = new QHBoxLayout( myBGBox ); + aBGLayout->setMargin(MARGIN); + aBGLayout->setSpacing(SPACING); - myRB1 = new QRadioButton( myBG ); - myRB1->setText( tr( "RADIOBTN_1" ) ); - myRB1->setChecked( true ); + myRB1 = new QRadioButton( tr( "RADIOBTN_1" ), myBGBox ); + myRB2 = new QRadioButton( tr( "RADIOBTN_2" ), myBGBox ); - myRB2 = new QRadioButton( myBG ); - myRB2->setText( tr( "RADIOBTN_2" ) ); + aBGLayout->addWidget(myRB1); + aBGLayout->addWidget(myRB2); + myBG->addButton(myRB1, 0); + myBG->addButton(myRB2, 1); + myRB1->setChecked( true ); // Fill layout - QVBoxLayout* aLay = new QVBoxLayout( mainFrame(), 5, 5 ); - aLay->addWidget( aGrp ); - aLay->addWidget( myMedNdsOnGeom ); - aLay->addWidget( myBG ); + QGridLayout* aLay = new QGridLayout( mainFrame() ); + aLay->setMargin( 0 ); + aLay->setSpacing( SPACING ); + + aLay->addWidget( objectWg( 0, Label ), 0, 0 ); + aLay->addWidget( objectWg( 0, Btn ), 0, 1 ); + aLay->addWidget( objectWg( 0, Control ), 0, 2 ); + aLay->addWidget( myMedNdsOnGeom, 1, 0, 1, 3 ); + aLay->addWidget( myBGBox, 2, 0, 1, 3 ); - connect(myBG, SIGNAL( clicked( int ) ), this, SIGNAL( onClicked( int ) ) ); + connect(myBG, SIGNAL( buttonClicked( int ) ), this, SIGNAL( onClicked( int ) ) ); } SMESHGUI_ConvToQuadDlg::~SMESHGUI_ConvToQuadDlg() @@ -100,12 +108,12 @@ void SMESHGUI_ConvToQuadDlg::SetEnabledCheck( const bool theCheck ) int SMESHGUI_ConvToQuadDlg::CurrentRB( ) { - return myBG->selectedId(); + return myBG->checkedId(); } void SMESHGUI_ConvToQuadDlg::SetEnabledControls( const bool theCheck ) { - myBG->setEnabled( theCheck ); + myBGBox->setEnabled( theCheck ); myMedNdsOnGeom->setEnabled( theCheck ); setButtonEnabled( theCheck, QtxDialog::OK | QtxDialog::Apply ); } @@ -124,7 +132,7 @@ void SMESHGUI_ConvToQuadDlg::SetEnabledRB( const int idx, const bool theCheck ) myRB2->setEnabled( !theCheck ); myRB2->setChecked( true ); } - emit onClicked( myBG->selectedId() ); + emit onClicked( myBG->checkedId() ); } diff --git a/src/SMESHGUI/SMESHGUI_ConvToQuadDlg.h b/src/SMESHGUI/SMESHGUI_ConvToQuadDlg.h index 68d024bc6..30ad3d062 100644 --- a/src/SMESHGUI/SMESHGUI_ConvToQuadDlg.h +++ b/src/SMESHGUI/SMESHGUI_ConvToQuadDlg.h @@ -1,81 +1,67 @@ +// SMESH SMESHGUI : GUI for SMESH component +// // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public +// You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -/** -* SMESH SMESHGUI -* -* Copyright (C) 2005 CEA/DEN, EDF R&D -* -* -* -* File : SMESHGUI_ConvToQuadDlg.h -* Module : SMESH -*/ +// File : SMESHGUI_ConvToQuadDlg.h +// Author : Open CASCADE S.A.S. +// +#ifndef SMESHGUI_CONVTOQUADDLG_H +#define SMESHGUI_CONVTOQUADDLG_H -#ifndef SMESHGUI_ConvToQuadDlg_H -#define SMESHGUI_ConvToQuadDlg_H +// SMESH includes +#include "SMESH_SMESHGUI.hxx" #include "SMESHGUI_Dialog.h" -/*#include -#include -#include */ - -//idl headers -#include -#include CORBA_SERVER_HEADER(SMESH_Mesh) class QCheckBox; class QRadioButton; class QButtonGroup; +class QGroupBox; -class SMESHGUI_ConvToQuadDlg : public SMESHGUI_Dialog +class SMESHGUI_EXPORT SMESHGUI_ConvToQuadDlg : public SMESHGUI_Dialog { Q_OBJECT public: - SMESHGUI_ConvToQuadDlg(); + SMESHGUI_ConvToQuadDlg(); virtual ~SMESHGUI_ConvToQuadDlg(); - bool IsMediumNdsOnGeom() const; - void SetMediumNdsOnGeom(const bool theCheck); - bool IsEnabledCheck() const; - void SetEnabledCheck( const bool theCheck ); - void SetEnabledGroup( const bool theCheck ); - void SetEnabledControls( const bool theCheck ); - void SetEnabledRB( const int idx, const bool theCheck ); - int CurrentRB();//returns the ID of the selected toggle button + bool IsMediumNdsOnGeom() const; + void SetMediumNdsOnGeom( const bool ); + bool IsEnabledCheck() const; + void SetEnabledCheck( const bool ); + void SetEnabledGroup( const bool ); + void SetEnabledControls( const bool ); + void SetEnabledRB( const int, const bool ); + int CurrentRB(); //returns the ID of the selected toggle button signals: - void onClicked( int ); + void onClicked( int ); private: - - QCheckBox* myMedNdsOnGeom; + QCheckBox* myMedNdsOnGeom; + QGroupBox* myBGBox; QButtonGroup* myBG; QRadioButton* myRB1; QRadioButton* myRB2; - }; -#endif - - - - +#endif // SMESHGUI_CONVTOQUADDLG_H diff --git a/src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx b/src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx index fc4711bf7..b8d11d8fa 100644 --- a/src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx +++ b/src/SMESHGUI/SMESHGUI_ConvToQuadOp.cxx @@ -1,47 +1,43 @@ +// SMESH SMESHGUI : GUI for SMESH component +// // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public +// You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -/** -* SMESH SMESHGUI -* -* Copyright (C) 2005 CEA/DEN, EDF R&D -* -* -* -* File : SMESHGUI_ConvToQuadOp.h -* Module : SMESHGUI -*/ +// File : SMESHGUI_ConvToQuadOp.cxx +// Author : Open CASCADE S.A.S. +// +// SMESH includes #include "SMESHGUI_ConvToQuadOp.h" -#include "SMESHGUI_ConvToQuadDlg.h" -#include "SMESHGUI.h" +#include "SMESHGUI_ConvToQuadDlg.h" #include "SMESHGUI_Utils.h" -#include "SMESH_TypeFilter.hxx" - -#include "SalomeApp_Tools.h" +#include -#include "SUIT_MessageBox.h" +// SALOME GUI includes +#include +#include +#include -#include "LightApp_UpdateFlags.h" - +// IDL includes +#include #include CORBA_SERVER_HEADER(SMESH_MeshEditor) //================================================================================ @@ -115,14 +111,14 @@ void SMESHGUI_ConvToQuadOp::startOperation() //================================================================================ void SMESHGUI_ConvToQuadOp::selectionDone() { - if ( !dlg()->isShown() ) + if ( !dlg()->isVisible() ) return; SMESHGUI_SelectionOp::selectionDone(); try { QString anMeshEntry = myDlg->selectedObject( 0 ); - _PTR(SObject) pMesh = studyDS()->FindObjectID( anMeshEntry.latin1() ); + _PTR(SObject) pMesh = studyDS()->FindObjectID( anMeshEntry.toLatin1().data() ); if ( !pMesh ) return; SMESH::SMESH_Mesh_var mesh = @@ -184,12 +180,12 @@ bool SMESHGUI_ConvToQuadOp::onApply() QString aMess; QString anMeshEntry = myDlg->selectedObject( 0 ); - _PTR(SObject) pMesh = studyDS()->FindObjectID( anMeshEntry.latin1() ); + _PTR(SObject) pMesh = studyDS()->FindObjectID( anMeshEntry.toLatin1().data() ); if ( !pMesh ) { dlg()->show(); - SUIT_MessageBox::warn1( myDlg, - tr( "SMESH_WRN_WARNING" ), tr("MESH_IS_NOT_SELECTED"), tr( "SMESH_BUT_OK" ) ); + SUIT_MessageBox::warning( myDlg, + tr( "SMESH_WRN_WARNING" ), tr("MESH_IS_NOT_SELECTED") ); return false; } @@ -199,8 +195,8 @@ bool SMESHGUI_ConvToQuadOp::onApply() if( CORBA::is_nil(mesh) ) { - SUIT_MessageBox::warn1( myDlg, - tr( "SMESH_WRN_WARNING" ), tr("REF_IS_NULL"), tr( "SMESH_BUT_OK" ) ); + SUIT_MessageBox::warning( myDlg, + tr( "SMESH_WRN_WARNING" ), tr("REF_IS_NULL") ); return false; } @@ -272,7 +268,7 @@ SMESHGUI_ConvToQuadOp::MeshType SMESHGUI_ConvToQuadOp::ConsistMesh( const SMESH: void SMESHGUI_ConvToQuadOp::ConnectRadioButtons( int id ) { QString anMeshEntry = myDlg->selectedObject( 0 ); - _PTR(SObject) pMesh = studyDS()->FindObjectID( anMeshEntry.latin1() ); + _PTR(SObject) pMesh = studyDS()->FindObjectID( anMeshEntry.toLatin1().data() ); if ( !pMesh ) return; SMESH::SMESH_Mesh_var mesh = @@ -286,5 +282,3 @@ void SMESHGUI_ConvToQuadOp::ConnectRadioButtons( int id ) else myDlg->SetEnabledCheck( true ); } - - diff --git a/src/SMESHGUI/SMESHGUI_ConvToQuadOp.h b/src/SMESHGUI/SMESHGUI_ConvToQuadOp.h index 129a4b91a..3cb5e221a 100644 --- a/src/SMESHGUI/SMESHGUI_ConvToQuadOp.h +++ b/src/SMESHGUI/SMESHGUI_ConvToQuadOp.h @@ -1,50 +1,48 @@ +// SMESH SMESHGUI : GUI for SMESH component +// // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public +// You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -/** -* SMESH SMESHGUI -* -* Copyright (C) 2005 CEA/DEN, EDF R&D -* -* -* -* File : SMESHGUI_ConvToQuadOp.h -* Module : SMESHGUI -*/ +// File : SMESHGUI_ConvToQuadOp.h +// Author : Open CASCADE S.A.S. +// + +#ifndef SMESHGUI_CONVTOQUADOP_H +#define SMESHGUI_CONVTOQUADOP_H -#ifndef SMESHGUI_ConvToQuadOp_H -#define SMESHGUI_ConvToQuadOp_H +// SMESH includes +#include "SMESH_SMESHGUI.hxx" -#include -//#include +#include "SMESHGUI_SelectionOp.h" +// IDL includes #include #include CORBA_SERVER_HEADER(SMESH_Mesh) class SMESHGUI_ConvToQuadDlg; -class SMESHGUI_ConvToQuadOp : public SMESHGUI_SelectionOp +class SMESHGUI_EXPORT SMESHGUI_ConvToQuadOp : public SMESHGUI_SelectionOp { Q_OBJECT public: -enum MeshType{ Comp = 0, Linear, Quadratic }; + enum MeshType{ Comp = 0, Linear, Quadratic }; public: SMESHGUI_ConvToQuadOp(); @@ -60,11 +58,10 @@ protected: protected slots: virtual bool onApply(); - void ConnectRadioButtons( int); + void ConnectRadioButtons( int ); private: SMESHGUI_ConvToQuadDlg* myDlg; }; -#endif - +#endif // SMESHGUI_CONVTOQUADOP_H diff --git a/src/SMESHGUI/SMESHGUI_CreateHypothesesDlg.h b/src/SMESHGUI/SMESHGUI_CreateHypothesesDlg.h deleted file mode 100644 index 3219dd56c..000000000 --- a/src/SMESHGUI/SMESHGUI_CreateHypothesesDlg.h +++ /dev/null @@ -1,96 +0,0 @@ -// SMESH SMESHGUI : GUI for SMESH component -// -// Copyright (C) 2003 CEA -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org -// -// -// -// File : SMESHGUI_CreateHypothesesDlg.h -// Author : Julia DOROVSKIKH -// Module : SMESH -// $Header$ - -#ifndef DIALOGBOX_CREATE_HYPOTHESES_H -#define DIALOGBOX_CREATE_HYPOTHESES_H - -#include "SMESH_SMESHGUI.hxx" - -// QT Includes -#include -#include -#include - -// IDL Headers -#include -#include CORBA_SERVER_HEADER(GEOM_Gen) -#include CORBA_SERVER_HEADER(SMESH_Mesh) - -#include -#include - -class QButtonGroup; -class QGroupBox; -class QPushButton; -class QListView; -class QListViewItem; -class SMESHGUI; - -//================================================================================= -// class : SMESHGUI_CreateHypothesesDlg -// purpose : -//================================================================================= -class SMESHGUI_EXPORT SMESHGUI_CreateHypothesesDlg : public QDialog -{ - Q_OBJECT - -public: - SMESHGUI_CreateHypothesesDlg (SMESHGUI*, - const char* name = 0, - bool modal = FALSE, - bool isAlgo = FALSE); - ~SMESHGUI_CreateHypothesesDlg (); - -private: - - void Init() ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; - - void InitAlgoDefinition(); - - SMESHGUI* mySMESHGUI; - bool myIsAlgo; - - QGroupBox* GroupButtons; - QPushButton* buttonCancel; - QPushButton* buttonApply; - - QGroupBox* GroupAlgorithms; - QListView* ListAlgoDefinition; - -private slots: - - void ClickOnCancel(); - void ClickOnApply(); - void ActivateThisDialog() ; - - void onSelectionChanged(); - void onDoubleClicked(QListViewItem*); -}; - -#endif // DIALOGBOX_CREATE_HYPOTHESES_H diff --git a/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx b/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx index 8ea75e530..d5eab2280 100755 --- a/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx @@ -1,80 +1,77 @@ -// SMESH SMESHGUI : GUI for SMESH component +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_CreatePatternDlg.cxx +// Author : Sergey LITONIN, Open CASCADE S.A.S. // -// -// File : SMESHGUI_CreatePatternDlg.cxx -// Author : Sergey LITONIN -// Module : SMESH +// SMESH includes #include "SMESHGUI_CreatePatternDlg.h" #include "SMESHGUI.h" -#include "SMESHGUI_SpinBox.h" #include "SMESHGUI_PatternWidget.h" #include "SMESHGUI_Utils.h" #include "SMESHGUI_VTKUtils.h" #include "SMESHGUI_PatternUtils.h" #include "SMESHGUI_GEOMGenUtils.h" -#include "SMESH_NumberFilter.hxx" +#include -#include "SUIT_ResourceMgr.h" -#include "SUIT_Desktop.h" -#include "SUIT_FileDlg.h" -#include "SUIT_Session.h" -#include "SUIT_MessageBox.h" +// SALOME GUI includes +#include +#include +#include +#include +#include -#include "SalomeApp_Study.h" -#include "LightApp_Application.h" -#include "LightApp_DataOwner.h" -#include "LightApp_SelectionMgr.h" -#include "SalomeApp_Tools.h" +#include +#include +#include -#include "SALOMEDS_SObject.hxx" +#include +#include +#include -#include "SALOME_ListIO.hxx" -#include "SVTK_ViewModel.h" -#include "SVTK_ViewWindow.h" -#include "SVTK_Selector.h" -#include "SVTK_Selection.h" +// SALOME KERNEL includes +#include -// OCCT Includes +// OCCT includes #include -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define SPACING 5 -#define MARGIN 10 +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SPACING 6 +#define MARGIN 11 /*! * Class : SMESHGUI_CreatePatternDlg @@ -86,94 +83,120 @@ // purpose : Constructor //======================================================================= SMESHGUI_CreatePatternDlg::SMESHGUI_CreatePatternDlg( SMESHGUI* theModule, - const int theType, - const char* theName) - : QDialog( SMESH::GetDesktop( theModule ), theName, false, - WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), - mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) + const int theType ) + : QDialog( SMESH::GetDesktop( theModule ) ), + mySMESHGUI( theModule ), + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) { - setCaption(tr("CAPTION")); + setModal( false ); + setWindowTitle( tr( "CAPTION" ) ); - QVBoxLayout* aDlgLay = new QVBoxLayout (this, MARGIN, SPACING); + QVBoxLayout* aDlgLay = new QVBoxLayout( this ); + aDlgLay->setMargin( MARGIN ); + aDlgLay->setSpacing( SPACING ); - QFrame* aMainFrame = createMainFrame (this); - QFrame* aBtnFrame = createButtonFrame(this); + QWidget* aMainFrame = createMainFrame( this ); + QWidget* aBtnFrame = createButtonFrame( this ); - aDlgLay->addWidget(aMainFrame); - aDlgLay->addWidget(aBtnFrame); + aDlgLay->addWidget( aMainFrame ); + aDlgLay->addWidget( aBtnFrame ); - aDlgLay->setStretchFactor(aMainFrame, 1); + aDlgLay->setStretchFactor( aMainFrame, 1 ); - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) ) mySelector = aViewWindow->GetSelector(); myHelpFileName = "pattern_mapping_page.html"; - Init(theType); + Init( theType ); } //======================================================================= // function : createMainFrame() // purpose : Create frame containing dialog's input fields //======================================================================= -QFrame* SMESHGUI_CreatePatternDlg::createMainFrame (QWidget* theParent) +QWidget* SMESHGUI_CreatePatternDlg::createMainFrame( QWidget* theParent ) { - QPixmap iconSlct (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT"))); - QPixmap icon2d (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_PATTERN_2d"))); - QPixmap icon3d (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_PATTERN_3d"))); - QPixmap iconSample2d (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_PATTERN_SAMPLE_2D"))); + QPixmap iconSlct ( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) ); + QPixmap icon2d ( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", tr( "ICON_PATTERN_2d" ) ) ); + QPixmap icon3d ( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", tr( "ICON_PATTERN_3d" ) ) ); + QPixmap iconSample2d( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", tr( "ICON_PATTERN_SAMPLE_2D" ) ) ); - QGroupBox* aMainGrp = new QGroupBox(1, Qt::Horizontal, theParent); - aMainGrp->setFrameStyle(QFrame::NoFrame); - aMainGrp->setInsideMargin(0); + QWidget* aMainGrp = new QWidget( theParent ); + QVBoxLayout* aMainGrpLayout = new QVBoxLayout( aMainGrp ); + aMainGrpLayout->setMargin( 0 ); + aMainGrpLayout->setSpacing( SPACING ); // Pattern type group - myTypeGrp = new QButtonGroup (1, Qt::Vertical, tr("PATTERN_TYPE"), aMainGrp); - mySwitch2d = new QRadioButton (myTypeGrp); - mySwitch3d = new QRadioButton (myTypeGrp); - mySwitch2d->setPixmap(icon2d); - mySwitch3d->setPixmap(icon3d); - myTypeGrp->insert(mySwitch2d, Type_2d); - myTypeGrp->insert(mySwitch3d, Type_3d); + QGroupBox* aTypeGrp = new QGroupBox( tr( "PATTERN_TYPE" ), aMainGrp ); + QHBoxLayout* aTypeGrpLayout = new QHBoxLayout( aTypeGrp ); + aTypeGrpLayout->setMargin( MARGIN ); + aTypeGrpLayout->setSpacing( SPACING ); - QGroupBox* aPatternGrp = new QGroupBox(1, Qt::Horizontal, tr("PATTERN"), aMainGrp); + mySwitch2d = new QRadioButton( aTypeGrp ); + mySwitch3d = new QRadioButton( aTypeGrp ); + mySwitch2d->setIcon( icon2d ); + mySwitch3d->setIcon( icon3d ); - // Mesh and pattern name group + myTypeGrp = new QButtonGroup( aMainGrp ); + myTypeGrp->addButton( mySwitch2d, Type_2d ); + myTypeGrp->addButton( mySwitch3d, Type_3d ); - QGroupBox* aMeshGrp = new QGroupBox(1, Qt::Vertical, aPatternGrp); - aMeshGrp->setFrameStyle(QFrame::NoFrame); - aMeshGrp->setInsideMargin(0); + // ... layout widgets + + aTypeGrpLayout->addWidget( mySwitch2d ); + aTypeGrpLayout->addWidget( mySwitch3d ); + + // Mesh and pattern name group - new QLabel(tr("MESH_OR_SUBMESH"), aMeshGrp); + QGroupBox* aPatternGrp = new QGroupBox( tr( "PATTERN" ), aMainGrp ); + QGridLayout* aPatternGrpLayout = new QGridLayout( aPatternGrp ); + aPatternGrpLayout->setMargin( MARGIN ); + aPatternGrpLayout->setSpacing( SPACING ); - QPushButton* aSelBtn = new QPushButton(aMeshGrp); - aSelBtn->setPixmap(iconSlct); - myMeshEdit = new QLineEdit(aMeshGrp); - myMeshEdit->setReadOnly(true); + QLabel* aMeshLab = new QLabel( tr( "MESH_OR_SUBMESH" ), aPatternGrp ); - QGroupBox* aPattGrp = new QGroupBox(1, Qt::Vertical, aPatternGrp); - aPattGrp->setFrameStyle(QFrame::NoFrame); - aPattGrp->setInsideMargin(0); + QPushButton* aSelBtn = new QPushButton( aPatternGrp ); + aSelBtn->setIcon( iconSlct ); + myMeshEdit = new QLineEdit( aPatternGrp ); + myMeshEdit->setReadOnly( true ); - new QLabel(tr("PATTERN_NAME"), aPattGrp); - myName = new QLineEdit(aPattGrp); + QLabel* aNameLab = new QLabel( tr( "PATTERN_NAME" ), aPatternGrp ); + myName = new QLineEdit( aPatternGrp ); // Picture 2d - myPicture2d = new SMESHGUI_PatternWidget(aPatternGrp), - myPicture2d->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); + myPicture2d = new SMESHGUI_PatternWidget( aPatternGrp ), + myPicture2d->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); // Project check box - myProjectChk = new QCheckBox(tr("PROJECT"), aPatternGrp); + myProjectChk = new QCheckBox( tr( "PROJECT" ), aPatternGrp ); + + // ... layout widgets + + aPatternGrpLayout->addWidget( aMeshLab, 0, 0 ); + aPatternGrpLayout->addWidget( aSelBtn, 0, 1 ); + aPatternGrpLayout->addWidget( myMeshEdit, 0, 2 ); + aPatternGrpLayout->addWidget( aNameLab, 1, 0 ); + aPatternGrpLayout->addWidget( myName, 1, 2 ); + aPatternGrpLayout->addWidget( myPicture2d, 2, 0, 1, 3 ); + aPatternGrpLayout->addWidget( myProjectChk, 3, 0, 1, 3 ); + + // main layout + + aMainGrpLayout->addWidget( aTypeGrp ); + aMainGrpLayout->addWidget( aPatternGrp ); // Connect signals and slots - connect(myTypeGrp, SIGNAL(clicked(int) ), SLOT(onTypeChanged(int))); - connect(myProjectChk, SIGNAL(toggled(bool)), SLOT(onProject(bool) )); - connect(aSelBtn, SIGNAL(clicked() ), SLOT(onSelBtnClicked())); + connect( myTypeGrp, SIGNAL( buttonClicked( int ) ), + this, SLOT( onTypeChanged( int ) ) ); + connect( myProjectChk, SIGNAL( toggled( bool ) ), + this, SLOT( onProject( bool ) ) ); + connect( aSelBtn, SIGNAL( clicked() ), + this, SLOT( onSelBtnClicked() ) ); return aMainGrp; } @@ -182,30 +205,32 @@ QFrame* SMESHGUI_CreatePatternDlg::createMainFrame (QWidget* theParent) // function : createButtonFrame() // purpose : Create frame containing buttons //======================================================================= -QFrame* SMESHGUI_CreatePatternDlg::createButtonFrame (QWidget* theParent) +QWidget* SMESHGUI_CreatePatternDlg::createButtonFrame( QWidget* theParent ) { - QFrame* aFrame = new QFrame(theParent); - aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken); - - myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), aFrame); - mySaveBtn = new QPushButton(tr("SAVE" ), aFrame); - myCloseBtn = new QPushButton(tr("SMESH_BUT_CANCEL"), aFrame); - myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aFrame); - - QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); - - QHBoxLayout* aLay = new QHBoxLayout(aFrame, MARGIN, SPACING); - - aLay->addWidget(myOkBtn); - aLay->addWidget(mySaveBtn); - aLay->addItem(aSpacer); - aLay->addWidget(myCloseBtn); - aLay->addWidget(myHelpBtn); - - connect(myOkBtn, SIGNAL(clicked()), SLOT(onOk())); - connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose())); - connect(mySaveBtn, SIGNAL(clicked()), SLOT(onSave())); - connect(myHelpBtn, SIGNAL(clicked()), SLOT(onHelp())); + QFrame* aFrame = new QFrame( theParent ); + aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken ); + + QPushButton* myOkBtn = new QPushButton( tr( "SMESH_BUT_OK" ), aFrame ); + QPushButton* mySaveBtn = new QPushButton( tr( "SAVE" ), aFrame ); + QPushButton* myCloseBtn = new QPushButton( tr( "SMESH_BUT_CANCEL"), aFrame ); + QPushButton* myHelpBtn = new QPushButton( tr( "SMESH_BUT_HELP"), aFrame ); + + QHBoxLayout* aLay = new QHBoxLayout( aFrame ); + aLay->setMargin( MARGIN ); + aLay->setSpacing( SPACING ); + + aLay->addWidget( myOkBtn ); + aLay->addSpacing( 10 ); + aLay->addWidget( mySaveBtn ); + aLay->addSpacing( 10 ); + aLay->addStretch(); + aLay->addWidget( myCloseBtn ); + aLay->addWidget( myHelpBtn ); + + connect( myOkBtn, SIGNAL( clicked() ), this, SLOT( onOk() ) ); + connect( myCloseBtn, SIGNAL( clicked() ), this, SLOT( onClose() ) ); + connect( mySaveBtn, SIGNAL( clicked() ), this, SLOT( onSave() ) ); + connect( myHelpBtn, SIGNAL( clicked() ), this, SLOT( onHelp() ) ); return aFrame; } @@ -216,7 +241,6 @@ QFrame* SMESHGUI_CreatePatternDlg::createButtonFrame (QWidget* theParent) //======================================================================= SMESHGUI_CreatePatternDlg::~SMESHGUI_CreatePatternDlg() { - // no need to delete child widgets, Qt does it all for us } //======================================================================= @@ -224,9 +248,9 @@ SMESHGUI_CreatePatternDlg::~SMESHGUI_CreatePatternDlg() // purpose : SLOT. Called when state of "Project nodes on ther face" // checkbox is changed //======================================================================= -void SMESHGUI_CreatePatternDlg::onProject (bool) +void SMESHGUI_CreatePatternDlg::onProject( bool ) { - loadFromObject(false); + loadFromObject( false ); displayPreview(); } @@ -238,7 +262,6 @@ void SMESHGUI_CreatePatternDlg::Init( const int theType ) { myIsLoaded = false; myType = -1; - myNbPoints = -1; mySubMesh = SMESH::SMESH_subMesh::_nil(); myMesh = SMESH::SMESH_Mesh::_nil(); myGeomObj = GEOM::GEOM_Object::_nil(); @@ -249,68 +272,63 @@ void SMESHGUI_CreatePatternDlg::Init( const int theType ) mySMESHGUI->SetActiveDialogBox((QDialog*)this); // selection and SMESHGUI - connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone())); - connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate())); - connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose())); + connect( mySelectionMgr, SIGNAL( currentSelectionChanged() ), + this, SLOT( onSelectionDone() ) ); + connect( mySMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), + this, SLOT( onDeactivate() ) ); + connect( mySMESHGUI, SIGNAL( SignalCloseAllDialogs() ), + this, SLOT( onClose() ) ); - mySwitch2d->setEnabled(theType == Type_2d); - mySwitch3d->setEnabled(theType == Type_3d); + mySwitch2d->setEnabled( theType == Type_2d ); + mySwitch3d->setEnabled( theType == Type_3d ); - if (theType == Type_2d) - myProjectChk->show(); - else - myProjectChk->hide(); + myTypeGrp->button( theType )->setChecked( true ); + onTypeChanged( theType ); - myTypeGrp->setButton(theType); - onTypeChanged(theType); + myName->setText( getDefaultName() ); + myMeshEdit->setText( "" ); - myName->setText(getDefaultName()); - myMeshEdit->setText(""); - - setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); - qApp->processEvents(); + QApplication::instance()->processEvents(); updateGeometry(); - myPicture2d->updateGeometry(); - adjustSize(); - resize(minimumSize()); + resize( minimumSize() ); activateSelection(); onSelectionDone(); - this->show(); + //show(); } //======================================================================= // function : SetMesh() // purpose : Set mesh to dialog //======================================================================= -void SMESHGUI_CreatePatternDlg::SetMesh (SMESH::SMESH_Mesh_ptr thePtr) +void SMESHGUI_CreatePatternDlg::SetMesh( SMESH::SMESH_Mesh_ptr thePtr ) { - myMesh = SMESH::SMESH_Mesh::_duplicate(thePtr); + myMesh = SMESH::SMESH_Mesh::_duplicate( thePtr ); mySubMesh = SMESH::SMESH_subMesh::_nil(); bool isValidMesh = false; - if (!myMesh->_is_nil()) - { - _PTR(SObject) aSobj = SMESH::FindSObject(myMesh.in()); + if ( !myMesh->_is_nil() ) { + _PTR(SObject) aSobj = SMESH::FindSObject( myMesh.in() ); //Handle(SALOME_InteractiveObject) anIObj = // new SALOME_InteractiveObject(aSobj->GetID().c_str(), "SMESH"); - SUIT_DataOwnerPtr anIObj (new LightApp_DataOwner(aSobj->GetID().c_str())); + SUIT_DataOwnerPtr anIObj( new LightApp_DataOwner( aSobj->GetID().c_str() ) ); - isValidMesh = mySelectionMgr->isOk(anIObj); + isValidMesh = mySelectionMgr->isOk( anIObj ); } - if (isValidMesh) { - _PTR(SObject) aSO = SMESH::FindSObject(myMesh.in()); - myMeshEdit->setText(aSO->GetName().c_str()); - myGeomObj = SMESH::GetGeom(aSO); - } else { - myMeshEdit->setText(""); + if ( isValidMesh ) { + _PTR(SObject) aSO = SMESH::FindSObject( myMesh.in() ); + myMeshEdit->setText( aSO->GetName().c_str() ); + myGeomObj = SMESH::GetGeom( aSO ); + } + else { + myMeshEdit->setText( "" ); myGeomObj = GEOM::GEOM_Object::_nil(); } - if (myType == Type_2d) { - loadFromObject(false); + if ( myType == Type_2d ) { + loadFromObject( false ); displayPreview(); } } @@ -321,15 +339,13 @@ void SMESHGUI_CreatePatternDlg::SetMesh (SMESH::SMESH_Mesh_ptr thePtr) //======================================================================= bool SMESHGUI_CreatePatternDlg::isValid() { - if (myGeomObj->_is_nil()) { - QMessageBox::information(SMESH::GetDesktop( mySMESHGUI ), - tr("SMESH_INSUFFICIENT_DATA"), - tr("SMESHGUI_INVALID_PARAMETERS"), - QMessageBox::Ok); + if ( myGeomObj->_is_nil() ) { + SUIT_MessageBox::information( this, + tr( "SMESH_INSUFFICIENT_DATA" ), + tr( "SMESHGUI_INVALID_PARAMETERS" ) ); return false; } - else - return true; + return true; } //======================================================================= @@ -338,7 +354,7 @@ bool SMESHGUI_CreatePatternDlg::isValid() //======================================================================= QString SMESHGUI_CreatePatternDlg::getDefaultName() const { - return myType == Type_2d ? tr("DEFAULT_2D") : tr("DEFAULT_3D"); + return myType == Type_2d ? tr( "DEFAULT_2D" ) : tr( "DEFAULT_3D" ); } //======================================================================= @@ -349,60 +365,64 @@ QString SMESHGUI_CreatePatternDlg::getDefaultName() const void SMESHGUI_CreatePatternDlg::onSave() { try { - if (!isValid()) + if ( !isValid() ) return; - if (!myIsLoaded) - loadFromObject(true); + if ( !myIsLoaded ) + loadFromObject( true ); // Load pattern from object - if (!myIsLoaded) + if ( !myIsLoaded ) return; /////////////////////////////////////////////////////// - SUIT_FileDlg* aDlg = new SUIT_FileDlg (this, false); - aDlg->setCaption(tr("SAVE_PATTERN")); - aDlg->setMode(QFileDialog::AnyFile); - aDlg->setFilters(tr("PATTERN_FILT")); - if (myName->text() != "") - aDlg->setSelection(myName->text()); - - if (aDlg->exec() != Accepted) + SUIT_FileDlg* aDlg = new SUIT_FileDlg( this, false ); + aDlg->setWindowTitle( tr( "SAVE_PATTERN" ) ); + aDlg->setFileMode( QFileDialog::AnyFile ); + aDlg->setFilter( tr( "PATTERN_FILT" ) ); + if ( myName->text() != "" ) + aDlg->selectFile( myName->text() ); + + if ( aDlg->exec() != Accepted ) return; QString fName = aDlg->selectedFile(); - if (fName.isEmpty()) + if ( fName.isEmpty() ) return; - if (QFileInfo(fName).extension().isEmpty()) - fName = autoExtension(fName); + if ( QFileInfo( fName ).suffix().isEmpty() ) + fName = autoExtension( fName ); - fName = QDir::convertSeparators(fName); + fName = QDir::convertSeparators( fName ); - QString aData (myPattern->GetString()); + QString aData( myPattern->GetString() ); long aLen = aData.length(); - QFile aFile (fName); - aFile.open(IO_WriteOnly); - long aWritten = aFile.writeBlock(aData, aLen); + QFile aFile( fName ); + aFile.open( QIODevice::WriteOnly ); + long aWritten = aFile.write( aData.toLatin1(), aLen ); aFile.close(); - if (aWritten != aLen) { - QMessageBox::information(SMESH::GetDesktop( mySMESHGUI ), tr("SMESH_ERROR"), - tr("ERROR_OF_SAVING"), QMessageBox::Ok); - } else { + if ( aWritten != aLen ) { + SUIT_MessageBox::information( this, + tr( "SMESH_ERROR" ), + tr( "ERROR_OF_SAVING" ) ); + } + else { //SUIT_Application::getDesktop()->setSelectionModes(ActorSelection); - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->SetSelectionMode(ActorSelection); - disconnect(mySelectionMgr, 0, this, 0); - disconnect(mySMESHGUI, 0, this, 0); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) ) + aViewWindow->SetSelectionMode( ActorSelection ); + disconnect( mySelectionMgr, 0, this, 0 ); + disconnect( mySMESHGUI, 0, this, 0 ); mySMESHGUI->ResetState(); accept(); emit NewPattern(); } - } catch (const SALOME::SALOME_Exception& S_ex) { - SalomeApp_Tools::QtCatchCorbaException(S_ex); - } catch (...) { + } + catch ( const SALOME::SALOME_Exception& S_ex ) { + SalomeApp_Tools::QtCatchCorbaException( S_ex ); + } + catch (...) { } } @@ -431,28 +451,31 @@ SMESH::SMESH_Pattern_ptr SMESHGUI_CreatePatternDlg::GetPattern() void SMESHGUI_CreatePatternDlg::onOk() { try { - if (!isValid()) + if ( !isValid() ) return; - if (!myIsLoaded) - loadFromObject(true); + if ( !myIsLoaded ) + loadFromObject( true ); // Load pattern from object - if (!myIsLoaded) { + if ( !myIsLoaded ) { return; - } else { + } + else { //SUIT_Application::getDesktop()->setSelectionModes(ActorSelection); - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->SetSelectionMode(ActorSelection); - disconnect(mySelectionMgr, 0, this, 0); - disconnect(mySMESHGUI, 0, this, 0); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) ) + aViewWindow->SetSelectionMode( ActorSelection ); + disconnect( mySelectionMgr, 0, this, 0 ); + disconnect( mySMESHGUI, 0, this, 0 ); mySMESHGUI->ResetState(); accept(); emit NewPattern(); } - } catch (const SALOME::SALOME_Exception& S_ex) { - SalomeApp_Tools::QtCatchCorbaException(S_ex); - } catch (...) { + } + catch ( const SALOME::SALOME_Exception& S_ex ) { + SalomeApp_Tools::QtCatchCorbaException( S_ex ); + } + catch (...) { } } @@ -462,10 +485,10 @@ void SMESHGUI_CreatePatternDlg::onOk() //======================================================================= void SMESHGUI_CreatePatternDlg::onClose() { - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->SetSelectionMode(ActorSelection); - disconnect(mySelectionMgr, 0, this, 0); - disconnect(mySMESHGUI, 0, this, 0); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) ) + aViewWindow->SetSelectionMode( ActorSelection ); + disconnect( mySelectionMgr, 0, this, 0 ); + disconnect( mySMESHGUI, 0, this, 0 ); mySMESHGUI->ResetState(); reject(); emit Close(); @@ -477,20 +500,22 @@ void SMESHGUI_CreatePatternDlg::onClose() //================================================================================= void SMESHGUI_CreatePatternDlg::onHelp() { - LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); - if (app) - app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); + LightApp_Application* app = (LightApp_Application*)( SUIT_Session::session()->activeApplication() ); + if ( app ) + app->onHelpContextModule( mySMESHGUI ? app->moduleName( mySMESHGUI->moduleName() ) : QString( "" ), myHelpFileName ); else { - QString platform; + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning( this, + tr( "WRN_WARNING" ), + tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ). + arg( app->resourceMgr()->stringValue( "ExternalBrowser", + platform ) ). + arg( myHelpFileName ) ); } } @@ -498,40 +523,40 @@ void SMESHGUI_CreatePatternDlg::onHelp() // function : loadFromObject() // purpose : Load pattern from geom object corresponding to the mesh/submesh //======================================================================= -bool SMESHGUI_CreatePatternDlg::loadFromObject (const bool theMess) +bool SMESHGUI_CreatePatternDlg::loadFromObject( const bool theMess ) { try { myIsLoaded = false; - if (myPattern->_is_nil()) + if ( myPattern->_is_nil() ) myPattern = SMESH::GetPattern(); - if (myMesh->_is_nil() && mySubMesh->_is_nil() || myGeomObj->_is_nil()) + if ( myMesh->_is_nil() && mySubMesh->_is_nil() || myGeomObj->_is_nil() ) return false; SMESH::SMESH_Mesh_ptr aMesh = mySubMesh->_is_nil() ? myMesh.in() : mySubMesh->GetFather(); myIsLoaded = myType == Type_2d - ? myPattern->LoadFromFace(aMesh, myGeomObj, myProjectChk->isChecked()) - : myPattern->LoadFrom3DBlock(aMesh, myGeomObj); + ? myPattern->LoadFromFace( aMesh, myGeomObj, myProjectChk->isChecked() ) + : myPattern->LoadFrom3DBlock( aMesh, myGeomObj ); - if (!myIsLoaded && theMess) { + if ( !myIsLoaded && theMess ) { QString aMess; SMESH::SMESH_Pattern::ErrorCode aCode = myPattern->GetErrorCode(); - if (aCode == SMESH::SMESH_Pattern::ERR_LOAD_EMPTY_SUBMESH ) aMess = tr("ERR_LOAD_EMPTY_SUBMESH"); - else if (aCode == SMESH::SMESH_Pattern::ERR_LOADF_NARROW_FACE ) aMess = tr("ERR_LOADF_NARROW_FACE"); - else if (aCode == SMESH::SMESH_Pattern::ERR_LOADF_CLOSED_FACE ) aMess = tr("ERR_LOADF_CLOSED_FACE"); - else if (aCode == SMESH::SMESH_Pattern::ERR_LOADF_CANT_PROJECT ) aMess = tr("ERR_LOADF_CANT_PROJECT"); - else if (aCode == SMESH::SMESH_Pattern::ERR_LOADV_BAD_SHAPE ) aMess = tr("ERR_LOADV_BAD_SHAPE"); - else if (aCode == SMESH::SMESH_Pattern::ERR_LOADV_COMPUTE_PARAMS) aMess = tr("ERR_LOADV_COMPUTE_PARAMS"); - else aMess = tr("ERROR_OF_CREATION"); + if ( aCode == SMESH::SMESH_Pattern::ERR_LOAD_EMPTY_SUBMESH ) aMess = tr( "ERR_LOAD_EMPTY_SUBMESH" ); + else if ( aCode == SMESH::SMESH_Pattern::ERR_LOADF_NARROW_FACE ) aMess = tr( "ERR_LOADF_NARROW_FACE" ); + else if ( aCode == SMESH::SMESH_Pattern::ERR_LOADF_CLOSED_FACE ) aMess = tr( "ERR_LOADF_CLOSED_FACE" ); + else if ( aCode == SMESH::SMESH_Pattern::ERR_LOADF_CANT_PROJECT ) aMess = tr( "ERR_LOADF_CANT_PROJECT" ); + else if ( aCode == SMESH::SMESH_Pattern::ERR_LOADV_BAD_SHAPE ) aMess = tr( "ERR_LOADV_BAD_SHAPE" ); + else if ( aCode == SMESH::SMESH_Pattern::ERR_LOADV_COMPUTE_PARAMS ) aMess = tr( "ERR_LOADV_COMPUTE_PARAMS" ); + else aMess = tr( "ERROR_OF_CREATION" ); - QMessageBox::information(SMESH::GetDesktop( mySMESHGUI ), - tr("SMESH_ERROR"), aMess, QMessageBox::Ok); + SUIT_MessageBox::information( this, tr( "SMESH_ERROR" ), aMess ); } - } catch (const SALOME::SALOME_Exception& S_ex) { - SalomeApp_Tools::QtCatchCorbaException(S_ex); + } + catch ( const SALOME::SALOME_Exception& S_ex ) { + SalomeApp_Tools::QtCatchCorbaException( S_ex ); } return myIsLoaded; @@ -545,48 +570,50 @@ void SMESHGUI_CreatePatternDlg::onSelectionDone() { try { SALOME_ListIO aList; - mySelectionMgr->selectedObjects(aList, SVTK_Viewer::Type()); - if (aList.Extent() != 1) + mySelectionMgr->selectedObjects( aList, SVTK_Viewer::Type() ); + if ( aList.Extent() != 1 ) return; // Get mesh or sub-mesh from selection Handle(SALOME_InteractiveObject) anIO = aList.First(); - SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface(anIO); - SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface(anIO); - if (aMesh->_is_nil() && aSubMesh->_is_nil()) + SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface( anIO ); + SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface( anIO ); + if ( aMesh->_is_nil() && aSubMesh->_is_nil() ) return; // Get geom object corresponding to the mesh _PTR(SObject) aSO; - if (!aMesh->_is_nil()) - aSO = SMESH::FindSObject(aMesh.in()); + if ( !aMesh->_is_nil() ) + aSO = SMESH::FindSObject( aMesh.in() ); else - aSO = SMESH::FindSObject(aSubMesh.in()); + aSO = SMESH::FindSObject( aSubMesh.in() ); - GEOM::GEOM_Object_var aGeomObj = SMESH::GetGeom(aSO); - if (aGeomObj->_is_nil()) + GEOM::GEOM_Object_var aGeomObj = SMESH::GetGeom( aSO ); + if ( aGeomObj->_is_nil() ) return; myGeomObj = aGeomObj; // init class fields - if (!aMesh->_is_nil()) { + if ( !aMesh->_is_nil() ) { myMesh = aMesh; mySubMesh = SMESH::SMESH_subMesh::_nil(); - } else { + } + else { mySubMesh = aSubMesh; myMesh = SMESH::SMESH_Mesh::_nil(); } QString aName; - SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aName); - myMeshEdit->setText(aName); + SMESH::GetNameOfSelectedIObjects( mySelectionMgr, aName ); + myMeshEdit->setText( aName ); - if (myType == Type_2d) { - loadFromObject(true); + if ( myType == Type_2d ) { + loadFromObject( true ); displayPreview(); } - } catch (...) { + } + catch (...) { myMesh = SMESH::SMESH_Mesh::_nil(); mySubMesh = SMESH::SMESH_subMesh::_nil(); myGeomObj = GEOM::GEOM_Object::_nil(); @@ -600,22 +627,22 @@ void SMESHGUI_CreatePatternDlg::onSelectionDone() //======================================================================= void SMESHGUI_CreatePatternDlg::onDeactivate() { - disconnect(mySelectionMgr, 0, this, 0); - setEnabled(false); + disconnect( mySelectionMgr, 0, this, 0 ); + setEnabled( false ); } //======================================================================= // function : enterEvent() // purpose : Event filter //======================================================================= -void SMESHGUI_CreatePatternDlg::enterEvent (QEvent*) +void SMESHGUI_CreatePatternDlg::enterEvent( QEvent* ) { // there is a stange problem that enterEvent() comes after onSave() if ( isVisible () ) { mySMESHGUI->EmitSignalDeactivateDialog(); - setEnabled(true); + setEnabled( true ); activateSelection(); - connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone())); + connect( mySelectionMgr, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) ); } } @@ -623,7 +650,7 @@ void SMESHGUI_CreatePatternDlg::enterEvent (QEvent*) // function : closeEvent() // purpose : Close dialog box //================================================================================= -void SMESHGUI_CreatePatternDlg::closeEvent (QCloseEvent*) +void SMESHGUI_CreatePatternDlg::closeEvent( QCloseEvent* ) { onClose(); } @@ -641,7 +668,7 @@ void SMESHGUI_CreatePatternDlg::onSelBtnClicked() // function : autoExtension() // purpose : Append extension to the file name //================================================================ -QString SMESHGUI_CreatePatternDlg::autoExtension (const QString& theFileName) const +QString SMESHGUI_CreatePatternDlg::autoExtension( const QString& theFileName ) const { QString anExt = theFileName.section('.', -1); return anExt != "smp" && anExt != "SMP" ? theFileName + ".smp" : theFileName; @@ -655,47 +682,50 @@ void SMESHGUI_CreatePatternDlg::displayPreview() { // Redisplay preview in dialog try { - if (!myIsLoaded) { + if ( !myIsLoaded ) { erasePreview(); - } else { + } + else { SMESH::point_array_var pnts = myPattern->GetPoints(); SMESH::long_array_var keyPoints = myPattern->GetKeyPoints(); - SMESH::array_of_long_array_var elemPoints = myPattern->GetElementPoints(false); + SMESH::array_of_long_array_var elemPoints = myPattern->GetElementPoints( false ); - if (pnts->length() == 0 || - keyPoints->length() == 0 || - elemPoints->length() == 0) { + if ( pnts->length() == 0 || + keyPoints->length() == 0 || + elemPoints->length() == 0 ) { myIsLoaded = false; erasePreview(); return; } - PointVector aPoints (pnts->length()); - QValueVector aKeyPoints (keyPoints->length()); - ConnectivityVector anElemPoints (elemPoints->length()); + PointVector aPoints( pnts->length() ); + QVector aKeyPoints( keyPoints->length() ); + ConnectivityVector anElemPoints( elemPoints->length() ); - for (int i = 0, n = pnts->length(); i < n; i++) + for ( int i = 0, n = pnts->length(); i < n; i++ ) aPoints[ i ] = pnts[ i ]; - for (int i2 = 0, n2 = keyPoints->length(); i2 < n2; i2++) + for ( int i2 = 0, n2 = keyPoints->length(); i2 < n2; i2++ ) aKeyPoints[ i2 ] = keyPoints[ i2 ]; for (int i3 = 0, n3 = elemPoints->length(); i3 < n3; i3++) { - QValueVector aVec (elemPoints[ i3 ].length()); + QVector aVec (elemPoints[ i3 ].length()); for (int i4 = 0, n4 = elemPoints[ i3 ].length(); i4 < n4; i4++) aVec[ i4 ] = elemPoints[ i3 ][ i4 ]; anElemPoints[ i3 ] = aVec; } - myPicture2d->SetPoints(aPoints, aKeyPoints, anElemPoints); + myPicture2d->SetPoints( aPoints, aKeyPoints, anElemPoints ); } return; - } catch (const SALOME::SALOME_Exception& S_ex) { - SalomeApp_Tools::QtCatchCorbaException(S_ex); - } catch (...) { + } + catch ( const SALOME::SALOME_Exception& S_ex ) { + SalomeApp_Tools::QtCatchCorbaException( S_ex ); + } + catch (...) { } erasePreview(); } @@ -707,7 +737,7 @@ void SMESHGUI_CreatePatternDlg::displayPreview() void SMESHGUI_CreatePatternDlg::erasePreview() { // Erase preview in 2D viewer - myPicture2d->SetPoints(PointVector(), QValueVector(), ConnectivityVector()); + myPicture2d->SetPoints( PointVector(), QVector(), ConnectivityVector() ); } //======================================================================= @@ -718,18 +748,25 @@ void SMESHGUI_CreatePatternDlg::activateSelection() { mySelectionMgr->clearFilters(); //SUIT_Application::getDesktop()->setSelectionModes(ActorSelection); - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->SetSelectionMode(ActorSelection); - - if (myType == Type_2d) { - mySelectionMgr->installFilter(new SMESH_NumberFilter - ("SMESH", TopAbs_SHAPE, -1, TopAbs_FACE)); - } else { + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) ) + aViewWindow->SetSelectionMode( ActorSelection ); + + if ( myType == Type_2d ) { + mySelectionMgr->installFilter( new SMESH_NumberFilter( "SMESH", + TopAbs_SHAPE, + -1, + TopAbs_FACE ) ); + } + else { TColStd_MapOfInteger aTypes; - aTypes.Add(TopAbs_SHELL); - aTypes.Add(TopAbs_SOLID); - mySelectionMgr->installFilter(new SMESH_NumberFilter - ("SMESH", TopAbs_FACE, 6, aTypes, GEOM::GEOM_Object::_nil(), true)); + aTypes.Add( TopAbs_SHELL ); + aTypes.Add( TopAbs_SOLID ); + mySelectionMgr->installFilter( new SMESH_NumberFilter( "SMESH", + TopAbs_FACE, + 6, + aTypes, + GEOM::GEOM_Object::_nil(), + true ) ); } } @@ -738,17 +775,15 @@ void SMESHGUI_CreatePatternDlg::activateSelection() // purpose : SLOT. Called when pattern type changed. // Change dialog's look and feel //======================================================================= -void SMESHGUI_CreatePatternDlg::onTypeChanged (int theType) +void SMESHGUI_CreatePatternDlg::onTypeChanged( int theType ) { - if (myType == theType) + if ( myType == theType ) return; myType = theType; - if (theType == Type_2d) - myPicture2d->show(); - else - myPicture2d->hide(); + myPicture2d->setVisible( theType == Type_2d ); + myProjectChk->setVisible( theType == Type_2d ); } //================================================================================= @@ -761,9 +796,8 @@ void SMESHGUI_CreatePatternDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) - { - e->accept(); - onHelp(); - } + if ( e->key() == Qt::Key_F1 ){ + e->accept(); + onHelp(); + } } diff --git a/src/SMESHGUI/SMESHGUI_CreatePatternDlg.h b/src/SMESHGUI/SMESHGUI_CreatePatternDlg.h index 130ad7e0d..8c585372b 100755 --- a/src/SMESHGUI/SMESHGUI_CreatePatternDlg.h +++ b/src/SMESHGUI/SMESHGUI_CreatePatternDlg.h @@ -1,57 +1,49 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_CreatePatternDlg.h +// Author : Sergey LITONIN, Open CASCADE S.A.S. // -// -// File : SMESHGUI_CreatePatternDlg.h -// Author : Sergey LITONIN -// Module : SMESH - -#ifndef SMESHGUI_CreatePatternDlg_H -#define SMESHGUI_CreatePatternDlg_H +#ifndef SMESHGUI_CREATEPATTERNDLG_H +#define SMESHGUI_CREATEPATTERNDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include +// Qt includes +#include -// IDL Headers +// IDL includes #include -#include CORBA_SERVER_HEADER(GEOM_Gen) #include CORBA_SERVER_HEADER(SMESH_Mesh) #include CORBA_SERVER_HEADER(SMESH_Pattern) class SMESHGUI_PatternWidget; class SALOMEDSClient_SObject; -class QCloseEvent; -class QFrame; class QLineEdit; -class SMESHGUI_SpinBox; -class QPushButton; -class LightApp_SelectionMgr; class QRadioButton; class QCheckBox; class QButtonGroup; -class QLabel; -class SVTK_ViewWindow; class SVTK_Selector; +class LightApp_SelectionMgr; class SMESHGUI; /*! @@ -67,29 +59,24 @@ public: enum { Type_2d, Type_3d }; public: - SMESHGUI_CreatePatternDlg( SMESHGUI*, - const int, - const char* = 0); - virtual ~SMESHGUI_CreatePatternDlg(); + SMESHGUI_CreatePatternDlg( SMESHGUI*, const int ); + virtual ~SMESHGUI_CreatePatternDlg(); - void Init(const int); + void Init( const int ); QString GetPatternName() const; SMESH::SMESH_Pattern_ptr GetPattern(); - void SetMesh (SMESH::SMESH_Mesh_ptr); + void SetMesh( SMESH::SMESH_Mesh_ptr ); signals: - void NewPattern(); void Close(); private: - - void closeEvent (QCloseEvent* e); - void enterEvent (QEvent*); - void keyPressEvent(QKeyEvent*); - + void closeEvent( QCloseEvent* ); + void enterEvent( QEvent* ); + void keyPressEvent( QKeyEvent* ); + private slots: - void onOk(); void onSave(); void onClose(); @@ -98,34 +85,26 @@ private slots: void onDeactivate(); void onSelectionDone(); - void onTypeChanged (int); - void onProject (bool); + void onTypeChanged( int ); + void onProject( bool ); void onSelBtnClicked(); private: - - QFrame* createButtonFrame (QWidget*); - QFrame* createMainFrame (QWidget*); + QWidget* createButtonFrame( QWidget* ); + QWidget* createMainFrame( QWidget* ); void displayPreview(); void erasePreview(); void activateSelection(); - QString autoExtension (const QString& theFileName) const; + QString autoExtension( const QString& ) const; bool isValid(); - bool loadFromObject (const bool = true); + bool loadFromObject( const bool = true ); QString getDefaultName() const; - GEOM::GEOM_Object_ptr getGeom (SALOMEDSClient_SObject*) const; + GEOM::GEOM_Object_ptr getGeom( SALOMEDSClient_SObject* ) const; private: - - QPushButton* myOkBtn; - QPushButton* mySaveBtn; - QPushButton* myCloseBtn; - QPushButton* myHelpBtn; - QButtonGroup* myTypeGrp; QRadioButton* mySwitch2d; QRadioButton* mySwitch3d; - QRadioButton* mySwitchSMESH_Pattern3d; QLineEdit* myMeshEdit; QLineEdit* myName; @@ -137,7 +116,6 @@ private: SMESHGUI* mySMESHGUI; SVTK_Selector* mySelector; LightApp_SelectionMgr* mySelectionMgr; - int myNbPoints; int myType; SMESH::SMESH_Mesh_var myMesh; @@ -150,4 +128,4 @@ private: QString myHelpFileName; }; -#endif +#endif // SMESHGUI_CREATEPATTERNDLG_H diff --git a/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx b/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx index 8e1e55c69..c3f65fdc2 100644 --- a/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx @@ -1,31 +1,29 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_CreatePolyhedralVolumeDlg.cxx +// Author : Michael ZORIN, Open CASCADE S.A.S. // -// -// File : SMESHGUI_CreatePolyhedralVolumeDlg.cxx -// Author : Michael ZORIN -// Module : SMESH -// $Header: +// SMESH includes #include "SMESHGUI_CreatePolyhedralVolumeDlg.h" #include "SMESHGUI.h" @@ -33,64 +31,60 @@ #include "SMESHGUI_VTKUtils.h" #include "SMESHGUI_MeshUtils.h" #include "SMESHGUI_IdValidator.h" -#include "SMESH_ActorUtils.h" -#include "SMESHGUI_SpinBox.h" -#include "SMESH_Actor.h" -#include "SMESH_TypeFilter.hxx" -#include "SMDS_Mesh.hxx" - -#include "SUIT_ResourceMgr.h" -#include "SUIT_Session.h" -#include "SUIT_MessageBox.h" - -#include "SalomeApp_Application.h" -#include "SalomeApp_Study.h" -#include "SUIT_Desktop.h" -#include "SUIT_MessageBox.h" -#include "LightApp_Application.h" -#include "LightApp_SelectionMgr.h" -#include "utilities.h" - -#include "SVTK_ViewWindow.h" -#include "SVTK_Selector.h" - -#include + +#include +#include +#include + +// SALOME GUI includes +#include +#include +#include +#include +#include + +#include +#include + +#include + +// OCCT includes #include #include +// VTK includes #include #include -#include -#include -#include #include #include #include -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// IDL Headers -#include "SALOMEconfig.h" -#include CORBA_SERVER_HEADER(SMESH_Group) +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// IDL includes +#include #include CORBA_SERVER_HEADER(SMESH_MeshEditor) -using namespace std; - -namespace SMESH{ +#define SPACING 6 +#define MARGIN 11 -class TPolySimulation{ +namespace SMESH +{ + class TPolySimulation + { SVTK_ViewWindow* myViewWindow; SALOME_Actor *myPreviewActor; @@ -171,8 +165,8 @@ class TPolySimulation{ ~TPolySimulation(){ - if( myViewWindow ) - myViewWindow->RemoveActor(myPreviewActor); + if( myViewWindow ) + myViewWindow->RemoveActor(myPreviewActor); myPreviewActor->Delete(); @@ -189,141 +183,102 @@ class TPolySimulation{ // class : SMESHGUI_CreatePolyhedralVolumeDlgDlg() // purpose : //================================================================================= -SMESHGUI_CreatePolyhedralVolumeDlg::SMESHGUI_CreatePolyhedralVolumeDlg( SMESHGUI* theModule, const char* name, - bool modal, WFlags fl ) - : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose), +SMESHGUI_CreatePolyhedralVolumeDlg::SMESHGUI_CreatePolyhedralVolumeDlg( SMESHGUI* theModule ) + : QDialog( SMESH::GetDesktop( theModule ) ), mySMESHGUI( theModule ), mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) { QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH",tr("ICON_SELECT"))); - if ( !name ) - setName( "SMESHGUI_CreatePolyhedralVolumeDlg" ); - resize( 300, 185 ); - setCaption( tr( "SMESH_CREATE_POLYHEDRAL_VOLUME_TITLE" ) ); - setSizeGripEnabled( TRUE ); - SMESHGUI_CreatePolyhedralVolumeDlgLayout = new QGridLayout( this ); - SMESHGUI_CreatePolyhedralVolumeDlgLayout->setSpacing( 6 ); - SMESHGUI_CreatePolyhedralVolumeDlgLayout->setMargin( 11 ); + setModal(false); + setAttribute(Qt::WA_DeleteOnClose, true); + setWindowTitle( tr( "SMESH_CREATE_POLYHEDRAL_VOLUME_TITLE" ) ); + setSizeGripEnabled( true ); - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, GroupConstructors->sizePolicy().hasHeightForWidth() ) ); - GroupConstructors->setTitle( tr( "SMESH_ELEMENTS_TYPE" ) ); - GroupConstructors->setExclusive( TRUE ); - GroupConstructors->setColumnLayout(0, Qt::Vertical ); - GroupConstructors->layout()->setSpacing( 0 ); - GroupConstructors->layout()->setMargin( 0 ); - GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); - GroupConstructorsLayout->setAlignment( Qt::AlignTop ); - GroupConstructorsLayout->setSpacing( 6 ); - GroupConstructorsLayout->setMargin( 11 ); - RadioButton1= new QRadioButton( GroupConstructors, "RadioButton1" ); - RadioButton1->setText( tr( "MESH_NODE" ) ); - GroupConstructorsLayout->addWidget( RadioButton1, 0, 0 ); - RadioButton2= new QRadioButton( GroupConstructors, "RadioButton2" ); - RadioButton2->setText( tr( "SMESH_FACE" ) ); - GroupConstructorsLayout->addWidget( RadioButton2, 0, 2 ); - SMESHGUI_CreatePolyhedralVolumeDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupButtons = new QGroupBox( this, "GroupButtons" ); - GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth() ) ); - GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); - GroupButtons->setTitle( tr( "" ) ); - GroupButtons->setColumnLayout(0, Qt::Vertical ); - GroupButtons->layout()->setSpacing( 0 ); - GroupButtons->layout()->setMargin( 0 ); - GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); - GroupButtonsLayout->setAlignment( Qt::AlignTop ); - GroupButtonsLayout->setSpacing( 6 ); - GroupButtonsLayout->setMargin( 11 ); - buttonCancel = new QPushButton( GroupButtons, "cancel" ); - buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) ); - buttonCancel->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); - buttonApply = new QPushButton( GroupButtons, "apply" ); - buttonApply->setText( tr( "SMESH_BUT_APPLY" ) ); - buttonApply->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); - QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_9, 0, 2 ); - buttonOk = new QPushButton( GroupButtons, "ok" ); - buttonOk->setText( tr( "SMESH_BUT_OK" ) ); - buttonOk->setAutoDefault( TRUE ); - buttonOk->setDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); - buttonHelp = new QPushButton(GroupButtons, "buttonHelp"); - buttonHelp->setText(tr("SMESH_BUT_HELP" )); - buttonHelp->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonHelp, 0, 4); - - SMESHGUI_CreatePolyhedralVolumeDlgLayout->addWidget( GroupButtons, 2, 0 ); + QVBoxLayout* topLayout = new QVBoxLayout( this ); + topLayout->setSpacing( SPACING ); + topLayout->setMargin( MARGIN ); /***************************************************************/ - GroupContent = new QGroupBox( this, "GroupContent" ); - GroupContent->setTitle( tr( "SMESH_CONTENT" ) ); - GroupContent->setColumnLayout(0, Qt::Vertical ); - GroupContent->layout()->setSpacing( 0 ); - GroupContent->layout()->setMargin( 0 ); - GroupContentLayout = new QGridLayout( GroupContent->layout() ); - GroupContentLayout->setAlignment( Qt::AlignTop ); - GroupContentLayout->setSpacing( 6 ); - GroupContentLayout->setMargin( 11 ); - - QFrame* anIds = new QFrame(GroupContent, "anIds"); - QGridLayout* aLayout = new QGridLayout(anIds, 1, 3); - aLayout->setSpacing(6); - aLayout->setAutoAdd(false); + ConstructorsBox = new QGroupBox(tr( "SMESH_ELEMENTS_TYPE" ), this); + GroupConstructors = new QButtonGroup(this); + QHBoxLayout* ConstructorsBoxLayout = new QHBoxLayout( ConstructorsBox ); + ConstructorsBoxLayout->setSpacing( SPACING ); + ConstructorsBoxLayout->setMargin( MARGIN ); + + RadioButton1 = new QRadioButton( tr( "MESH_NODE" ), ConstructorsBox ); + RadioButton2 = new QRadioButton( tr( "SMESH_FACE" ), ConstructorsBox ); + + ConstructorsBoxLayout->addWidget( RadioButton1 ); + ConstructorsBoxLayout->addWidget( RadioButton2 ); + GroupConstructors->addButton(RadioButton1, 0); + GroupConstructors->addButton(RadioButton2, 1); - TextLabelIds = new QLabel( anIds, "TextLabelIds" ); - TextLabelIds->setText( tr( "SMESH_ID_NODES" ) ); - TextLabelIds->setFixedWidth(74); - aLayout->addWidget( TextLabelIds, 0, 0 ); - - SelectElementsButton = new QPushButton( anIds, "SelectElementsButton" ); - SelectElementsButton->setText( tr( "" ) ); - SelectElementsButton->setPixmap( image0 ); - SelectElementsButton->setToggleButton( FALSE ); - aLayout->addWidget( SelectElementsButton, 0, 1 ); - - LineEditElements = new QLineEdit( anIds, "LineEditElements" ); - LineEditElements->setValidator( new SMESHGUI_IdValidator( this, "validator" )); - aLayout->addWidget( LineEditElements, 0, 2 ); + /***************************************************************/ + GroupContent = new QGroupBox( tr( "SMESH_CONTENT" ), this ); + QGridLayout* GroupContentLayout = new QGridLayout( GroupContent ); + GroupContentLayout->setSpacing( SPACING ); + GroupContentLayout->setMargin( MARGIN ); - GroupContentLayout->addMultiCellWidget(anIds, 0, 0, 0, 1); - - myFacesByNodesLabel = new QLabel(GroupContent, "faces by nodes label"); - myFacesByNodesLabel->setText(tr("FACES_BY_NODES")); - GroupContentLayout->addWidget( myFacesByNodesLabel, 1, 0 ); - - myFacesByNodes = new QListBox(GroupContent, "faces by nodes list"); - myFacesByNodes->setSelectionMode(QListBox::Extended); - myFacesByNodes->setMinimumHeight(150); - GroupContentLayout->addMultiCellWidget( myFacesByNodes, 2, 4, 0, 0 ); + TextLabelIds = new QLabel( tr( "SMESH_ID_NODES" ), GroupContent ); + SelectElementsButton = new QPushButton( GroupContent ); + SelectElementsButton->setIcon( image0 ); + LineEditElements = new QLineEdit( GroupContent ); + LineEditElements->setValidator( new SMESHGUI_IdValidator( this ) ); + + myFacesByNodesLabel = new QLabel( tr( "FACES_BY_NODES" ), GroupContent ); + myFacesByNodes = new QListWidget( GroupContent); + myFacesByNodes->setSelectionMode( QListWidget::ExtendedSelection ); + myFacesByNodes->setMinimumHeight( 150); + + AddButton = new QPushButton( tr( "SMESH_BUT_ADD" ), GroupContent ); + RemoveButton = new QPushButton( tr( "SMESH_BUT_REMOVE" ), GroupContent ); + + Preview = new QCheckBox( tr( "SMESH_POLYEDRE_PREVIEW" ), GroupContent ); + + GroupContentLayout->addWidget( TextLabelIds, 0, 0 ); + GroupContentLayout->addWidget( SelectElementsButton, 0, 1 ); + GroupContentLayout->addWidget( LineEditElements, 0, 2, 1, 2 ); + GroupContentLayout->addWidget( myFacesByNodesLabel, 1, 0 ); + GroupContentLayout->addWidget( myFacesByNodes, 2, 0, 3, 3 ); + GroupContentLayout->addWidget( AddButton, 2, 3 ); + GroupContentLayout->addWidget( RemoveButton, 3, 3 ); + GroupContentLayout->addWidget( Preview, 5, 0, 1, 4 ); - AddButton = new QPushButton(GroupContent, "add"); - AddButton->setText(tr("SMESH_BUT_ADD")); - AddButton->setMaximumWidth(85); - GroupContentLayout->addWidget( AddButton, 2, 1 ); - - RemoveButton = new QPushButton(GroupContent, "remove"); - RemoveButton->setText(tr("SMESH_BUT_REMOVE")); - RemoveButton->setMaximumWidth(85); - GroupContentLayout->addWidget( RemoveButton, 3, 1 ); - - Preview = new QCheckBox( GroupContent, "Preview" ); - Preview->setText( tr( "SMESH_POLYEDRE_PREVIEW" ) ); - GroupContentLayout->addWidget( Preview , 5, 0 ); + /***************************************************************/ + GroupButtons = new QGroupBox( this ); + QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons ); + GroupButtonsLayout->setSpacing( SPACING ); + GroupButtonsLayout->setMargin( MARGIN ); + + buttonOk = new QPushButton( tr( "SMESH_BUT_OK" ), GroupButtons ); + buttonOk->setAutoDefault( true ); + buttonOk->setDefault( true ); + buttonApply = new QPushButton( tr( "SMESH_BUT_APPLY" ), GroupButtons ); + buttonApply->setAutoDefault( true ); + buttonCancel = new QPushButton( tr( "SMESH_BUT_CLOSE" ), GroupButtons ); + buttonCancel->setAutoDefault( true ); + buttonHelp = new QPushButton( tr("SMESH_BUT_HELP" ), GroupButtons ); + buttonHelp->setAutoDefault(true); + + GroupButtonsLayout->addWidget( buttonOk ); + GroupButtonsLayout->addSpacing( 10 ); + GroupButtonsLayout->addWidget( buttonApply ); + GroupButtonsLayout->addSpacing( 10 ); + GroupButtonsLayout->addStretch(); + GroupButtonsLayout->addWidget( buttonCancel ); + GroupButtonsLayout->addWidget( buttonHelp); - mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); + /***************************************************************/ + topLayout->addWidget( ConstructorsBox ); + topLayout->addWidget( GroupContent ); + topLayout->addWidget( GroupButtons ); - SMESHGUI_CreatePolyhedralVolumeDlgLayout->addWidget( GroupContent, 1, 0 ); + mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); - GroupContent->show(); - RadioButton1->setChecked( TRUE ); + RadioButton1->setChecked( true ); - mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ; + mySMESHGUI->SetActiveDialogBox( (QDialog*)this ); myHelpFileName = "adding_nodes_and_elements_page.html#adding_polyhedrons_anchor"; @@ -336,11 +291,11 @@ SMESHGUI_CreatePolyhedralVolumeDlg::SMESHGUI_CreatePolyhedralVolumeDlg( SMESHGUI //================================================================================= SMESHGUI_CreatePolyhedralVolumeDlg::~SMESHGUI_CreatePolyhedralVolumeDlg() { - // no need to delete child widgets, Qt does it all for us delete mySimulation; } static bool busy = false; + //================================================================================= // function : Init() // purpose : @@ -348,7 +303,7 @@ static bool busy = false; void SMESHGUI_CreatePolyhedralVolumeDlg::Init() { myEditCurrentArgument = LineEditElements; - mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ; + mySMESHGUI->SetActiveDialogBox( (QDialog*)this ); myNbOkElements = 0; myActor = 0; @@ -356,27 +311,25 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::Init() mySimulation = new SMESH::TPolySimulation( dynamic_cast( mySMESHGUI->application() ) ); /* signals and slots connections */ - connect(buttonOk, SIGNAL( clicked() ), SLOT( ClickOnOk() ) ); - connect(buttonCancel, SIGNAL( clicked() ), SLOT( ClickOnCancel() ) ) ; - connect(buttonApply, SIGNAL( clicked() ), SLOT(ClickOnApply() ) ); - connect(buttonHelp, SIGNAL(clicked()), SLOT(ClickOnHelp() ) ); + connect(buttonOk, SIGNAL( clicked() ), SLOT( ClickOnOk() ) ); + connect(buttonCancel, SIGNAL( clicked() ), SLOT( ClickOnCancel() ) ); + connect(buttonApply, SIGNAL( clicked() ), SLOT( ClickOnApply() ) ); + connect(buttonHelp, SIGNAL( clicked() ), SLOT( ClickOnHelp() ) ); - connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); - connect(SelectElementsButton, SIGNAL( clicked() ), SLOT( SetEditCurrentArgument() ) ) ; + connect(GroupConstructors, SIGNAL(buttonClicked(int) ), SLOT( ConstructorsClicked(int) ) ); + connect(SelectElementsButton, SIGNAL( clicked() ), SLOT( SetEditCurrentArgument() ) ); connect(LineEditElements, SIGNAL( textChanged(const QString&) ), SLOT(onTextChange(const QString&))); connect(myFacesByNodes, SIGNAL(selectionChanged()), this, SLOT(onListSelectionChanged())); connect(AddButton, SIGNAL(clicked()), this, SLOT(onAdd())); connect(RemoveButton, SIGNAL(clicked()), this, SLOT(onRemove())); - connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; + connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ); connect( mySelectionMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); connect( Preview, SIGNAL(toggled(bool)), this, SLOT(ClickOnPreview(bool))); /* to close dialog if study change */ - connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; + connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ); - this->show() ; /* displays Dialog */ - ConstructorsClicked(0); SelectionIntoArgument(); } @@ -445,6 +398,10 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::ConstructorsClicked(int constructorId) //connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); mySelectionMgr->setSelectedObjects( io ); + + QApplication::instance()->processEvents(); + updateGeometry(); + resize( minimumSize() ); } //================================================================================= @@ -475,15 +432,13 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnApply() TColStd_ListOfInteger aNodesIds; - QListBoxItem* anItem; int aNbQuantities = 0; - for (anItem = myFacesByNodes->firstItem(); anItem != 0; anItem = anItem->next()) { - QStringList anIds = QStringList::split(" ", anItem->text()); - int aNbNodesInFace = 0; - for (QStringList::iterator it = anIds.begin(); it != anIds.end(); ++it, ++aNbNodesInFace) + for (int i = 0; i < myFacesByNodes->count(); i++ ) { + QStringList anIds = myFacesByNodes->item(i)->text().split( " ", QString::SkipEmptyParts ); + for (QStringList::iterator it = anIds.begin(); it != anIds.end(); ++it) aNodesIds.Append( (*it).toInt() ); - aQuantities[aNbQuantities++] = aNbNodesInFace; + aQuantities[aNbQuantities++] = anIds.count(); } anIdsOfNodes->length(aNodesIds.Extent()); @@ -491,12 +446,12 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnApply() int aNbIdsOfNodes = 0; TColStd_ListIteratorOfListOfInteger It; It.Initialize(aNodesIds); - for(;It.More();It.Next()) + for( ;It.More();It.Next()) anIdsOfNodes[aNbIdsOfNodes++] = It.Value(); try{ SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); - QApplication::setOverrideCursor(Qt::waitCursor); + QApplication::setOverrideCursor(Qt::WaitCursor); aMeshEditor->AddPolyhedralVolume(anIdsOfNodes, aQuantities); QApplication::restoreOverrideCursor(); }catch(SALOME::SALOME_Exception& exc){ @@ -511,14 +466,14 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnApply() { SMESH::long_array_var anIdsOfFaces = new SMESH::long_array; - QStringList aListId = QStringList::split( " ", myEditCurrentArgument->text() ); + QStringList aListId = myEditCurrentArgument->text().split( " ", QString::SkipEmptyParts ); anIdsOfFaces->length(aListId.count()); for ( int i = 0; i < aListId.count(); i++ ) anIdsOfFaces[i] = aListId[i].toInt(); try{ SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); - QApplication::setOverrideCursor(Qt::waitCursor); + QApplication::setOverrideCursor(Qt::WaitCursor); aMeshEditor->AddPolyhedralVolumeByFaces(anIdsOfFaces); QApplication::restoreOverrideCursor(); }catch(SALOME::SALOME_Exception& exc){ @@ -549,8 +504,8 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnApply() void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnOk() { if(checkEditLine(false) == -1) {return;} - ClickOnApply() ; - ClickOnCancel() ; + ClickOnApply(); + ClickOnCancel(); } @@ -568,8 +523,8 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnCancel() if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->SetSelectionMode( ActorSelection ); disconnect( mySelectionMgr, 0, this, 0 ); - mySMESHGUI->ResetState() ; - reject() ; + mySMESHGUI->ResetState(); + reject(); } //================================================================================= @@ -582,16 +537,17 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnHelp() if (app) app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); else { - QString platform; + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName)); } } @@ -613,70 +569,70 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::onTextChange(const QString& theNewText) aMesh = myActor->GetObject()->GetMesh(); if (GetConstructorId() == 0) - { - if ( aMesh ) { - TColStd_MapOfInteger newIndices; + { + if ( aMesh ) { + TColStd_MapOfInteger newIndices; - QStringList aListId = QStringList::split( " ", theNewText, false); - for ( int i = 0; i < aListId.count(); i++ ) { - const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ); - if ( n ) { - newIndices.Add(n->GetID()); - myNbOkElements++; - } - } + QStringList aListId = theNewText.split( " ", QString::SkipEmptyParts ); + for ( int i = 0; i < aListId.count(); i++ ) { + const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ); + if ( n ) { + newIndices.Add(n->GetID()); + myNbOkElements++; + } + } - mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false ); + mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false ); - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->highlight( myActor->getIO(), true, true ); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->highlight( myActor->getIO(), true, true ); - if ( myNbOkElements>0 && aListId.count()>=3) - AddButton->setEnabled(true); - else - AddButton->setEnabled(false); + if ( myNbOkElements>0 && aListId.count()>=3) + AddButton->setEnabled(true); + else + AddButton->setEnabled(false); - displaySimulation(); - } - } else if (GetConstructorId() == 1) - { - myNbOkElements = 0; - buttonOk->setEnabled( false ); - buttonApply->setEnabled( false ); + displaySimulation(); + } + } else if (GetConstructorId() == 1) + { + myNbOkElements = 0; + buttonOk->setEnabled( false ); + buttonApply->setEnabled( false ); - // check entered ids of faces and hilight them - QStringList aListId; - if ( aMesh ) { - TColStd_MapOfInteger newIndices; + // check entered ids of faces and hilight them + QStringList aListId; + if ( aMesh ) { + TColStd_MapOfInteger newIndices; - aListId = QStringList::split( " ", theNewText, false); + aListId = theNewText.split( " ", QString::SkipEmptyParts ); - for ( int i = 0; i < aListId.count(); i++ ) { - const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() ); - if ( e ) { - newIndices.Add(e->GetID()); - myNbOkElements++; - } - } + for ( int i = 0; i < aListId.count(); i++ ) { + const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() ); + if ( e ) { + newIndices.Add(e->GetID()); + myNbOkElements++; + } + } - mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false ); - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->highlight( myActor->getIO(), true, true ); + mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false ); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->highlight( myActor->getIO(), true, true ); - if ( myNbOkElements ) { - if (aListId.count()>1){ - buttonOk->setEnabled( true ); - buttonApply->setEnabled( true ); - } - else{ - buttonOk->setEnabled( false ); - buttonApply->setEnabled( false ); + if ( myNbOkElements ) { + if (aListId.count()>1){ + buttonOk->setEnabled( true ); + buttonApply->setEnabled( true ); + } + else{ + buttonOk->setEnabled( false ); + buttonApply->setEnabled( false ); + } + if(aListId.count()>1) + displaySimulation(); + } } - if(aListId.count()>1) - displaySimulation(); } - } - } busy = false; } @@ -788,18 +744,15 @@ int SMESHGUI_CreatePolyhedralVolumeDlg::checkEditLine(bool checkLast) // checking for nodes if (checkLast && myEditCurrentArgument->text().right(1) != QString(" ") ) return 1; - QStringList aListId = QStringList::split( " ", myEditCurrentArgument->text() ); + QStringList aListId = myEditCurrentArgument->text().split( " ", QString::SkipEmptyParts ); for ( int i = 0; i < aListId.count(); i++ ){ switch (GetConstructorId()){ case 0:{ // nodes const SMDS_MeshNode * aNode = aMesh->FindNode( aListId[ i ].toInt() ); if( !aNode ){ - std::string aWarning; - aWarning = "The incorrect indices of nodes!"; - SUIT_MessageBox::warn1(SMESHGUI::desktop(), - QObject::tr("SMESH_POLYEDRE_CREATE_ERROR"), - QObject::tr(aWarning.c_str()), - QObject::tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(this, + tr("SMESH_POLYEDRE_CREATE_ERROR"), + tr("The incorrect indices of nodes!")); myEditCurrentArgument->clear(); myEditCurrentArgument->setText( aString ); @@ -823,12 +776,9 @@ int SMESHGUI_CreatePolyhedralVolumeDlg::checkEditLine(bool checkLast) } } if (!aElemIsOK){ - std::string aWarning; - aWarning = "The incorrect indices of faces!"; - SUIT_MessageBox::warn1(SMESHGUI::desktop(), - QObject::tr("SMESH_POLYEDRE_CREATE_ERROR"), - QObject::tr(aWarning.c_str()), - QObject::tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(this, + tr("SMESH_POLYEDRE_CREATE_ERROR"), + tr("The incorrect indices of faces!")); myEditCurrentArgument->clear(); myEditCurrentArgument->setText( aString ); @@ -852,22 +802,21 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::displaySimulation() if ( (myNbOkElements || AddButton->isEnabled()) && GroupButtons->isEnabled() && myActor) { SMESH::TPolySimulation::TVTKIds aVTKIds; - vtkIdType aType = VTK_CONVEX_POINT_SET ; + vtkIdType aType = VTK_CONVEX_POINT_SET; SMDS_Mesh* aMesh = 0; if ( myActor ){ aMesh = myActor->GetObject()->GetMesh(); } if (GetConstructorId() == 0 && aMesh){ if (!AddButton->isEnabled()){ - QListBoxItem* anItem; mySimulation->ResetGrid(true); - for (anItem = myFacesByNodes->firstItem(); anItem != 0; anItem = anItem->next()) { - QStringList anIds = QStringList::split(" ", anItem->text()); + for (int i = 0; i < myFacesByNodes->count(); i++) { + QStringList anIds = myFacesByNodes->item(i)->text().split( " ", QString::SkipEmptyParts ); SMESH::TPolySimulation::TVTKIds aVTKIds_faces; for (QStringList::iterator it = anIds.begin(); it != anIds.end(); ++it){ - const SMDS_MeshNode * aNode = aMesh->FindNode( (*it).toInt() ); + const SMDS_MeshNode* aNode = aMesh->FindNode( (*it).toInt() ); if (!aNode) continue; - vtkIdType aId = myActor->GetObject()->GetNodeVTKId( (*it).toInt() ) ; + vtkIdType aId = myActor->GetObject()->GetNodeVTKId( (*it).toInt() ); aVTKIds.push_back(aId); aVTKIds_faces.push_back(aId); } @@ -886,14 +835,14 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::displaySimulation() } } else { // add ids from edit line - QStringList anEditIds = QStringList::split( " ", myEditCurrentArgument->text(), false); + QStringList anEditIds = myEditCurrentArgument->text().split( " ", QString::SkipEmptyParts ); for ( int i = 0; i < anEditIds.count(); i++ ) aVTKIds.push_back( myActor->GetObject()->GetNodeVTKId( anEditIds[ i ].toInt() )); aType = VTK_POLYGON; mySimulation->SetPosition(myActor, aType, aVTKIds); } }else if(GetConstructorId() == 1 && aMesh){ - QStringList aListId = QStringList::split( " ", myEditCurrentArgument->text(), false); + QStringList aListId = myEditCurrentArgument->text().split( " ", QString::SkipEmptyParts ); for ( int i = 0; i < aListId.count(); i++ ) { const SMDS_MeshElement * anElem = aMesh->FindElement( aListId[ i ].toInt() ); @@ -904,11 +853,11 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::displaySimulation() SMDS_ElemIteratorPtr anIter = anElem->nodesIterator(); SMESH::TPolySimulation::TVTKIds aVTKIds_faces; while( anIter->more() ) - if ( const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next() ){ - vtkIdType aId = myActor->GetObject()->GetNodeVTKId( aNode->GetID() ) ; - aVTKIds.push_back(aId); - aVTKIds_faces.push_back(aId); - } + if ( const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next() ){ + vtkIdType aId = myActor->GetObject()->GetNodeVTKId( aNode->GetID() ); + aVTKIds.push_back(aId); + aVTKIds_faces.push_back(aId); + } if(!Preview->isChecked()){ aType = VTK_POLYGON; mySimulation->SetPosition(myActor, aType, aVTKIds_faces); @@ -929,7 +878,7 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); if(send == SelectElementsButton) { - LineEditElements->setFocus() ; + LineEditElements->setFocus(); myEditCurrentArgument = LineEditElements; } SelectionIntoArgument(); @@ -941,13 +890,13 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::SetEditCurrentArgument() //================================================================================= void SMESHGUI_CreatePolyhedralVolumeDlg::DeactivateActiveDialog() { - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupContent->setEnabled(false) ; - GroupButtons->setEnabled(false) ; + if ( ConstructorsBox->isEnabled() ) { + ConstructorsBox->setEnabled(false); + GroupContent->setEnabled(false); + GroupButtons->setEnabled(false); mySimulation->SetVisibility(false); - mySMESHGUI->ResetState() ; - mySMESHGUI->SetActiveDialogBox(0) ; + mySMESHGUI->ResetState(); + mySMESHGUI->SetActiveDialogBox(0); } } @@ -959,12 +908,12 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::DeactivateActiveDialog() void SMESHGUI_CreatePolyhedralVolumeDlg::ActivateThisDialog() { /* Emit a signal to deactivate the active dialog */ - mySMESHGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupContent->setEnabled(true) ; - GroupButtons->setEnabled(true) ; + mySMESHGUI->EmitSignalDeactivateDialog(); + ConstructorsBox->setEnabled(true); + GroupContent->setEnabled(true); + GroupButtons->setEnabled(true); - mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ; + mySMESHGUI->SetActiveDialogBox( (QDialog*)this ); if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->SetSelectionMode( FaceSelection ); @@ -978,9 +927,9 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::ActivateThisDialog() //================================================================================= void SMESHGUI_CreatePolyhedralVolumeDlg::enterEvent(QEvent* e) { - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; + if ( ConstructorsBox->isEnabled() ) + return; + ActivateThisDialog(); } @@ -991,7 +940,7 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::enterEvent(QEvent* e) void SMESHGUI_CreatePolyhedralVolumeDlg::closeEvent( QCloseEvent* e ) { /* same than click on cancel button */ - this->ClickOnCancel() ; + ClickOnCancel(); } @@ -1013,9 +962,7 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::hideEvent ( QHideEvent * e ) //================================================================================= int SMESHGUI_CreatePolyhedralVolumeDlg::GetConstructorId() { - if ( GroupConstructors != NULL && GroupConstructors->selected() != NULL ) - return GroupConstructors->id( GroupConstructors->selected() ); - return -1; + return GroupConstructors->checkedId(); } //================================================================================= @@ -1029,12 +976,12 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::onAdd() int aNbSel = selected.Extent(); if (aNbSel == 0 || !myActor || myMesh->_is_nil()) return; - if (this->checkEditLine(false) == -1) return; + if (checkEditLine(false) == -1) return; busy = true; if ( !(myEditCurrentArgument->text().isEmpty()) ) { - myFacesByNodes->insertItem(myEditCurrentArgument->text()); + myFacesByNodes->addItem(myEditCurrentArgument->text()); //myFacesByNodes->setSelected(myFacesByNodes->count() - 1, true); myNbOkElements = 1; myEditCurrentArgument->clear(); @@ -1054,21 +1001,18 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::onAdd() void SMESHGUI_CreatePolyhedralVolumeDlg::onRemove() { busy = true; - for (int i = myFacesByNodes->count(); i > 0; i--) { - if (myFacesByNodes->isSelected(i-1)) { - myFacesByNodes->removeItem(i-1); - myNbOkElements = 1; - } - } - if (myFacesByNodes->count() < 1){ - RemoveButton->setEnabled(false); - buttonOk->setEnabled( false ); - buttonApply->setEnabled( false ); - } - else if (myFacesByNodes->count() == 1){ - buttonOk->setEnabled( false ); - buttonApply->setEnabled( false ); - } + QList selItems = myFacesByNodes->selectedItems(); + QListWidgetItem* anItem; + + if ( selItems.count() > 0 ) myNbOkElements = 1; + + foreach( anItem, selItems ) + delete anItem; + + RemoveButton->setEnabled( myFacesByNodes->count() > 0 ); + buttonOk->setEnabled( myFacesByNodes->count() > 1 ); + buttonApply->setEnabled( myFacesByNodes->count() > 1 ); + busy = false; displaySimulation(); } @@ -1081,21 +1025,19 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::onListSelectionChanged() { if (busy || !myActor) return; busy = true; - bool isSelected=false; + SALOME_ListIO aList; mySelectionMgr->setSelectedObjects( aList ); TColStd_MapOfInteger aIndexes; - QListBoxItem* anItem; - for (anItem = myFacesByNodes->firstItem(); anItem != 0; anItem = anItem->next()) { - if (anItem->isSelected()) { - isSelected = true; - QStringList anIds = QStringList::split(" ", anItem->text()); - for (QStringList::iterator it = anIds.begin(); it != anIds.end(); ++it) - aIndexes.Add((*it).toInt()); - } + + QList selItems = myFacesByNodes->selectedItems(); + QListWidgetItem* anItem; + foreach( anItem, selItems ) { + QStringList anIds = anItem->text().split( " ", QString::SkipEmptyParts ); + for (QStringList::iterator it = anIds.begin(); it != anIds.end(); ++it) + aIndexes.Add((*it).toInt()); } - if(isSelected) RemoveButton->setEnabled(true); - else RemoveButton->setEnabled(false); + RemoveButton->setEnabled(selItems.count() > 0); mySelector->AddOrRemoveIndex(myActor->getIO(), aIndexes, true ); if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->highlight( myActor->getIO(), true, true ); @@ -1116,9 +1058,8 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) - { - e->accept(); - ClickOnHelp(); - } + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + ClickOnHelp(); + } } diff --git a/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.h b/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.h index 4cba1e9a0..2fa1e8417 100644 --- a/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.h +++ b/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.h @@ -1,43 +1,44 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_CreatePolyhedralVolumeDlg.h +// Author : Michael ZORIN, Open CASCADE S.A.S. // -// -// File : SMESHGUI_CreatePolyhedralVolumeDlg.h -// Author : Michael ZORIN -// Module : SMESH -// $Header: -#ifndef DIALOGBOX_CREATEPOLYHEDRAL_H -#define DIALOGBOX_CREATEPOLYHEDRAL_H +#ifndef SMESHGUI_CREATEPOLYHEDRALVOLUMEDLG_H +#define SMESHGUI_CREATEPOLYHEDRALVOLUMEDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -// QT Includes -#include +// Qt includes +#include + +// IDL includes +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) -class QGridLayout; class QButtonGroup; class QGroupBox; -class QListBox; +class QListWidget; class QLabel; class QLineEdit; class QPushButton; @@ -46,98 +47,86 @@ class QCheckBox; class SMESHGUI; class SMESH_Actor; class SVTK_Selector; -class SVTK_ViewWindow; class LightApp_SelectionMgr; -namespace SMESH{ +namespace SMESH +{ struct TPolySimulation; } -// IDL Headers -#include -#include CORBA_SERVER_HEADER(SMESH_Mesh) - //================================================================================= // class : SMESHGUI_CreatePolyhedralVolumeDlg // purpose : //================================================================================= class SMESHGUI_EXPORT SMESHGUI_CreatePolyhedralVolumeDlg : public QDialog { - Q_OBJECT + Q_OBJECT public: - SMESHGUI_CreatePolyhedralVolumeDlg( SMESHGUI*, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); - ~SMESHGUI_CreatePolyhedralVolumeDlg(); + SMESHGUI_CreatePolyhedralVolumeDlg( SMESHGUI* ); + ~SMESHGUI_CreatePolyhedralVolumeDlg(); private: - - void Init() ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - void hideEvent ( QHideEvent * ); /* ESC key */ - void keyPressEvent( QKeyEvent* e ); - int GetConstructorId(); - void displaySimulation(); + void Init(); + void closeEvent( QCloseEvent* ); + void enterEvent( QEvent* ); /* mouse enter the QWidget */ + void hideEvent( QHideEvent* ); /* ESC key */ + void keyPressEvent( QKeyEvent* ); + int GetConstructorId(); + void displaySimulation(); - int checkEditLine(bool checkLast=true); /*! Checking for indices, return 1 if all ok, esle -1*/ + int checkEditLine( bool = true ); /*! Checking for indices, return 1 if all ok, esle -1*/ - SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */ - LightApp_SelectionMgr* mySelectionMgr ; /* User shape selection */ - SVTK_Selector* mySelector; - QString myIDs; - int myNbOkElements ; /* to check when elements are defined */ + SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ + LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ + SVTK_Selector* mySelector; + QString myIDs; + int myNbOkElements; /* to check when elements are defined */ - QLineEdit* myEditCurrentArgument; + QLineEdit* myEditCurrentArgument; - SMESH::SMESH_Mesh_var myMesh; - SMESH_Actor* myActor; - SMESH::TPolySimulation* mySimulation; - - QButtonGroup* GroupConstructors; - QRadioButton* RadioButton1; - QRadioButton* RadioButton2; - QCheckBox* Preview; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QPushButton* buttonHelp; - QGroupBox* GroupContent; - QLabel* TextLabelIds; - QPushButton* SelectElementsButton; - QLineEdit* LineEditElements; - QListBox* myFacesByNodes; - QLabel* myFacesByNodesLabel; - QPushButton* AddButton; - QPushButton* RemoveButton; - - QString myHelpFileName; + SMESH::SMESH_Mesh_var myMesh; + SMESH_Actor* myActor; + SMESH::TPolySimulation* mySimulation; + + QGroupBox* ConstructorsBox; + QButtonGroup* GroupConstructors; + QRadioButton* RadioButton1; + QRadioButton* RadioButton2; + QCheckBox* Preview; + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QPushButton* buttonApply; + QPushButton* buttonHelp; + QGroupBox* GroupContent; + QLabel* TextLabelIds; + QPushButton* SelectElementsButton; + QLineEdit* LineEditElements; + QListWidget* myFacesByNodes; + QLabel* myFacesByNodesLabel; + QPushButton* AddButton; + QPushButton* RemoveButton; + + QString myHelpFileName; - public slots: - - void onAdd(); - void onRemove(); - - private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnPreview(bool theToggled); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void ClickOnHelp(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void onTextChange(const QString&); - void onListSelectionChanged(); - -protected: - QGridLayout* SMESHGUI_CreatePolyhedralVolumeDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupContentLayout; +public slots: + void onAdd(); + void onRemove(); + +private slots: + void ConstructorsClicked( int ); + void ClickOnPreview( bool ); + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void ClickOnHelp(); + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void DeactivateActiveDialog(); + void ActivateThisDialog(); + void onTextChange( const QString& ); + void onListSelectionChanged(); }; -#endif // DIALOGBOX_CREATEPOLYHEDRAL_H +#endif // SMESHGUI_CREATEPOLYHEDRALVOLUMEDLG_H diff --git a/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.cxx b/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.cxx index 59ea87705..72f5ac4c1 100644 --- a/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.cxx @@ -1,68 +1,65 @@ -// SMESH SMESHGUI : GUI for SMESH component +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_DeleteGroupDlg.cxx +// Author : Sergey LITONIN, Open CASCADE S.A.S. // -// -// File : SMESHGUI_DeleteGroupDlg.cxx -// Author : Sergey LITONIN -// Module : SMESH +// SMESH includes #include "SMESHGUI_DeleteGroupDlg.h" #include "SMESHGUI.h" #include "SMESHGUI_Utils.h" #include "SMESHGUI_VTKUtils.h" -#include "SMESH_TypeFilter.hxx" +#include -#include "SUIT_Desktop.h" -#include "SUIT_Session.h" -#include "SUIT_MessageBox.h" +// SALOME GUI includes +#include +#include +#include +#include -#include "SalomeApp_Study.h" -#include "LightApp_Application.h" -#include "LightApp_SelectionMgr.h" +#include +#include +#include -#include "SALOME_ListIO.hxx" -#include "SALOME_ListIteratorOfListIO.hxx" +#include +#include -#include "SVTK_Selection.h" -#include "SVTK_ViewWindow.h" +#include +#include -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include +// Qt includes +#include +#include +#include +#include +#include +#include -// IDL Headers -#include "SALOMEconfig.h" +// IDL includes +#include #include CORBA_SERVER_HEADER(SMESH_Mesh) -#define SPACING 5 -#define MARGIN 10 +#define SPACING 6 +#define MARGIN 11 /*! * Class : SMESHGUI_DeleteGroupDlg @@ -74,25 +71,23 @@ // purpose : Constructor //================================================================================= SMESHGUI_DeleteGroupDlg::SMESHGUI_DeleteGroupDlg (SMESHGUI* theModule): - QDialog(SMESH::GetDesktop(theModule), - "SMESHGUI_DeleteGroupDlg", - false, - WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), + QDialog(SMESH::GetDesktop(theModule)), mySelectionMgr(SMESH::GetSelectionMgr(theModule)), mySMESHGUI(theModule) { - setCaption(tr("CAPTION")); + setModal(false); + setWindowTitle(tr("CAPTION")); - QVBoxLayout* aDlgLay = new QVBoxLayout(this, MARGIN, SPACING); + QVBoxLayout* aDlgLay = new QVBoxLayout(this); + aDlgLay->setMargin(MARGIN); + aDlgLay->setSpacing(SPACING); - QFrame* aMainFrame = createMainFrame (this); - QFrame* aBtnFrame = createButtonFrame(this); + QWidget* aMainFrame = createMainFrame (this); + QWidget* aBtnFrame = createButtonFrame(this); aDlgLay->addWidget(aMainFrame); aDlgLay->addWidget(aBtnFrame); - aDlgLay->setStretchFactor(aMainFrame, 1); - myHelpFileName = "deleting_groups_page.html"; Init(); @@ -102,16 +97,23 @@ SMESHGUI_DeleteGroupDlg::SMESHGUI_DeleteGroupDlg (SMESHGUI* theModule): // function : createMainFrame() // purpose : Create frame containing dialog's input fields //================================================================================= -QFrame* SMESHGUI_DeleteGroupDlg::createMainFrame (QWidget* theParent) +QWidget* SMESHGUI_DeleteGroupDlg::createMainFrame (QWidget* theParent) { QGroupBox* aMainGrp = - new QGroupBox(1, Qt::Horizontal, tr("SELECTED_GROUPS"), theParent); - - myListBox = new QListBox(aMainGrp); - myListBox->setMinimumHeight(100); - myListBox->setSelectionMode(QListBox::NoSelection); - myListBox->setRowMode(QListBox::FitToWidth); - + new QGroupBox(tr("SELECTED_GROUPS"), theParent); + QVBoxLayout* aLay = new QVBoxLayout(aMainGrp); + aLay->setMargin(MARGIN); + aLay->setSpacing(SPACING); + + myListBox = new QListWidget(aMainGrp); + myListBox->setMinimumSize(150, 100); + myListBox->setSelectionMode(QListWidget::NoSelection); + //myListBox->setRowMode(QListBox::FitToWidth); + myListBox->setFlow(QListWidget::LeftToRight); + myListBox->setWrapping(true); + + aLay->addWidget(myListBox); + return aMainGrp; } @@ -119,23 +121,24 @@ QFrame* SMESHGUI_DeleteGroupDlg::createMainFrame (QWidget* theParent) // function : createButtonFrame() // purpose : Create frame containing buttons //================================================================================= -QFrame* SMESHGUI_DeleteGroupDlg::createButtonFrame (QWidget* theParent) +QWidget* SMESHGUI_DeleteGroupDlg::createButtonFrame (QWidget* theParent) { - QFrame* aFrame = new QFrame(theParent); - aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken); + QGroupBox* aFrame = new QGroupBox(theParent); myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), aFrame); myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame); myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame); - myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aFrame); + myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aFrame); - QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); - - QHBoxLayout* aLay = new QHBoxLayout(aFrame, MARGIN, SPACING); + QHBoxLayout* aLay = new QHBoxLayout(aFrame); + aLay->setMargin(MARGIN); + aLay->setSpacing(SPACING); aLay->addWidget(myOkBtn); + aLay->addSpacing(10); aLay->addWidget(myApplyBtn); - aLay->addItem(aSpacer); + aLay->addSpacing(10); + aLay->addStretch(); aLay->addWidget(myCloseBtn); aLay->addWidget(myHelpBtn); @@ -170,15 +173,11 @@ void SMESHGUI_DeleteGroupDlg::Init () connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate())); connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose())); - this->show(); - // set selection mode mySelectionMgr->installFilter(new SMESH_TypeFilter(GROUP)); if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->SetSelectionMode(ActorSelection); onSelectionDone(); - - return; } //================================================================================= @@ -188,8 +187,8 @@ void SMESHGUI_DeleteGroupDlg::Init () bool SMESHGUI_DeleteGroupDlg::isValid() { if (myListBox->count() == 0) { - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), - tr("NO_SELECTED_GROUPS"), QMessageBox::Ok); + SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), + tr("NO_SELECTED_GROUPS")); return false; } @@ -207,7 +206,7 @@ bool SMESHGUI_DeleteGroupDlg::onApply() myBlockSelection = true; - QValueList::iterator anIter; + QList::iterator anIter; for (anIter = myListGrp.begin(); anIter != myListGrp.end(); ++anIter) { SMESH::SMESH_Mesh_ptr aMesh = (*anIter)->GetMesh(); if (!aMesh->_is_nil()) @@ -259,16 +258,17 @@ void SMESHGUI_DeleteGroupDlg::onHelp() if (app) app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); else { - QString platform; + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName)); } } @@ -287,7 +287,7 @@ void SMESHGUI_DeleteGroupDlg::onSelectionDone() SALOME_ListIO aListIO; mySelectionMgr->selectedObjects(aListIO); SALOME_ListIteratorOfListIO anIter (aListIO); - for (; anIter.More(); anIter.Next()) { + for ( ; anIter.More(); anIter.Next()) { SMESH::SMESH_GroupBase_var aGroup = SMESH::IObjectToInterface(anIter.Value()); if (!aGroup->_is_nil()) { @@ -297,7 +297,7 @@ void SMESHGUI_DeleteGroupDlg::onSelectionDone() } myListBox->clear(); - myListBox->insertStringList(aNames); + myListBox->addItems(aNames); } //================================================================================= @@ -342,9 +342,8 @@ void SMESHGUI_DeleteGroupDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) - { - e->accept(); - onHelp(); - } + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + onHelp(); + } } diff --git a/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.h b/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.h index c972ce75d..09dd4ff96 100644 --- a/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.h +++ b/src/SMESHGUI/SMESHGUI_DeleteGroupDlg.h @@ -1,47 +1,42 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_DeleteGroupDlg.h +// Author : Sergey LITONIN, Open CASCADE S.A.S. // -// File : SMESHGUI_DeleteGroupDlg.h -// Author : Sergey LITONIN -// Module : SMESH - #ifndef SMESHGUI_DELETEGROUPDLG_H #define SMESHGUI_DELETEGROUPDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include -#include +// Qt includes +#include +// IDL includes #include #include CORBA_SERVER_HEADER(SMESH_Group) -class QCloseEvent; -class QFrame; class QPushButton; -class QListBox; - +class QListWidget; class SMESHGUI; -class SVTK_ViewWindow; class LightApp_SelectionMgr; /*! @@ -54,19 +49,17 @@ class SMESHGUI_EXPORT SMESHGUI_DeleteGroupDlg : public QDialog Q_OBJECT public: - SMESHGUI_DeleteGroupDlg( SMESHGUI* ); - virtual ~SMESHGUI_DeleteGroupDlg(); + SMESHGUI_DeleteGroupDlg( SMESHGUI* ); + virtual ~SMESHGUI_DeleteGroupDlg(); void Init (); private: - - void closeEvent (QCloseEvent*); - void enterEvent (QEvent*); - void keyPressEvent(QKeyEvent*); + void closeEvent( QCloseEvent* ); + void enterEvent( QEvent* ); + void keyPressEvent( QKeyEvent* ); private slots: - void onOk(); bool onApply(); void onClose(); @@ -77,26 +70,24 @@ private slots: void onSelectionDone(); private: - - QFrame* createButtonFrame (QWidget*); - QFrame* createMainFrame (QWidget*); + QWidget* createButtonFrame( QWidget* ); + QWidget* createMainFrame( QWidget* ); bool isValid(); private: - QPushButton* myOkBtn; QPushButton* myApplyBtn; QPushButton* myCloseBtn; QPushButton* myHelpBtn; - QListBox* myListBox; + QListWidget* myListBox; SMESHGUI* mySMESHGUI; LightApp_SelectionMgr* mySelectionMgr; - QValueList myListGrp; - bool myBlockSelection; + QList myListGrp; + bool myBlockSelection; QString myHelpFileName; }; -#endif +#endif // SMESHGUI_DELETEGROUPDLG_H diff --git a/src/SMESHGUI/SMESHGUI_Dialog.cxx b/src/SMESHGUI/SMESHGUI_Dialog.cxx index 8c2c87db6..fe4b4634e 100644 --- a/src/SMESHGUI/SMESHGUI_Dialog.cxx +++ b/src/SMESHGUI/SMESHGUI_Dialog.cxx @@ -1,36 +1,41 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_Dialog.cxx +// Author : Alexander SOLOVYOV, Open CASCADE S.A.S. // -// -// File : SMESHGUI_Dialog.cxx -// Author : Alexander SOLOVYOV -// Module : SMESH -// $Header$ -#include +// SMESH includes +#include "SMESHGUI_Dialog.h" + #include + +// SALOME GUI includes +#include #include #include +// Qt includes +#include + //================================================================================= // function : SMESHGUI_Dialog // purpose : Constructor @@ -111,25 +116,7 @@ int SMESHGUI_Dialog::prefix( const QString& name ) // name : resourceMgr // Purpose : Gets resource manager //======================================================================= -SUIT_ResourceMgr* SMESHGUI_Dialog::resourceMgr() +SUIT_ResourceMgr* SMESHGUI_Dialog::resourceMgr() const { return SUIT_Session::session()->resourceMgr(); } - - - - - - - - - - - - - - - - - - diff --git a/src/SMESHGUI/SMESHGUI_Dialog.h b/src/SMESHGUI/SMESHGUI_Dialog.h index 676b601a4..20bc86e78 100644 --- a/src/SMESHGUI/SMESHGUI_Dialog.h +++ b/src/SMESHGUI/SMESHGUI_Dialog.h @@ -1,37 +1,35 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_Dialog.h +// Author : Alexander SOLOVYOV, Open CASCADE S.A.S. // -// -// File : SMESHGUI_Dialog.h -// Author : Alexander SOLOVYOV -// Module : SMESH -// $Header$ - #ifndef SMESHGUI_DIALOG_H #define SMESHGUI_DIALOG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" +// SALOME GUI includes #include class SUIT_Desktop; @@ -46,23 +44,24 @@ class SMESHGUI_EXPORT SMESHGUI_Dialog : public LightApp_Dialog Q_OBJECT public: - SMESHGUI_Dialog( QWidget* = 0, const bool = false, const bool = false, const int = OK | Close | Apply | Help ); + SMESHGUI_Dialog( QWidget* = 0, const bool = false, const bool = false, + const int = OK | Close | Apply | Help ); virtual ~SMESHGUI_Dialog(); - virtual void show(); + virtual void show(); //! set all content to enable (parameter is true) or disable state - virtual void setContentActive( const bool ) const; + virtual void setContentActive( const bool ) const; //! Return hard-coded prefix using to differ overlapping types - static int prefix( const QString& ); + static int prefix( const QString& ); protected: //! find desktop of active application - SUIT_Desktop* desktop() const; + SUIT_Desktop* desktop() const; //! gets resource manager - SUIT_ResourceMgr* resourceMgr(); + SUIT_ResourceMgr* resourceMgr() const; }; -#endif +#endif // SMESHGUI_DIALOG_H diff --git a/src/SMESHGUI/SMESHGUI_Displayer.cxx b/src/SMESHGUI/SMESHGUI_Displayer.cxx index e039e1311..cfdb3333b 100644 --- a/src/SMESHGUI/SMESHGUI_Displayer.cxx +++ b/src/SMESHGUI/SMESHGUI_Displayer.cxx @@ -1,36 +1,37 @@ -// SMESH SMESHGUI : Displayer for SMESH module +// SMESH SMESHGUI : Displayer for SMESH module // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_Displayer.cxx +// Author : Alexander SOLOVYOV, Open CASCADE S.A.S. // -// -// File : SMESHGUI_Displayer.cxx -// Author : Alexander SOLOVYOV -// Module : SMESH -// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESHGUI/SMESHGUI_Displayer.cxx +// SMESH includes #include "SMESHGUI_Displayer.h" + #include "SMESHGUI_VTKUtils.h" +// SALOME GUI includes #include #include +#include #include #include @@ -56,13 +57,13 @@ SALOME_Prs* SMESHGUI_Displayer::buildPresentation( const QString& entry, SALOME_ if( vtk_viewer ) { SUIT_ViewWindow* wnd = vtk_viewer->getViewManager()->getActiveView(); - SMESH_Actor* anActor = SMESH::FindActorByEntry( wnd, entry.latin1() ); + SMESH_Actor* anActor = SMESH::FindActorByEntry( wnd, entry.toLatin1().data() ); if( !anActor ) - anActor = SMESH::CreateActor( study()->studyDS(), entry.latin1(), true ); + anActor = SMESH::CreateActor( study()->studyDS(), entry.toLatin1().data(), true ); if( anActor ) { SMESH::DisplayActor( wnd, anActor ); - prs = LightApp_Displayer::buildPresentation( entry.latin1(), aViewFrame ); + prs = LightApp_Displayer::buildPresentation( entry.toLatin1().data(), aViewFrame ); } if( prs ) UpdatePrs( prs ); diff --git a/src/SMESHGUI/SMESHGUI_Displayer.h b/src/SMESHGUI/SMESHGUI_Displayer.h index dc2df5f8b..2510c6473 100644 --- a/src/SMESHGUI/SMESHGUI_Displayer.h +++ b/src/SMESHGUI/SMESHGUI_Displayer.h @@ -1,36 +1,35 @@ -// SMESH SMESHGUI : Displayer for SMESH module +// SMESH SMESHGUI : Displayer for SMESH module // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_Displayer.h +// Author : Alexander SOLOVYOV, Open CASCADE S.A.S. // -// -// File : SMESHGUI_Displayer.h -// Author : Alexander SOLOVYOV -// Module : SMESH -// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/SMESHGUI/SMESHGUI_Displayer.h -#ifndef SMESHGUI_DISPLAYER_HEADER -#define SMESHGUI_DISPLAYER_HEADER +#ifndef SMESHGUI_DISPLAYER_H +#define SMESHGUI_DISPLAYER_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" +// SALOME GUI includes #include class SalomeApp_Application; @@ -42,14 +41,14 @@ public: SMESHGUI_Displayer( SalomeApp_Application* ); ~SMESHGUI_Displayer(); - virtual SALOME_Prs* buildPresentation( const QString&, SALOME_View* = 0 ); - virtual bool canBeDisplayed( const QString& /*entry*/, const QString& /*viewer_type*/ ) const; + virtual SALOME_Prs* buildPresentation( const QString&, SALOME_View* = 0 ); + virtual bool canBeDisplayed( const QString&, const QString& ) const; protected: - SalomeApp_Study* study() const; + SalomeApp_Study* study() const; private: SalomeApp_Application* myApp; }; -#endif +#endif // SMESHGUI_DISPLAYER_H diff --git a/src/SMESHGUI/SMESHGUI_EditHypothesesDlg.h b/src/SMESHGUI/SMESHGUI_EditHypothesesDlg.h deleted file mode 100644 index 7385dcb9f..000000000 --- a/src/SMESHGUI/SMESHGUI_EditHypothesesDlg.h +++ /dev/null @@ -1,153 +0,0 @@ -// SMESH SMESHGUI : GUI for SMESH component -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SMESHGUI_EditHypothesesDlg.h -// Author : Nicolas REJNERI -// Module : SMESH -// $Header$ - -#ifndef DIALOGBOX_EDIT_HYPOTHESES_H -#define DIALOGBOX_EDIT_HYPOTHESES_H - -#include "SMESH_SMESHGUI.hxx" - -//#include "SMESH_TypeFilter.hxx" -#include "SUIT_SelectionFilter.h" -#include "LightApp_SelectionMgr.h" - -// QT Includes -#include - -// IDL Headers -#include -#include CORBA_SERVER_HEADER(GEOM_Gen) -#include CORBA_SERVER_HEADER(SMESH_Mesh) - -#include -#include - -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QListBox; -class QListBoxItem; -class SMESHGUI; - -typedef map MapIOR; - -//================================================================================= -// class : SMESHGUI_EditHypothesesDlg -// purpose : -//================================================================================= -class SMESHGUI_EXPORT SMESHGUI_EditHypothesesDlg : public QDialog -{ - Q_OBJECT - -public: - SMESHGUI_EditHypothesesDlg (SMESHGUI*, - const char* name = 0, - bool modal = FALSE, - WFlags fl = 0); - ~SMESHGUI_EditHypothesesDlg(); - -protected: - virtual void closeEvent (QCloseEvent*); - virtual void enterEvent (QEvent*); - -private: - void Init(); - - void InitHypDefinition(); - void InitAlgoDefinition(); - void InitHypAssignation(); - void InitAlgoAssignation(); - - void InitGeom(); - - void UpdateControlState(); - - bool StoreMesh(); - bool StoreSubMesh(); - - bool IsOld(QListBoxItem* hypItem); - -private: - SMESHGUI* mySMESHGUI; - LightApp_SelectionMgr* mySelectionMgr; - - GEOM::GEOM_Object_var myGeomShape; - QLineEdit* myEditCurrentArgument; - - SMESH::SMESH_Mesh_var myMesh; - SMESH::SMESH_subMesh_var mySubMesh; - - //Handle(SALOME_TypeFilter) myGeomFilter; - //Handle(SMESH_TypeFilter) myMeshOrSubMeshFilter; - SUIT_SelectionFilter* myGeomFilter; - SUIT_SelectionFilter* myMeshOrSubMeshFilter; - - MapIOR myMapOldHypos, myMapOldAlgos; - int myNbModification; - - bool myImportedMesh; - - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonApply; - QPushButton* buttonCancel; - - QGroupBox* GroupC1; - QLabel* TextLabelC1A1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - QLabel* TextLabelC1A2; - QPushButton* SelectButtonC1A2; - QLineEdit* LineEditC1A2; - - QGroupBox* GroupHypotheses; - QLabel* TextHypDefinition; - QListBox* ListHypDefinition; - QLabel* TextHypAssignation; - QListBox* ListHypAssignation; - - QGroupBox* GroupAlgorithms; - QLabel* TextAlgoDefinition; - QListBox* ListAlgoDefinition; - QLabel* TextAlgoAssignation; - QListBox* ListAlgoAssignation; - -private slots: - void ClickOnOk(); - bool ClickOnApply(); - void ClickOnCancel(); - void SetEditCurrentArgument(); - void SelectionIntoArgument(); - void DeactivateActiveDialog(); - void ActivateThisDialog(); - - void removeItem(QListBoxItem*); - void addItem(QListBoxItem*); -}; - -#endif // DIALOGBOX_EDIT_HYPOTHESES_H diff --git a/src/SMESHGUI/SMESHGUI_EditMeshDlg.cxx b/src/SMESHGUI/SMESHGUI_EditMeshDlg.cxx index c53ac988a..1024fdfae 100644 --- a/src/SMESHGUI/SMESHGUI_EditMeshDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_EditMeshDlg.cxx @@ -1,62 +1,65 @@ +// SMESH SMESHGUI : GUI for SMESH component +// // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public +// You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_EditMeshDlg.cxx +// Author : Open CASCADE S.A.S. +// +// SMESH includes #include "SMESHGUI_EditMeshDlg.h" #include "SMESHGUI.h" #include "SMESHGUI_Utils.h" #include "SMESHGUI_VTKUtils.h" -#include "SMESHGUI_IdValidator.h" -#include "SMESHGUI_SpinBox.h" - -#include "SMESH_Actor.h" -#include "SMESH_TypeFilter.hxx" -#include "SMESH_LogicalFilter.hxx" #include "SMESHGUI_MeshUtils.h" -#include "SMDS_Mesh.hxx" - -#include "GEOMBase.h" +#include "SMESHGUI_SpinBox.h" -#include "SUIT_ResourceMgr.h" -#include "SUIT_Session.h" -#include "SUIT_MessageBox.h" +#include +#include +#include +#include -#include "LightApp_Application.h" +// SALOME GUI includes +#include +#include +#include +#include -#include "SVTK_ViewModel.h" -#include "SVTK_ViewWindow.h" -#include "SVTK_Selector.h" -#include "SVTK_Selection.h" -#include "SALOME_ListIO.hxx" +#include +#include -#include "utilities.h" +#include +#include +#include -// OCCT Includes -#include +// OCCT includes #include #include -//IDL Headers +// IDL includes +#include #include CORBA_SERVER_HEADER(SMESH_Group) +#include CORBA_SERVER_HEADER(SMESH_MeshEditor) -// VTK Includes +// VTK includes #include #include #include @@ -67,29 +70,30 @@ #include #include #include -#include #include #include -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; - -namespace SMESH { - class TIdPreview { // to display in the viewer IDs of the selected elements +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SPACING 6 +#define MARGIN 11 + +namespace SMESH +{ + class TIdPreview + { // to display in the viewer IDs of the selected elements SVTK_ViewWindow* myViewWindow; vtkUnstructuredGrid* myIdGrid; @@ -295,13 +299,14 @@ static const char * IconFirst[] = { //================================================================================= SMESHGUI_EditMeshDlg::SMESHGUI_EditMeshDlg (SMESHGUI* theModule, int theAction) - : QDialog(SMESH::GetDesktop(theModule), "SMESHGUI_EditMeshDlg", false, WStyle_Customize | - WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose), + : QDialog(SMESH::GetDesktop(theModule)), mySMESHGUI(theModule), mySelectionMgr(SMESH::GetSelectionMgr(theModule)), myAction(theAction) { - setCaption(tr("SMESH_MERGE_NODES")); + setModal(false); + setAttribute(Qt::WA_DeleteOnClose, true); + setWindowTitle(myAction == 1 ? tr("SMESH_MERGE_ELEMENTS") : tr("SMESH_MERGE_NODES")); myIdPreview = new SMESH::TIdPreview(SMESH::GetViewWindow( mySMESHGUI )); @@ -312,175 +317,143 @@ SMESHGUI_EditMeshDlg::SMESHGUI_EditMeshDlg (SMESHGUI* theModule, QPixmap IconAdd (aResMgr->loadPixmap("SMESH", tr("ICON_APPEND"))); QPixmap IconRemove (aResMgr->loadPixmap("SMESH", tr("ICON_REMOVE"))); - setSizeGripEnabled(TRUE); - DlgLayout = new QGridLayout (this); - DlgLayout->setSpacing(6); - DlgLayout->setMargin(11); + setSizeGripEnabled(true); - /***************************************************************/ - GroupConstructors = new QButtonGroup (this, "GroupConstructors"); - GroupConstructors->setTitle(tr("SMESH_MERGE_NODES")); - GroupConstructors->setExclusive(TRUE); - GroupConstructors->setColumnLayout(0, Qt::Vertical); - GroupConstructors->layout()->setSpacing(0); - GroupConstructors->layout()->setMargin(0); - GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout()); - GroupConstructorsLayout->setAlignment(Qt::AlignTop); - GroupConstructorsLayout->setSpacing(6); - GroupConstructorsLayout->setMargin(11); - RadioButton = new QRadioButton(GroupConstructors, "RadioButton"); - RadioButton->setPixmap(IconMergeNodes); - if (myAction == 1) RadioButton->setPixmap(IconMergeElems); - RadioButton->setChecked(TRUE); - GroupConstructorsLayout->addWidget(RadioButton, 0, 0); - DlgLayout->addWidget(GroupConstructors, 0, 0); + QVBoxLayout* DlgLayout = new QVBoxLayout(this); + DlgLayout->setSpacing(SPACING); + DlgLayout->setMargin(MARGIN); /***************************************************************/ - GroupButtons = new QGroupBox (this, "GroupButtons"); - GroupButtons->setTitle(tr("" )); - GroupButtons->setColumnLayout(0, Qt::Vertical); - GroupButtons->layout()->setSpacing(0); - GroupButtons->layout()->setMargin(0); - GroupButtonsLayout = new QGridLayout(GroupButtons->layout()); - GroupButtonsLayout->setAlignment(Qt::AlignTop); - GroupButtonsLayout->setSpacing(6); - GroupButtonsLayout->setMargin(11); - buttonHelp = new QPushButton(GroupButtons, "buttonHelp"); - buttonHelp->setText(tr("SMESH_BUT_HELP" )); - buttonHelp->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonHelp, 0, 4); - buttonCancel = new QPushButton(GroupButtons, "buttonCancel"); - buttonCancel->setText(tr("SMESH_BUT_CLOSE" )); - buttonCancel->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonCancel, 0, 3); - buttonApply = new QPushButton(GroupButtons, "buttonApply"); - buttonApply->setText(tr("SMESH_BUT_APPLY" )); - buttonApply->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonApply, 0, 1); - QSpacerItem* spacer3 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - GroupButtonsLayout->addItem(spacer3, 0, 2); - buttonOk = new QPushButton(GroupButtons, "buttonOk"); - buttonOk->setText(tr("SMESH_BUT_OK" )); - buttonOk->setAutoDefault(TRUE); - buttonOk->setDefault(TRUE); - GroupButtonsLayout->addWidget(buttonOk, 0, 0); - DlgLayout->addWidget(GroupButtons, 4, 0); + GroupConstructors = new QGroupBox(myAction == 1 ? + tr("SMESH_MERGE_ELEMENTS") : + tr("SMESH_MERGE_NODES"), + this); - /***************************************************************/ + QHBoxLayout* GroupConstructorsLayout = new QHBoxLayout(GroupConstructors); + GroupConstructorsLayout->setSpacing(SPACING); + GroupConstructorsLayout->setMargin(MARGIN); + + RadioButton = new QRadioButton(GroupConstructors); + RadioButton->setIcon(myAction == 1 ? IconMergeElems : IconMergeNodes); + RadioButton->setChecked(true); + GroupConstructorsLayout->addWidget(RadioButton); + GroupConstructorsLayout->addStretch(); + /***************************************************************/ // Controls for mesh defining - GroupMesh = new QGroupBox(this, "GroupMesh"); - GroupMesh->setTitle(tr("SMESH_SELECT_WHOLE_MESH")); - GroupMesh->setColumnLayout(0, Qt::Vertical); - GroupMesh->layout()->setSpacing(0); - GroupMesh->layout()->setMargin(0); - GroupMeshLayout = new QGridLayout(GroupMesh->layout()); - GroupMeshLayout->setAlignment(Qt::AlignTop); - GroupMeshLayout->setSpacing(6); - GroupMeshLayout->setMargin(11); - - TextLabelName = new QLabel(GroupMesh, "TextLabelName"); - TextLabelName->setText(tr("SMESH_NAME")); - GroupMeshLayout->addWidget(TextLabelName, 0, 0); - - SelectMeshButton = new QPushButton(GroupMesh, "SelectMeshButton"); - SelectMeshButton->setPixmap(IconSelect); - GroupMeshLayout->addWidget(SelectMeshButton, 0, 1); - - LineEditMesh = new QLineEdit(GroupMesh, "LineEditMesh"); + GroupMesh = new QGroupBox(tr("SMESH_SELECT_WHOLE_MESH"), this); + QHBoxLayout* GroupMeshLayout = new QHBoxLayout(GroupMesh); + GroupMeshLayout->setSpacing(SPACING); + GroupMeshLayout->setMargin(MARGIN); + + TextLabelName = new QLabel(tr("SMESH_NAME"), GroupMesh); + SelectMeshButton = new QPushButton(GroupMesh); + SelectMeshButton->setIcon(IconSelect); + LineEditMesh = new QLineEdit(GroupMesh); LineEditMesh->setReadOnly(true); - GroupMeshLayout->addWidget(LineEditMesh, 0, 2); - DlgLayout->addWidget(GroupMesh, 1, 0); + GroupMeshLayout->addWidget(TextLabelName); + GroupMeshLayout->addWidget(SelectMeshButton); + GroupMeshLayout->addWidget(LineEditMesh); /***************************************************************/ - // Controls for coincident elements detecting - GroupCoincident = new QGroupBox(this, "GroupCoincident"); - GroupCoincident->setTitle(tr("COINCIDENT_NODES")); - GroupCoincident->setColumnLayout(0, Qt::Vertical); - GroupCoincident->layout()->setSpacing(0); - GroupCoincident->layout()->setMargin(0); - GroupCoincidentLayout = new QGridLayout(GroupCoincident->layout()); - GroupCoincidentLayout->setAlignment(Qt::AlignTop); - GroupCoincidentLayout->setSpacing(6); - GroupCoincidentLayout->setMargin(11); + GroupCoincident = new QGroupBox(myAction == 1 ? + tr("COINCIDENT_ELEMENTS") : + tr("COINCIDENT_NODES"), + this); + + QGridLayout* GroupCoincidentLayout = new QGridLayout(GroupCoincident); + GroupCoincidentLayout->setSpacing(SPACING); + GroupCoincidentLayout->setMargin(MARGIN); if (myAction == 0) { // case merge nodes - TextLabelTolerance = new QLabel(GroupCoincident, "TextLabelTolerance"); - TextLabelTolerance->setText(tr("SMESH_TOLERANCE")); - TextLabelTolerance->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred)); - GroupCoincidentLayout->addWidget(TextLabelTolerance, 0, 0); + TextLabelTolerance = new QLabel(tr("SMESH_TOLERANCE"), GroupCoincident); + SpinBoxTolerance = new SMESHGUI_SpinBox(GroupCoincident); + SpinBoxTolerance->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); - SpinBoxTolerance = new SMESHGUI_SpinBox(GroupCoincident, "SpinBoxTolerance"); - GroupCoincidentLayout->addWidget(SpinBoxTolerance, 0, 1); + GroupCoincidentLayout->addWidget(TextLabelTolerance, 0, 0); + GroupCoincidentLayout->addWidget(SpinBoxTolerance, 0, 1); + } + else { + TextLabelTolerance = 0; + SpinBoxTolerance = 0; } - DetectButton = new QPushButton(GroupCoincident, "DetectButton"); - DetectButton->setText(tr("DETECT")); - DetectButton->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum)); - GroupCoincidentLayout->addWidget(DetectButton, 0, 2); - - ListCoincident = new QListBox(GroupCoincident, "ListCoincident"); - ListCoincident->setSelectionMode(QListBox::Extended); - if (myAction == 0) // case merge nodes - GroupCoincidentLayout->addMultiCellWidget(ListCoincident, 1, 3, 0, 1); - else // case merge elements - GroupCoincidentLayout->addMultiCellWidget(ListCoincident, 0, 3, 0, 1); - - QSpacerItem* spacer1 = new QSpacerItem(20, 21, QSizePolicy::Minimum, QSizePolicy::Expanding); - GroupCoincidentLayout->addItem(spacer1, 1, 2); + int row = GroupCoincidentLayout->rowCount(); - AddGroupButton = new QPushButton(GroupCoincident, "AddGroupButton"); - AddGroupButton->setText(tr("SMESH_BUT_ADD")); - GroupCoincidentLayout->addWidget(AddGroupButton, 2, 2); + ListCoincident = new QListWidget(GroupCoincident); + ListCoincident->setSelectionMode(QListWidget::ExtendedSelection); - RemoveGroupButton = new QPushButton(GroupCoincident, "RemoveGroupButton"); - RemoveGroupButton->setText(tr("SMESH_BUT_REMOVE")); - GroupCoincidentLayout->addWidget(RemoveGroupButton, 3, 2); + DetectButton = new QPushButton(tr("DETECT"), GroupCoincident); + AddGroupButton = new QPushButton(tr("SMESH_BUT_ADD"), GroupCoincident); + RemoveGroupButton = new QPushButton(tr("SMESH_BUT_REMOVE"), GroupCoincident); - SelectAllCB = new QCheckBox(GroupCoincident, "SelectAllCB"); - SelectAllCB->setText(tr("SELECT_ALL")); - GroupCoincidentLayout->addWidget(SelectAllCB, 4, 0); + SelectAllCB = new QCheckBox(tr("SELECT_ALL"), GroupCoincident); - DlgLayout->addWidget(GroupCoincident, 2, 0); + GroupCoincidentLayout->addWidget(ListCoincident, row, 0, 4, 2); + GroupCoincidentLayout->addWidget(DetectButton, row, 2); + GroupCoincidentLayout->addWidget(AddGroupButton, row+2, 2); + GroupCoincidentLayout->addWidget(RemoveGroupButton, row+3, 2); + GroupCoincidentLayout->addWidget(SelectAllCB, row+4, 0, 1, 3); + GroupCoincidentLayout->setRowMinimumHeight(row+1, 10); + GroupCoincidentLayout->setRowStretch(row+1, 5); /***************************************************************/ - // Controls for editing the selected group - GroupEdit = new QGroupBox(this, "GroupEdit"); - GroupEdit->setTitle(tr("EDIT_SELECTED_GROUP")); - GroupEdit->setColumnLayout(0, Qt::Vertical); - GroupEdit->layout()->setSpacing(0); - GroupEdit->layout()->setMargin(0); - GroupEditLayout = new QGridLayout(GroupEdit->layout()); - GroupEditLayout->setAlignment(Qt::AlignTop); - GroupEditLayout->setSpacing(6); - GroupEditLayout->setMargin(11); - - ListEdit = new QListBox(GroupEdit, "ListEdit"); - ListEdit->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred)); - ListEdit->setRowMode(QListBox::FixedNumber); - ListEdit->setMinimumHeight(ListEdit->sizeHint().height()); - ListEdit->setHScrollBarMode(QScrollView::AlwaysOn); - ListEdit->setVScrollBarMode(QScrollView::AlwaysOff); - ListEdit->setSelectionMode(QListBox::Extended); - GroupEditLayout->addMultiCellWidget(ListEdit, 0, 1, 0, 0); - - AddElemButton = new QPushButton(GroupEdit, "AddElemButton"); - AddElemButton->setPixmap(IconAdd); - GroupEditLayout->addWidget(AddElemButton, 0, 1); - - RemoveElemButton = new QPushButton(GroupEdit, "RemoveElemButton"); - RemoveElemButton->setPixmap(IconRemove); + GroupEdit = new QGroupBox(tr("EDIT_SELECTED_GROUP"), this); + QGridLayout* GroupEditLayout = new QGridLayout(GroupEdit); + GroupEditLayout->setSpacing(SPACING); + GroupEditLayout->setMargin(MARGIN); + + ListEdit = new QListWidget(GroupEdit); + //ListEdit->setRowMode(QListBox::FixedNumber); + //ListEdit->setHScrollBarMode(QScrollView::AlwaysOn); + //ListEdit->setVScrollBarMode(QScrollView::AlwaysOff); + ListEdit->setSelectionMode(QListWidget::ExtendedSelection); + + AddElemButton = new QPushButton(GroupEdit); + AddElemButton->setIcon(IconAdd); + RemoveElemButton = new QPushButton(GroupEdit); + RemoveElemButton->setIcon(IconRemove); + SetFirstButton = new QPushButton(GroupEdit); + SetFirstButton->setIcon(QPixmap(IconFirst)); + + GroupEditLayout->addWidget(ListEdit, 0, 0, 2, 1); + GroupEditLayout->addWidget(AddElemButton, 0, 1); GroupEditLayout->addWidget(RemoveElemButton, 0, 2); + GroupEditLayout->addWidget(SetFirstButton, 1, 1, 1, 2); - SetFirstButton = new QPushButton(GroupEdit, "SetFirstButton"); - SetFirstButton->setIconSet(QPixmap(IconFirst)); - SetFirstButton->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed)); - GroupEditLayout->addMultiCellWidget(SetFirstButton, 1, 1, 1, 2); + /***************************************************************/ + GroupButtons = new QGroupBox(this); + QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons); + GroupButtonsLayout->setSpacing(SPACING); + GroupButtonsLayout->setMargin(MARGIN); + + buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk->setAutoDefault(true); + buttonOk->setDefault(true); + buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); + buttonApply->setAutoDefault(true); + buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons); + buttonCancel->setAutoDefault(true); + buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons); + buttonHelp->setAutoDefault(true); + + GroupButtonsLayout->addWidget(buttonOk); + GroupButtonsLayout->addSpacing(10); + GroupButtonsLayout->addWidget(buttonApply); + GroupButtonsLayout->addSpacing(10); + GroupButtonsLayout->addStretch(); + GroupButtonsLayout->addWidget(buttonCancel); + GroupButtonsLayout->addWidget(buttonHelp); - DlgLayout->addWidget(GroupEdit, 3, 0); + /***************************************************************/ + DlgLayout->addWidget(GroupConstructors); + DlgLayout->addWidget(GroupMesh); + DlgLayout->addWidget(GroupCoincident); + DlgLayout->addWidget(GroupEdit); + DlgLayout->addWidget(GroupButtons); Init(); // Initialisations } @@ -491,7 +464,6 @@ SMESHGUI_EditMeshDlg::SMESHGUI_EditMeshDlg (SMESHGUI* theModule, //================================================================================= SMESHGUI_EditMeshDlg::~SMESHGUI_EditMeshDlg() { - // no need to delete child widgets, Qt does it all for us delete myIdPreview; } @@ -506,7 +478,7 @@ void SMESHGUI_EditMeshDlg::Init() SpinBoxTolerance->SetValue(1e-05); } - RadioButton->setChecked(TRUE); + RadioButton->setChecked(true); myEditCurrentArgument = (QWidget*)LineEditMesh; @@ -522,7 +494,7 @@ void SMESHGUI_EditMeshDlg::Init() SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH); SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter (GROUP); - QPtrList aListOfFilters; + QList aListOfFilters; if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter); if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter); @@ -551,8 +523,6 @@ void SMESHGUI_EditMeshDlg::Init() /* to close dialog if study change */ connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); - this->show(); /* displays Dialog */ - SetFirstButton->setEnabled(false); buttonOk->setEnabled(false); buttonApply->setEnabled(false); @@ -560,13 +530,6 @@ void SMESHGUI_EditMeshDlg::Init() // Init Mesh field from selection SelectionIntoArgument(); - // dialog customization - if (myAction == 1) { - setCaption(tr("SMESH_MERGE_ELEMENTS")); - GroupConstructors->setTitle(tr("SMESH_MERGE_ELEMENTS")); - GroupCoincident->setTitle(tr("COINCIDENT_ELEMENTS")); - } - myHelpFileName = "merging_elements_page.html"; } @@ -575,7 +538,7 @@ void SMESHGUI_EditMeshDlg::Init() // purpose : //================================================================================= void SMESHGUI_EditMeshDlg::FindGravityCenter(TColStd_MapOfInteger & theElemsIdMap, - list< gp_XYZ > & theGrCentersXYZ) + std::list< gp_XYZ > & theGrCentersXYZ) { if (!myActor) return; @@ -617,25 +580,22 @@ bool SMESHGUI_EditMeshDlg::ClickOnApply() try { SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); - QApplication::setOverrideCursor(Qt::waitCursor); + QApplication::setOverrideCursor(Qt::WaitCursor); SMESH::long_array_var anIds = new SMESH::long_array; SMESH::array_of_long_array_var aGroupsOfElements = new SMESH::array_of_long_array; aGroupsOfElements->length(ListCoincident->count()); - QListBoxItem* item = ListCoincident->firstItem(); int anArrayNum = 0; - while (item) { - QStringList aListIds = QStringList(""); - aListIds = QStringList::split(" ", item->text(), false); + for (int i = 0; i < ListCoincident->count(); i++) { + QStringList aListIds = ListCoincident->item(i)->text().split(" ", QString::SkipEmptyParts); anIds->length(aListIds.count()); for (int i = 0; i < aListIds.count(); i++) anIds[i] = aListIds[i].toInt(); aGroupsOfElements[anArrayNum++] = anIds.inout(); - item = item->next(); } if( myAction == 0 ) @@ -690,16 +650,17 @@ void SMESHGUI_EditMeshDlg::ClickOnHelp() if (app) app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); else { - QString platform; + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName)); } } @@ -709,29 +670,19 @@ void SMESHGUI_EditMeshDlg::ClickOnHelp() //================================================================================= void SMESHGUI_EditMeshDlg::onEditGroup() { - int nbSel = 0; - for (int i = 0; i < ListCoincident->count(); i++) { - if (ListCoincident->isSelected(i)) - nbSel++; - if (nbSel > 1) { - ListEdit->clear(); - return; - } - } - if (nbSel == 0) { + QList selItems = ListCoincident->selectedItems(); + if ( selItems.count() != 1 ) { ListEdit->clear(); return; } - QString aNewIds = ""; + QStringList aNewIds; - QListBoxItem* anItem; - for (anItem = ListEdit->firstItem(); anItem != 0; anItem = anItem->next()) - aNewIds+=QString(" %1").arg(anItem->text()); + for (int i = 0; i < ListEdit->count(); i++ ) + aNewIds.append(ListEdit->item(i)->text()); - ListCoincident->changeItem(aNewIds, ListCoincident->currentItem()); - ListCoincident->setSelected(ListCoincident->currentItem(), true); - + ListCoincident->currentItem()->setText(aNewIds.join(" ")); + ListCoincident->currentItem()->setSelected(true); } //================================================================================= @@ -759,7 +710,7 @@ void SMESHGUI_EditMeshDlg::onDetect() try { SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); - QApplication::setOverrideCursor(Qt::waitCursor); + QApplication::setOverrideCursor(Qt::WaitCursor); ListCoincident->clear(); ListEdit->clear(); @@ -780,22 +731,20 @@ void SMESHGUI_EditMeshDlg::onDetect() break; } - QListBoxItem* anItem = 0; for (int i = 0; i < aGroupsArray->length(); i++) { SMESH::long_array& aGroup = aGroupsArray[i]; - QString anIDs; + QStringList anIDs; for (int j = 0; j < aGroup.length(); j++) - anIDs+=QString(" %1").arg(aGroup[j]); + anIDs.append(QString::number(aGroup[j])); - anItem = new QListBoxText(anIDs); - ListCoincident->insertItem(anItem); + ListCoincident->addItem(anIDs.join(" ")); } QApplication::restoreOverrideCursor(); } catch(...) { } - ListCoincident->selectAll(true); + ListCoincident->selectAll(); updateControls(); } @@ -812,22 +761,23 @@ void SMESHGUI_EditMeshDlg::onSelectGroup() ListEdit->clear(); TColStd_MapOfInteger anIndices; - QListBoxItem* anItem; - int NbOfSelected = 0; - for (anItem = ListCoincident->firstItem(); anItem != 0; anItem = anItem->next()) { - if (anItem->isSelected()) { - QStringList aListIds = QStringList(""); - aListIds = QStringList::split(" ", anItem->text(), false); - for (int i = 0; i < aListIds.count(); i++) - anIndices.Add(aListIds[i].toInt()); - NbOfSelected++; - ListEdit->clear(); - if (NbOfSelected == 1) { - ListEdit->insertStringList(aListIds); - ListEdit->selectAll(true); - } - } + QList selItems = ListCoincident->selectedItems(); + QListWidgetItem* anItem; + QStringList aListIds; + + ListEdit->clear(); + + foreach(anItem, selItems) { + aListIds = anItem->text().split(" ", QString::SkipEmptyParts); + for (int i = 0; i < aListIds.count(); i++) + anIndices.Add(aListIds[i].toInt()); } + + if (selItems.count() == 1) { + ListEdit->addItems(aListIds); + ListEdit->selectAll(); + } + mySelector->AddOrRemoveIndex(myActor->getIO(), anIndices, false); SALOME_ListIO aList; aList.Append(myActor->getIO()); @@ -853,7 +803,10 @@ void SMESHGUI_EditMeshDlg::onSelectGroup() //================================================================================= void SMESHGUI_EditMeshDlg::onSelectAll (bool isToggled) { - ListCoincident->selectAll(isToggled); + if ( isToggled ) + ListCoincident->selectAll(); + else + ListCoincident->clearSelection(); } //================================================================================= @@ -865,20 +818,14 @@ void SMESHGUI_EditMeshDlg::onSelectElementFromGroup() if (myIsBusy || !myActor) return; - int nbSel = 0; TColStd_MapOfInteger anIndices; - QListBoxItem* anItem; - for (anItem = ListEdit->firstItem(); anItem != 0; anItem = anItem->next()) { - if (anItem->isSelected()) { - int anId = anItem->text().toInt(); - anIndices.Add(anId); - nbSel++; - if (nbSel == 1) - SetFirstButton->setEnabled(true); - } - } - if (nbSel == 0 || nbSel > 1) - SetFirstButton->setEnabled(false); + QList selItems = ListEdit->selectedItems(); + QListWidgetItem* anItem; + + foreach(anItem, selItems) + anIndices.Add(anItem->text().toInt()); + + SetFirstButton->setEnabled(selItems.count() == 1); mySelector->AddOrRemoveIndex(myActor->getIO(), anIndices, false); SALOME_ListIO aList; @@ -910,16 +857,16 @@ void SMESHGUI_EditMeshDlg::onAddGroup() SMESH::GetNameOfSelectedNodes(mySelector, myActor->getIO(), anIDs); ListCoincident->clearSelection(); - QListBoxItem* anItem = new QListBoxText(anIDs); - ListCoincident->insertItem(anItem); + ListCoincident->addItem(anIDs); int nbGroups = ListCoincident->count(); if (nbGroups) { - ListCoincident->setCurrentItem(nbGroups-1); - ListCoincident->setSelected(nbGroups-1, true); + ListCoincident->setCurrentRow(nbGroups-1); + ListCoincident->item(nbGroups-1)->setSelected(true); } else { - ListCoincident->setCurrentItem(0); - ListCoincident->setSelected(0, true); + // VSR ? this code seems to be never executed!!! + ListCoincident->setCurrentRow(0); + //ListCoincident->setSelected(0, true); // VSR: no items - no selection } updateControls(); @@ -935,9 +882,11 @@ void SMESHGUI_EditMeshDlg::onRemoveGroup() return; myIsBusy = true; - for (int i = ListCoincident->count(); i > 0; i--) - if (ListCoincident->isSelected(i-1)) - ListCoincident->removeItem(i-1); + QList selItems = ListCoincident->selectedItems(); + QListWidgetItem* anItem; + + foreach(anItem, selItems) + delete anItem; ListEdit->clear(); updateControls(); @@ -962,16 +911,19 @@ void SMESHGUI_EditMeshDlg::onAddElement() if (aNbNnodes < 1) return; - QStringList aNodes = QStringList::split(" ", aListStr); - QListBoxItem* anItem = 0; + QStringList aNodes = aListStr.split(" ", QString::SkipEmptyParts); for (QStringList::iterator it = aNodes.begin(); it != aNodes.end(); ++it) { - anItem = ListEdit->findItem(*it, Qt::ExactMatch); - if (!anItem) { - anItem = new QListBoxText(*it); - ListEdit->insertItem(anItem); + QList found = ListEdit->findItems(*it, Qt::MatchExactly); + if ( found.count() == 0 ) { + QListWidgetItem* anItem = new QListWidgetItem(*it); + ListEdit->addItem(anItem); + anItem->setSelected(true); + } + else { + QListWidgetItem* anItem; + foreach(anItem, found) anItem->setSelected(true); } - ListEdit->setSelected(anItem, true); } myIsBusy = false; @@ -988,10 +940,12 @@ void SMESHGUI_EditMeshDlg::onRemoveElement() return; myIsBusy = true; - for (int i = ListEdit->count(); i > 0; i--) - if (ListEdit->isSelected(i-1)) - ListEdit->removeItem(i-1); + QList selItems = ListEdit->selectedItems(); + QListWidgetItem* anItem; + foreach(anItem, selItems) + delete anItem; + myIsBusy = false; onEditGroup(); } @@ -1006,12 +960,12 @@ void SMESHGUI_EditMeshDlg::onSetFirst() return; myIsBusy = true; - QListBoxItem* anItem; - for (anItem = ListEdit->firstItem(); anItem != 0; anItem = anItem->next()) { - if (anItem->isSelected()) { - ListEdit->takeItem(anItem); - ListEdit->insertItem(anItem, 0); - } + QList selItems = ListEdit->selectedItems(); + QListWidgetItem* anItem; + + foreach(anItem, selItems) { + ListEdit->takeItem(ListEdit->row(anItem)); + ListEdit->insertItem(0, anItem); } myIsBusy = false; @@ -1148,7 +1102,7 @@ void SMESHGUI_EditMeshDlg::enterEvent(QEvent*) void SMESHGUI_EditMeshDlg::closeEvent(QCloseEvent*) { /* same than click on cancel button */ - this->ClickOnCancel(); + ClickOnCancel(); } //======================================================================= @@ -1171,9 +1125,8 @@ void SMESHGUI_EditMeshDlg::keyPressEvent( QKeyEvent* e) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) - { - e->accept(); - ClickOnHelp(); - } + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + ClickOnHelp(); + } } diff --git a/src/SMESHGUI/SMESHGUI_EditMeshDlg.h b/src/SMESHGUI/SMESHGUI_EditMeshDlg.h index f511b049f..a5a3e44b3 100644 --- a/src/SMESHGUI/SMESHGUI_EditMeshDlg.h +++ b/src/SMESHGUI/SMESHGUI_EditMeshDlg.h @@ -1,61 +1,67 @@ +// SMESH SMESHGUI : GUI for SMESH component +// // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public +// You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_EditMeshDlg.h +// Author : Open CASCADE S.A.S. +// -#ifndef SMESHGUI_EditMeshDlg_H -#define SMESHGUI_EditMeshDlg_H +#ifndef SMESHGUI_EDITMESHDLG_H +#define SMESHGUI_EDITMESHDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include "LightApp_SelectionMgr.h" -#include "SUIT_SelectionFilter.h" +// Qt includes +#include -// QT Includes -#include - -// Open CASCADE Includes +// OCCT includes #include -class QGridLayout; -class QButtonGroup; +// STL includes +#include + +// IDL includes +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) + class QGroupBox; class QLabel; class QLineEdit; class QPushButton; class QRadioButton; class QCheckBox; -class QListBox; +class QListWidget; class SMESHGUI; class SMESHGUI_SpinBox; class SMESH_Actor; -class SALOME_Actor; -class SVTK_ViewWindow; class SVTK_Selector; +class LightApp_SelectionMgr; +class SUIT_SelectionFilter; +class TColStd_MapOfInteger; -namespace SMESH{ +namespace SMESH +{ struct TIdPreview; } -// IDL Headers -#include -#include CORBA_SERVER_HEADER(SMESH_MeshEditor) - //================================================================================= // class : SMESHGUI_EditMeshDlg // purpose : @@ -64,29 +70,28 @@ class SMESHGUI_EXPORT SMESHGUI_EditMeshDlg : public QDialog { Q_OBJECT; - public: - SMESHGUI_EditMeshDlg (SMESHGUI * theModule, - int theAction); +public: + SMESHGUI_EditMeshDlg( SMESHGUI*, int ); ~SMESHGUI_EditMeshDlg(); - private: - void Init(); - void closeEvent (QCloseEvent*); - void enterEvent (QEvent*); /* mouse enter the QWidget */ - void hideEvent (QHideEvent*); /* ESC key */ - void keyPressEvent(QKeyEvent*); - void onEditGroup(); +private: + void Init(); + void closeEvent( QCloseEvent* ); + void enterEvent( QEvent* ); /* mouse enter the QWidget */ + void hideEvent( QHideEvent* ); /* ESC key */ + void keyPressEvent( QKeyEvent* ); + void onEditGroup(); - void FindGravityCenter(TColStd_MapOfInteger & ElemsIdMap, - list< gp_XYZ > & GrCentersXYZ); + void FindGravityCenter( TColStd_MapOfInteger&, + std::list& ); // add the centers of gravity of ElemsIdMap elements to the GrCentersXYZ list - private: - SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ - LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ - SVTK_Selector* mySelector; +private: + SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ + LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ + SVTK_Selector* mySelector; - QWidget* myEditCurrentArgument; + QWidget* myEditCurrentArgument; SMESH::SMESH_Mesh_var myMesh; SMESH::SMESH_IDSource_var mySubMeshOrGroup; @@ -95,69 +100,60 @@ class SMESHGUI_EXPORT SMESHGUI_EditMeshDlg : public QDialog SMESH::TIdPreview* myIdPreview; - int myAction; - bool myIsBusy; + int myAction; + bool myIsBusy; // Widgets - QButtonGroup* GroupConstructors; - QRadioButton* RadioButton; - - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QPushButton* buttonHelp; - - QGroupBox* GroupMesh; - QLabel* TextLabelName; - QPushButton* SelectMeshButton; - QLineEdit* LineEditMesh; - - QGroupBox* GroupCoincident; - QLabel* TextLabelTolerance; - SMESHGUI_SpinBox* SpinBoxTolerance; - QPushButton* DetectButton; - QListBox* ListCoincident; - QPushButton* AddGroupButton; - QPushButton* RemoveGroupButton; - QCheckBox* SelectAllCB; - - QGroupBox* GroupEdit; - QListBox* ListEdit; - QPushButton* AddElemButton; - QPushButton* RemoveElemButton; - QPushButton* SetFirstButton; + QGroupBox* GroupConstructors; + QRadioButton* RadioButton; + + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QPushButton* buttonApply; + QPushButton* buttonHelp; + + QGroupBox* GroupMesh; + QLabel* TextLabelName; + QPushButton* SelectMeshButton; + QLineEdit* LineEditMesh; + + QGroupBox* GroupCoincident; + QLabel* TextLabelTolerance; + SMESHGUI_SpinBox* SpinBoxTolerance; + QPushButton* DetectButton; + QListWidget* ListCoincident; + QPushButton* AddGroupButton; + QPushButton* RemoveGroupButton; + QCheckBox* SelectAllCB; + + QGroupBox* GroupEdit; + QListWidget* ListEdit; + QPushButton* AddElemButton; + QPushButton* RemoveElemButton; + QPushButton* SetFirstButton; - //protected: - QGridLayout* DlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupMeshLayout; - QGridLayout* GroupCoincidentLayout; - QGridLayout* GroupEditLayout; - - QString myHelpFileName; + QString myHelpFileName; private slots: - void ClickOnOk(); - void ClickOnCancel(); - bool ClickOnApply(); - void ClickOnHelp(); - void updateControls(); - void onDetect(); - void onAddGroup(); - void onRemoveGroup(); - void onSelectGroup(); - void onSelectAll(bool isToggled); - void onSelectElementFromGroup(); - void onAddElement(); - void onRemoveElement(); - void onSetFirst(); - void SetEditCurrentArgument(); - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - + void ClickOnOk(); + void ClickOnCancel(); + bool ClickOnApply(); + void ClickOnHelp(); + void updateControls(); + void onDetect(); + void onAddGroup(); + void onRemoveGroup(); + void onSelectGroup(); + void onSelectAll( bool ); + void onSelectElementFromGroup(); + void onAddElement(); + void onRemoveElement(); + void onSetFirst(); + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void DeactivateActiveDialog(); + void ActivateThisDialog(); }; -#endif // SMESHGUI_EditMeshDlg_H +#endif // SMESHGUI_EDITMESHDLG_H diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx index bd1f3bb6c..e4920f9c9 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx @@ -1,31 +1,29 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_ExtrusionAlongPathDlg.cxx +// Author : Vadim SANDLER, Open CASCADE S.A.S. // -// -// File : SMESHGUI_ExtrusionAlongPathDlg.cxx -// Author : Vadim SANDLER -// Module : SMESH -// $Header: +// SMESH includes #include "SMESHGUI_ExtrusionAlongPathDlg.h" #include "SMESHGUI.h" @@ -35,73 +33,83 @@ #include "SMESHGUI_SpinBox.h" #include "SMESHGUI_IdValidator.h" -#include "SMESH_Actor.h" -#include "SMESH_TypeFilter.hxx" -#include "SMESH_NumberFilter.hxx" -#include "SMESH_LogicalFilter.hxx" - -#include "SMDS_Mesh.hxx" +#include +#include +#include +#include -#include "GEOMBase.h" +#include -#include "SUIT_ResourceMgr.h" -#include "SUIT_OverrideCursor.h" -#include "SUIT_Desktop.h" -#include "SUIT_MessageBox.h" -#include "SUIT_Session.h" +// SALOME GEOM includes +#include -#include "LightApp_Application.h" +// SALOME GUI includes +#include +#include +#include +#include +#include -#include "SVTK_ViewModel.h" -#include "SVTK_ViewWindow.h" -#include "SVTK_Selector.h" -#include "SVTK_Selection.h" -#include "SALOME_ListIO.hxx" +#include +#include -#include "utilities.h" +#include -// OCCT Includes +// OCCT includes #include -#include -#include #include #include #include -#include - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// IDL Headers -#include "SALOMEconfig.h" + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// IDL includes +#include #include CORBA_SERVER_HEADER(SMESH_Group) #include CORBA_SERVER_HEADER(SMESH_MeshEditor) -using namespace std; +#define SPACING 6 +#define MARGIN 11 + +class SMESHGUI_ExtrusionAlongPathDlg::SetBusy +{ +public: + SetBusy( SMESHGUI_ExtrusionAlongPathDlg* _dlg ) + { + myDlg = _dlg; + myDlg->myBusy = true; + } + + ~SetBusy() + { + myDlg->myBusy = false; + } + +private: + SMESHGUI_ExtrusionAlongPathDlg* myDlg; +}; //================================================================================= // function : SMESHGUI_ExtrusionAlongPathDlg() // purpose : constructor //================================================================================= -SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theModule, - bool modal ) - : QDialog( SMESH::GetDesktop( theModule ), "SMESHGUI_ExtrusionAlongPathDlg", modal, - WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose), - mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) +SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theModule ) + : QDialog( SMESH::GetDesktop( theModule ) ), + mySMESHGUI( theModule ), + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) { SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI ); QPixmap edgeImage ( mgr->loadPixmap("SMESH", tr("ICON_DLG_EDGE"))); @@ -112,47 +120,45 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod myType = -1; - setCaption(tr("EXTRUSION_ALONG_PATH")); - setSizeGripEnabled(TRUE); + setModal( false ); + setAttribute( Qt::WA_DeleteOnClose, true ); + setWindowTitle(tr("EXTRUSION_ALONG_PATH")); + setSizeGripEnabled(true); - QGridLayout* topLayout = new QGridLayout(this); - topLayout->setSpacing(6); - topLayout->setMargin(11); + QVBoxLayout* topLayout = new QVBoxLayout(this); + topLayout->setSpacing(SPACING); + topLayout->setMargin(MARGIN); /***************************************************************/ // Elements type group box (1d / 2d elements) - GroupConstructors = new QButtonGroup(tr("SMESH_EXTRUSION"), this); - GroupConstructors->setColumnLayout(0, Qt::Vertical); - GroupConstructors->layout()->setSpacing(0); - GroupConstructors->layout()->setMargin(0); - QGridLayout* GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout()); - GroupConstructorsLayout->setAlignment(Qt::AlignTop); - GroupConstructorsLayout->setSpacing(6); GroupConstructorsLayout->setMargin(11); - - Elements1dRB = new QRadioButton(GroupConstructors); - Elements1dRB->setPixmap(edgeImage); - Elements2dRB = new QRadioButton(GroupConstructors); - Elements2dRB->setPixmap(faceImage); + ConstructorsBox = new QGroupBox(tr("SMESH_EXTRUSION"), this); + GroupConstructors = new QButtonGroup(this); + QHBoxLayout* ConstructorsBoxLayout = new QHBoxLayout(ConstructorsBox); + ConstructorsBoxLayout->setSpacing(SPACING); ConstructorsBoxLayout->setMargin(MARGIN); + + Elements1dRB = new QRadioButton(ConstructorsBox); + Elements1dRB->setIcon(edgeImage); + Elements2dRB = new QRadioButton(ConstructorsBox); + Elements2dRB->setIcon(faceImage); Elements1dRB->setChecked(true); // layouting - GroupConstructorsLayout->addWidget(Elements1dRB, 0, 0); - GroupConstructorsLayout->addWidget(Elements2dRB, 0, 2); + ConstructorsBoxLayout->addWidget(Elements1dRB); + ConstructorsBoxLayout->addWidget(Elements2dRB); + GroupConstructors->addButton(Elements1dRB, 0); + GroupConstructors->addButton(Elements2dRB, 1); /***************************************************************/ // Arguments group box GroupArguments = new QGroupBox(tr("EXTRUSION_1D"), this); - GroupArguments->setColumnLayout(0, Qt::Vertical); - GroupArguments->layout()->setSpacing(0); GroupArguments->layout()->setMargin(0); - QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments->layout()); - GroupArgumentsLayout->setAlignment(Qt::AlignTop); - GroupArgumentsLayout->setSpacing(6); GroupArgumentsLayout->setMargin(11); + QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments); + GroupArgumentsLayout->setSpacing(SPACING); GroupArgumentsLayout->setMargin(MARGIN); // Controls for elements selection ElementsLab = new QLabel(tr("SMESH_ID_ELEMENTS"), GroupArguments); SelectElementsButton = new QToolButton(GroupArguments); - SelectElementsButton->setPixmap(selectImage); + SelectElementsButton->setIcon(selectImage); ElementsLineEdit = new QLineEdit(GroupArguments); ElementsLineEdit->setValidator(new SMESHGUI_IdValidator(this)); @@ -162,35 +168,32 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod // Controls for path selection PathGrp = new QGroupBox(tr("SMESH_PATH"), GroupArguments); - PathGrp->setColumnLayout(0, Qt::Vertical); - PathGrp->layout()->setSpacing(0); PathGrp->layout()->setMargin(0); - QGridLayout* PathGrpLayout = new QGridLayout(PathGrp->layout()); - PathGrpLayout->setAlignment(Qt::AlignTop); - PathGrpLayout->setSpacing(6); PathGrpLayout->setMargin(11); + QGridLayout* PathGrpLayout = new QGridLayout(PathGrp); + PathGrpLayout->setSpacing(SPACING); PathGrpLayout->setMargin(MARGIN); // Controls for path mesh selection - PathMeshLab = new QLabel(tr("SMESH_PATH_MESH"), PathGrp); + QLabel* PathMeshLab = new QLabel(tr("SMESH_PATH_MESH"), PathGrp); SelectPathMeshButton = new QToolButton(PathGrp); - SelectPathMeshButton->setPixmap(selectImage); + SelectPathMeshButton->setIcon(selectImage); PathMeshLineEdit = new QLineEdit(PathGrp); PathMeshLineEdit->setReadOnly(true); // Controls for path shape selection - PathShapeLab = new QLabel(tr("SMESH_PATH_SHAPE"), PathGrp); + QLabel* PathShapeLab = new QLabel(tr("SMESH_PATH_SHAPE"), PathGrp); SelectPathShapeButton = new QToolButton(PathGrp); - SelectPathShapeButton->setPixmap(selectImage); + SelectPathShapeButton->setIcon(selectImage); PathShapeLineEdit = new QLineEdit(PathGrp); PathShapeLineEdit->setReadOnly(true); // Controls for path starting point selection - StartPointLab = new QLabel(tr("SMESH_PATH_START"), PathGrp); + QLabel* StartPointLab = new QLabel(tr("SMESH_PATH_START"), PathGrp); SelectStartPointButton = new QToolButton(PathGrp); - SelectStartPointButton->setPixmap(selectImage); + SelectStartPointButton->setIcon(selectImage); StartPointLineEdit = new QLineEdit(PathGrp); StartPointLineEdit->setValidator(new QIntValidator(this)); @@ -206,96 +209,75 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod PathGrpLayout->addWidget(SelectStartPointButton, 2, 1); PathGrpLayout->addWidget(StartPointLineEdit, 2, 2); - // Controls for base point defining - BasePointCheck = new QCheckBox(tr("SMESH_USE_BASE_POINT"), GroupArguments); - BasePointGrp = new QGroupBox(tr("SMESH_BASE_POINT"), GroupArguments); - BasePointGrp->setColumnLayout(0, Qt::Vertical); - BasePointGrp->layout()->setSpacing(0); BasePointGrp->layout()->setMargin(0); - QGridLayout* BasePointGrpLayout = new QGridLayout(BasePointGrp->layout()); - BasePointGrpLayout->setAlignment(Qt::AlignTop); - BasePointGrpLayout->setSpacing(6); BasePointGrpLayout->setMargin(11); + BasePointGrp->setCheckable(true); + BasePointGrp->setChecked(false); + QHBoxLayout* BasePointGrpLayout = new QHBoxLayout(BasePointGrp); + BasePointGrpLayout->setSpacing(SPACING); BasePointGrpLayout->setMargin(MARGIN); SelectBasePointButton = new QToolButton(BasePointGrp); - SelectBasePointButton->setPixmap(selectImage); + SelectBasePointButton->setIcon(selectImage); - XLab = new QLabel(tr("SMESH_X"), BasePointGrp); - XLab->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); + QLabel* XLab = new QLabel(tr("SMESH_X"), BasePointGrp); XSpin = new SMESHGUI_SpinBox(BasePointGrp); - YLab = new QLabel(tr("SMESH_Y"), BasePointGrp); - YLab->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); + QLabel* YLab = new QLabel(tr("SMESH_Y"), BasePointGrp); YSpin = new SMESHGUI_SpinBox(BasePointGrp); - ZLab = new QLabel(tr("SMESH_Z"), BasePointGrp); - ZLab->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); + QLabel* ZLab = new QLabel(tr("SMESH_Z"), BasePointGrp); ZSpin = new SMESHGUI_SpinBox(BasePointGrp); // layouting - BasePointGrpLayout->addWidget(SelectBasePointButton, 0, 0); - BasePointGrpLayout->addWidget(XLab, 0, 1); - BasePointGrpLayout->addWidget(XSpin, 0, 2); - BasePointGrpLayout->addWidget(YLab, 0, 3); - BasePointGrpLayout->addWidget(YSpin, 0, 4); - BasePointGrpLayout->addWidget(ZLab, 0, 5); - BasePointGrpLayout->addWidget(ZSpin, 0, 6); - - // Controls for angles defining - AnglesCheck = new QCheckBox(tr("SMESH_USE_ANGLES"), GroupArguments); + BasePointGrpLayout->addWidget(SelectBasePointButton); + BasePointGrpLayout->addWidget(XLab); + BasePointGrpLayout->addWidget(XSpin); + BasePointGrpLayout->addWidget(YLab); + BasePointGrpLayout->addWidget(YSpin); + BasePointGrpLayout->addWidget(ZLab); + BasePointGrpLayout->addWidget(ZSpin); AnglesGrp = new QGroupBox(tr("SMESH_ANGLES"), GroupArguments); - AnglesGrp->setColumnLayout(0, Qt::Vertical); - AnglesGrp->layout()->setSpacing(0); AnglesGrp->layout()->setMargin(0); - QGridLayout* AnglesGrpLayout = new QGridLayout(AnglesGrp->layout()); - AnglesGrpLayout->setAlignment(Qt::AlignTop); - AnglesGrpLayout->setSpacing(6); AnglesGrpLayout->setMargin(11); + AnglesGrp->setCheckable(true); + AnglesGrp->setChecked(false); + QGridLayout* AnglesGrpLayout = new QGridLayout(AnglesGrp); + AnglesGrpLayout->setSpacing(SPACING); AnglesGrpLayout->setMargin(MARGIN); - AnglesList = new QListBox(AnglesGrp); - AnglesList->setSelectionMode(QListBox::Extended); + AnglesList = new QListWidget(AnglesGrp); + AnglesList->setSelectionMode(QListWidget::ExtendedSelection); AddAngleButton = new QToolButton(AnglesGrp); - AddAngleButton->setPixmap(addImage); + AddAngleButton->setIcon(addImage); RemoveAngleButton = new QToolButton(AnglesGrp); - RemoveAngleButton->setPixmap(removeImage); + RemoveAngleButton->setIcon(removeImage); AngleSpin = new SMESHGUI_SpinBox(AnglesGrp); // layouting - QVBoxLayout* bLayout = new QVBoxLayout(); - bLayout->addWidget(AddAngleButton); - bLayout->addSpacing(6); - bLayout->addWidget(RemoveAngleButton); - bLayout->addStretch(); - AnglesGrpLayout->addMultiCellWidget(AnglesList, 0, 1, 0, 0); - AnglesGrpLayout->addMultiCellLayout(bLayout, 0, 1, 1, 1); - AnglesGrpLayout->addWidget( AngleSpin, 0, 2 ); - AnglesGrpLayout->setRowStretch(1, 10); + AnglesGrpLayout->addWidget(AnglesList, 0, 0, 4, 1); + AnglesGrpLayout->addWidget(AddAngleButton, 0, 1); + AnglesGrpLayout->addWidget(RemoveAngleButton, 2, 1); + AnglesGrpLayout->addWidget(AngleSpin, 0, 2); + AnglesGrpLayout->setRowMinimumHeight(1, 10); + AnglesGrpLayout->setRowStretch(3, 10); // CheckBox for groups generation MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments); MakeGroupsCheck->setChecked(true); // layouting - GroupArgumentsLayout->addWidget( ElementsLab, 0, 0 ); - GroupArgumentsLayout->addWidget( SelectElementsButton, 0, 1 ); - GroupArgumentsLayout->addWidget( ElementsLineEdit, 0, 2 ); - GroupArgumentsLayout->addMultiCellWidget(MeshCheck, 1, 1, 0, 2); - GroupArgumentsLayout->addMultiCellWidget(PathGrp, 2, 2, 0, 2); - GroupArgumentsLayout->addWidget( BasePointCheck, 3, 0 ); - GroupArgumentsLayout->addMultiCellWidget(BasePointGrp, 3, 4, 1, 2); - GroupArgumentsLayout->addWidget( AnglesCheck, 5, 0 ); - GroupArgumentsLayout->addMultiCellWidget(AnglesGrp, 5, 6, 1, 2); - GroupArgumentsLayout->addMultiCellWidget(MakeGroupsCheck, 7, 7, 0, 2); - GroupArgumentsLayout->setRowStretch(6, 10); + GroupArgumentsLayout->addWidget(ElementsLab, 0, 0); + GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1); + GroupArgumentsLayout->addWidget(ElementsLineEdit, 0, 2); + GroupArgumentsLayout->addWidget(MeshCheck, 1, 0, 1, 3); + GroupArgumentsLayout->addWidget(PathGrp, 2, 0, 1, 3); + GroupArgumentsLayout->addWidget(BasePointGrp, 3, 0, 1, 3); + GroupArgumentsLayout->addWidget(AnglesGrp, 4, 0, 1, 3); + GroupArgumentsLayout->addWidget(MakeGroupsCheck, 5, 0, 1, 3); /***************************************************************/ // common buttons group box GroupButtons = new QGroupBox(this); - GroupButtons->setColumnLayout(0, Qt::Vertical); - GroupButtons->layout()->setSpacing(0); - GroupButtons->layout()->setMargin(0); - QGridLayout* GroupButtonsLayout = new QGridLayout(GroupButtons->layout()); - GroupButtonsLayout->setAlignment(Qt::AlignTop); - GroupButtonsLayout->setSpacing(6); GroupButtonsLayout->setMargin(11); + QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons); + GroupButtonsLayout->setSpacing(SPACING); GroupButtonsLayout->setMargin(MARGIN); OkButton = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); OkButton->setAutoDefault(true); @@ -311,18 +293,19 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod HelpButton->setAutoDefault(true); // layouting - GroupButtonsLayout->addWidget(OkButton, 0, 0); - GroupButtonsLayout->addWidget(ApplyButton, 0, 1); - GroupButtonsLayout->addWidget(CloseButton, 0, 3); - GroupButtonsLayout->addWidget(HelpButton, 0, 4); - GroupButtonsLayout->addColSpacing(2, 10); - GroupButtonsLayout->setColStretch(2, 10); + GroupButtonsLayout->addWidget(OkButton); + GroupButtonsLayout->addSpacing(10); + GroupButtonsLayout->addWidget(ApplyButton); + GroupButtonsLayout->addSpacing(10); + GroupButtonsLayout->addStretch(); + GroupButtonsLayout->addWidget(CloseButton); + GroupButtonsLayout->addWidget(HelpButton); /***************************************************************/ // layouting - topLayout->addWidget(GroupConstructors, 0, 0); - topLayout->addWidget(GroupArguments, 1, 0); - topLayout->addWidget(GroupButtons, 2, 0); + topLayout->addWidget(ConstructorsBox); + topLayout->addWidget(GroupArguments); + topLayout->addWidget(GroupButtons); /***************************************************************/ // Initialisations @@ -339,7 +322,7 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH); SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter (GROUP); - QPtrList aListOfFilters; + QList aListOfFilters; if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter); if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter); @@ -360,7 +343,7 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod connect(AddAngleButton, SIGNAL(clicked()), this, SLOT(OnAngleAdded())); connect(RemoveAngleButton, SIGNAL(clicked()), this, SLOT(OnAngleRemoved())); - connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int))); + connect(GroupConstructors, SIGNAL(buttonClicked(int)), SLOT(ConstructorsClicked(int))); connect(SelectElementsButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(SelectPathMeshButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); @@ -373,13 +356,11 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(reject())); connect(ElementsLineEdit, SIGNAL(textChanged(const QString&)), - SLOT(onTextChange(const QString&))); + SLOT(onTextChange(const QString&))); connect(StartPointLineEdit, SIGNAL(textChanged(const QString&)), - SLOT(onTextChange(const QString&))); + SLOT(onTextChange(const QString&))); connect(MeshCheck, SIGNAL(toggled(bool)), SLOT(onSelectMesh())); - connect(AnglesCheck, SIGNAL(toggled(bool)), SLOT(onAnglesCheck())); - connect(BasePointCheck, SIGNAL(toggled(bool)), SLOT(onBasePointCheck())); AnglesList->installEventFilter(this); ElementsLineEdit->installEventFilter(this); @@ -387,10 +368,6 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod XSpin->editor()->installEventFilter(this); YSpin->editor()->installEventFilter(this); ZSpin->editor()->installEventFilter(this); - - /***************************************************************/ - - this->show(); // displays Dialog } //================================================================================= @@ -431,8 +408,6 @@ void SMESHGUI_ExtrusionAlongPathDlg::Init (bool ResetControls) MeshCheck->setChecked(false); ConstructorsClicked(0); onSelectMesh(); - onAnglesCheck(); - onBasePointCheck(); } SetEditCurrentArgument(0); } @@ -535,7 +510,7 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply() // get IDs from group // 1d elements or 2d elements if (Elements1dRB->isChecked() && aGroup->GetType() == SMESH::EDGE || - Elements2dRB->isChecked() && aGroup->GetType() == SMESH::FACE) + Elements2dRB->isChecked() && aGroup->GetType() == SMESH::FACE) anElementsId = aGroup->GetListOfID(); } } else { @@ -544,7 +519,7 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply() SMDS_Mesh* aMesh = myMeshActor->GetObject()->GetMesh(); if (aMesh) { - QStringList aListElementsId = QStringList::split(" ", ElementsLineEdit->text(), false); + QStringList aListElementsId = ElementsLineEdit->text().split(" ", QString::SkipEmptyParts); anElementsId = new SMESH::long_array; anElementsId->length(aListElementsId.count()); bool bOk; @@ -569,7 +544,7 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply() return false; } - if (StartPointLineEdit->text().stripWhiteSpace().isEmpty()) { + if (StartPointLineEdit->text().trimmed().isEmpty()) { return false; } @@ -581,12 +556,12 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply() // get angles SMESH::double_array_var anAngles = new SMESH::double_array; - if (AnglesCheck->isChecked()) { + if (AnglesGrp->isChecked()) { anAngles->length(AnglesList->count()); int j = 0; bool bOk; for (int i = 0; i < AnglesList->count(); i++) { - double angle = AnglesList->text(i).toDouble(&bOk); + double angle = AnglesList->item(i)->text().toDouble(&bOk); if (bOk) anAngles[ j++ ] = angle*PI/180; } @@ -595,7 +570,7 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply() // get base point SMESH::PointStruct aBasePoint; - if (BasePointCheck->isChecked()) { + if (BasePointGrp->isChecked()) { aBasePoint.x = XSpin->GetValue(); aBasePoint.y = YSpin->GetValue(); aBasePoint.z = ZSpin->GetValue(); @@ -609,52 +584,46 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply() SMESH::ListOfGroups_var groups = aMeshEditor->ExtrusionAlongPathMakeGroups(anElementsId.inout(), myPathMesh, myPathShape, aNodeStart, - AnglesCheck->isChecked(), anAngles.inout(), - BasePointCheck->isChecked(), aBasePoint, retVal); + AnglesGrp->isChecked(), anAngles.inout(), + BasePointGrp->isChecked(), aBasePoint, retVal); else retVal = aMeshEditor->ExtrusionAlongPath(anElementsId.inout(), myPathMesh, myPathShape, aNodeStart, - AnglesCheck->isChecked(), anAngles.inout(), - BasePointCheck->isChecked(), aBasePoint); + AnglesGrp->isChecked(), anAngles.inout(), + BasePointGrp->isChecked(), aBasePoint); //wc.stop(); wc.suspend(); switch (retVal) { case SMESH::SMESH_MeshEditor::EXTR_NO_ELEMENTS: - SUIT_MessageBox::warn1(SMESHGUI::desktop(), - tr("SMESH_ERROR"), - tr("NO_ELEMENTS_SELECTED"), - tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(this, + tr("SMESH_ERROR"), + tr("NO_ELEMENTS_SELECTED")); return false; break; case SMESH::SMESH_MeshEditor::EXTR_PATH_NOT_EDGE: - SUIT_MessageBox::warn1(SMESHGUI::desktop(), - tr("SMESH_ERROR"), - tr("SELECTED_PATH_IS_NOT_EDGE"), - tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(this, + tr("SMESH_ERROR"), + tr("SELECTED_PATH_IS_NOT_EDGE")); return false; break; case SMESH::SMESH_MeshEditor::EXTR_BAD_PATH_SHAPE: - SUIT_MessageBox::warn1(SMESHGUI::desktop(), - tr("SMESH_ERROR"), - tr("BAD_SHAPE_TYPE"), - tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(this, + tr("SMESH_ERROR"), + tr("BAD_SHAPE_TYPE")); return false; break; case SMESH::SMESH_MeshEditor::EXTR_BAD_STARTING_NODE: - SUIT_MessageBox::warn1(SMESHGUI::desktop(), - tr("SMESH_ERROR"), - tr("EXTR_BAD_STARTING_NODE"), - tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(this, + tr("SMESH_ERROR"), + tr("EXTR_BAD_STARTING_NODE")); return false; break; case SMESH::SMESH_MeshEditor::EXTR_BAD_ANGLES_NUMBER: - SUIT_MessageBox::warn1(SMESHGUI::desktop(), - tr("SMESH_ERROR"), - tr("WRONG_ANGLES_NUMBER"), - tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(this, + tr("SMESH_ERROR"), + tr("WRONG_ANGLES_NUMBER")); return false; break; case SMESH::SMESH_MeshEditor::EXTR_CANT_GET_TANGENT: - SUIT_MessageBox::warn1(SMESHGUI::desktop(), - tr("SMESH_ERROR"), - tr("CANT_GET_TANGENT"), - tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(this, + tr("SMESH_ERROR"), + tr("CANT_GET_TANGENT")); return false; break; case SMESH::SMESH_MeshEditor::EXTR_OK: break; @@ -693,16 +662,17 @@ void SMESHGUI_ExtrusionAlongPathDlg::ClickOnHelp() if (app) app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); else { - QString platform; + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName)); } } @@ -753,7 +723,7 @@ void SMESHGUI_ExtrusionAlongPathDlg::onTextChange (const QString& theNewText) aList.Append(myMeshActor->getIO()); mySelectionMgr->setSelectedObjects(aList, false); - QStringList aListId = QStringList::split(" ", theNewText, false); + QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts); bool bOk; const Handle(SALOME_InteractiveObject)& anIO = myMeshActor->getIO(); TColStd_MapOfInteger newIndices; @@ -926,14 +896,14 @@ void SMESHGUI_ExtrusionAlongPathDlg::SelectionIntoArgument() QString aString; int aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, aPathActor->getIO(), aString); if (aNbUnits == 1) - StartPointLineEdit->setText(aString.stripWhiteSpace()); + StartPointLineEdit->setText(aString.trimmed()); } else if (myEditCurrentArgument == XSpin) { // we are now selecting base point // reset is not performed here! // return if is not enabled - if (!BasePointGrp->isEnabled()) + if (!BasePointGrp->isChecked()) return; // try to get shape from selection @@ -1072,7 +1042,7 @@ void SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument (QToolButton* button SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter(GROUP); SMESH_NumberFilter* aVertexFilter = new SMESH_NumberFilter ("GEOM", TopAbs_SHAPE, -1, TopAbs_VERTEX); - QPtrList aListOfFilters; + QList aListOfFilters; if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter); if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter); if (aVertexFilter) aListOfFilters.append(aVertexFilter); @@ -1094,8 +1064,8 @@ void SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument (QToolButton* button //================================================================================= void SMESHGUI_ExtrusionAlongPathDlg::DeactivateActiveDialog() { - if (GroupConstructors->isEnabled()) { - GroupConstructors->setEnabled(false); + if (ConstructorsBox->isEnabled()) { + ConstructorsBox->setEnabled(false); GroupArguments->setEnabled(false); GroupButtons->setEnabled(false); mySMESHGUI->ResetState(); @@ -1111,7 +1081,7 @@ void SMESHGUI_ExtrusionAlongPathDlg::ActivateThisDialog() { // Emit a signal to deactivate the active dialog mySMESHGUI->EmitSignalDeactivateDialog(); - GroupConstructors->setEnabled(true); + ConstructorsBox->setEnabled(true); GroupArguments->setEnabled(true); GroupButtons->setEnabled(true); @@ -1127,7 +1097,7 @@ void SMESHGUI_ExtrusionAlongPathDlg::ActivateThisDialog() //================================================================================= void SMESHGUI_ExtrusionAlongPathDlg::enterEvent (QEvent*) { - if (!GroupConstructors->isEnabled()) + if (!ConstructorsBox->isEnabled()) ActivateThisDialog(); } @@ -1152,27 +1122,7 @@ void SMESHGUI_ExtrusionAlongPathDlg::onSelectMesh() //================================================================================= int SMESHGUI_ExtrusionAlongPathDlg::GetConstructorId() { - if (GroupConstructors != NULL && GroupConstructors->selected() != NULL) - return GroupConstructors->id(GroupConstructors->selected()); - return -1; -} - -//======================================================================= -// function : onAnglesCheck() -// purpose : called when "Use Angles" check box is switched -//======================================================================= -void SMESHGUI_ExtrusionAlongPathDlg::onAnglesCheck() -{ - AnglesGrp->setEnabled(AnglesCheck->isChecked()); -} - -//======================================================================= -// function : onBasePointCheck() -// purpose : called when "Use Base Point" check box is switched -//======================================================================= -void SMESHGUI_ExtrusionAlongPathDlg::onBasePointCheck() -{ - BasePointGrp->setEnabled(BasePointCheck->isChecked()); + return GroupConstructors->checkedId(); } //======================================================================= @@ -1181,7 +1131,7 @@ void SMESHGUI_ExtrusionAlongPathDlg::onBasePointCheck() //======================================================================= void SMESHGUI_ExtrusionAlongPathDlg::OnAngleAdded() { - AnglesList->insertItem(QString::number(AngleSpin->GetValue())); + AnglesList->addItem(QString::number(AngleSpin->GetValue())); } //======================================================================= @@ -1190,14 +1140,9 @@ void SMESHGUI_ExtrusionAlongPathDlg::OnAngleAdded() //======================================================================= void SMESHGUI_ExtrusionAlongPathDlg::OnAngleRemoved() { - QList aList; - aList.setAutoDelete(false); - for (int i = 0; i < AnglesList->count(); i++) - if (AnglesList->isSelected(i)) - aList.append(AnglesList->item(i)); - - for (int i = 0; i < aList.count(); i++) - delete aList.at(i); + QList aList = AnglesList->selectedItems(); + QListWidgetItem* anItem; + foreach(anItem, aList) delete anItem; } //================================================================================= @@ -1209,7 +1154,7 @@ bool SMESHGUI_ExtrusionAlongPathDlg::eventFilter (QObject* object, QEvent* event if (event->type() == QEvent::KeyPress) { QKeyEvent* ke = (QKeyEvent*)event; if (object == AnglesList) { - if (ke->key() == Key_Delete) + if (ke->key() == Qt::Key_Delete) OnAngleRemoved(); } } @@ -1240,9 +1185,8 @@ void SMESHGUI_ExtrusionAlongPathDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) - { - e->accept(); - ClickOnHelp(); - } + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + ClickOnHelp(); + } } diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h index c0b5b898f..6f75d5269 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h +++ b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.h @@ -1,41 +1,40 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_ExtrusionAlongPathDlg.h +// Author : Vadim SANDLER, Open CASCADE S.A.S. // -// File : SMESHGUI_ExtrusionAlongPathDlg.h -// Author : Vadim SANDLER -// Module : SMESH -// $Header: -#ifndef DIALOGBOX_EXTRUSION_PATH_H -#define DIALOGBOX_EXTRUSION_PATH_H +#ifndef SMESHGUI_EXTRUSIONALONGPATHDLG_H +#define SMESHGUI_EXTRUSIONALONGPATHDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include "LightApp_SelectionMgr.h" -#include "SUIT_SelectionFilter.h" +// Qt includes +#include -// QT Includes -#include +// IDL includes +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) class QButtonGroup; class QRadioButton; @@ -44,19 +43,15 @@ class QLabel; class QToolButton; class QLineEdit; class QCheckBox; -class QListBox; +class QListWidget; class QPushButton; class SMESHGUI; class SMESH_Actor; class SMESHGUI_SpinBox; -class SVTK_ViewWindow; class SVTK_Selector; - - -// IDL Headers -#include -#include CORBA_SERVER_HEADER(SMESH_Mesh) +class LightApp_SelectionMgr; +class SUIT_SelectionFilter; //================================================================================= // class : SMESHGUI_ExtrusionAlongPathDlg @@ -66,109 +61,92 @@ class SMESHGUI_EXPORT SMESHGUI_ExtrusionAlongPathDlg : public QDialog { Q_OBJECT - class SetBusy { - public: - SetBusy (SMESHGUI_ExtrusionAlongPathDlg* _dlg) { myDlg = _dlg; myDlg->myBusy = true; } - ~SetBusy() { myDlg->myBusy = false; } - private: - SMESHGUI_ExtrusionAlongPathDlg* myDlg; - }; + class SetBusy; friend class SetBusy; public: - SMESHGUI_ExtrusionAlongPathDlg (SMESHGUI*, - bool modal = FALSE); + SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* ); ~SMESHGUI_ExtrusionAlongPathDlg(); - bool eventFilter (QObject* object, QEvent* event); + bool eventFilter( QObject*, QEvent* ); private: - void Init (bool ResetControls = true); - void enterEvent (QEvent*); /* mouse enter the QWidget */ - void keyPressEvent(QKeyEvent*); - int GetConstructorId(); - void SetEditCurrentArgument (QToolButton* button); - - SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ - LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ - SVTK_Selector* mySelector; - - QWidget* myEditCurrentArgument; /* Current argument */ - - bool myBusy; - SMESH::SMESH_Mesh_var myMesh; - SMESH_Actor* myMeshActor; - SMESH::SMESH_IDSource_var myIDSource; - SMESH::SMESH_Mesh_var myPathMesh; - GEOM::GEOM_Object_var myPathShape; - SUIT_SelectionFilter* myElementsFilter; - SUIT_SelectionFilter* myPathMeshFilter; - int myType; + void Init( bool = true ); + void enterEvent( QEvent* ); /* mouse enter the QWidget */ + void keyPressEvent( QKeyEvent* ); + int GetConstructorId(); + void SetEditCurrentArgument( QToolButton* ); + + SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ + LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ + SVTK_Selector* mySelector; + + QWidget* myEditCurrentArgument; /* Current argument */ + + bool myBusy; + SMESH::SMESH_Mesh_var myMesh; + SMESH_Actor* myMeshActor; + SMESH::SMESH_IDSource_var myIDSource; + SMESH::SMESH_Mesh_var myPathMesh; + GEOM::GEOM_Object_var myPathShape; + SUIT_SelectionFilter* myElementsFilter; + SUIT_SelectionFilter* myPathMeshFilter; + int myType; // widgets - QButtonGroup* GroupConstructors; - QRadioButton* Elements1dRB; - QRadioButton* Elements2dRB; - - QGroupBox* GroupArguments; - QLabel* ElementsLab; - QToolButton* SelectElementsButton; - QLineEdit* ElementsLineEdit; - QCheckBox* MeshCheck; - QGroupBox* PathGrp; - QLabel* PathMeshLab; - QToolButton* SelectPathMeshButton; - QLineEdit* PathMeshLineEdit; - QLabel* PathShapeLab; - QToolButton* SelectPathShapeButton; - QLineEdit* PathShapeLineEdit; - QLabel* StartPointLab; - QToolButton* SelectStartPointButton; - QLineEdit* StartPointLineEdit; - QCheckBox* LinearAnglesCheck; - QCheckBox* AnglesCheck; - QGroupBox* AnglesGrp; - QListBox* AnglesList; - QToolButton* AddAngleButton; - QToolButton* RemoveAngleButton; - SMESHGUI_SpinBox* AngleSpin; - QCheckBox* BasePointCheck; - QGroupBox* BasePointGrp; - QToolButton* SelectBasePointButton; - QLabel* XLab; - SMESHGUI_SpinBox* XSpin; - QLabel* YLab; - SMESHGUI_SpinBox* YSpin; - QLabel* ZLab; - SMESHGUI_SpinBox* ZSpin; - QCheckBox* MakeGroupsCheck; - - QGroupBox* GroupButtons; - QPushButton* OkButton; - QPushButton* ApplyButton; - QPushButton* CloseButton; - QPushButton* HelpButton; - - QString myHelpFileName; + QGroupBox* ConstructorsBox; + QButtonGroup* GroupConstructors; + QRadioButton* Elements1dRB; + QRadioButton* Elements2dRB; + + QGroupBox* GroupArguments; + QLabel* ElementsLab; + QToolButton* SelectElementsButton; + QLineEdit* ElementsLineEdit; + QCheckBox* MeshCheck; + QGroupBox* PathGrp; + QToolButton* SelectPathMeshButton; + QLineEdit* PathMeshLineEdit; + QToolButton* SelectPathShapeButton; + QLineEdit* PathShapeLineEdit; + QToolButton* SelectStartPointButton; + QLineEdit* StartPointLineEdit; + QGroupBox* AnglesGrp; + QListWidget* AnglesList; + QToolButton* AddAngleButton; + QToolButton* RemoveAngleButton; + SMESHGUI_SpinBox* AngleSpin; + QGroupBox* BasePointGrp; + QToolButton* SelectBasePointButton; + SMESHGUI_SpinBox* XSpin; + SMESHGUI_SpinBox* YSpin; + SMESHGUI_SpinBox* ZSpin; + QCheckBox* MakeGroupsCheck; + + QGroupBox* GroupButtons; + QPushButton* OkButton; + QPushButton* ApplyButton; + QPushButton* CloseButton; + QPushButton* HelpButton; + + QString myHelpFileName; protected slots: - void reject(); + void reject(); private slots: - void ConstructorsClicked (int); - void ClickOnOk(); - bool ClickOnApply(); - void ClickOnHelp(); - void SetEditCurrentArgument(); - void SelectionIntoArgument(); - void DeactivateActiveDialog(); - void ActivateThisDialog(); - void onTextChange (const QString&); - void onSelectMesh(); - void onAnglesCheck(); - void onBasePointCheck(); - void OnAngleAdded(); - void OnAngleRemoved(); + void ConstructorsClicked( int ); + void ClickOnOk(); + bool ClickOnApply(); + void ClickOnHelp(); + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void DeactivateActiveDialog(); + void ActivateThisDialog(); + void onTextChange( const QString& ); + void onSelectMesh(); + void OnAngleAdded(); + void OnAngleRemoved(); }; -#endif // DIALOGBOX_EXTRUSION_PATH_H +#endif // SMESHGUI_EXTRUSIONALONGPATHDLG_H diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx index c41837b8c..56ccf92d8 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx @@ -1,31 +1,29 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_ExtrusionDlg.cxx +// Author : Michael ZORIN, Open CASCADE S.A.S. // -// -// File : SMESHGUI_ExtrusionDlg.cxx -// Author : Michael ZORIN -// Module : SMESH -// $Header: +// SMESH includes #include "SMESHGUI_ExtrusionDlg.h" #include "SMESHGUI.h" @@ -35,215 +33,181 @@ #include "SMESHGUI_SpinBox.h" #include "SMESHGUI_IdValidator.h" -#include "SMESH_Actor.h" -#include "SMESH_TypeFilter.hxx" -#include "SMESH_NumberFilter.hxx" -#include "SMESH_LogicalFilter.hxx" - -#include "SMDS_Mesh.hxx" +#include +#include +#include -#include "SUIT_ResourceMgr.h" -#include "SUIT_OverrideCursor.h" -#include "SUIT_Desktop.h" -#include "SUIT_MessageBox.h" -#include "SUIT_Session.h" +#include -#include "LightApp_Application.h" +// SALOME GUI includes +#include +#include +#include +#include -#include "SVTK_ViewModel.h" -#include "SVTK_ViewWindow.h" -#include "SVTK_Selector.h" -#include "SVTK_Selection.h" -#include "SALOME_ListIO.hxx" +#include +#include -#include "utilities.h" +#include +#include -// OCCT Includes +// OCCT includes #include #include -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// IDL Headers -#include "SALOMEconfig.h" +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// IDL includes +#include #include CORBA_SERVER_HEADER(SMESH_Group) #include CORBA_SERVER_HEADER(SMESH_MeshEditor) -using namespace std; +#define SPACING 6 +#define MARGIN 11 //================================================================================= // function : SMESHGUI_ExtrusionDlg() // purpose : constructor //================================================================================= -SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule, - bool modal) - : QDialog( SMESH::GetDesktop( theModule ), "SMESHGUI_ExtrusionDlg", modal, WStyle_Customize | - WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose), - mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) +SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule) + : QDialog( SMESH::GetDesktop( theModule ) ), + mySMESHGUI( theModule ), + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) { QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_EDGE"))); QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE"))); QPixmap image2 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT"))); - resize(303, 185); - setCaption(tr("EXTRUSION_ALONG_LINE")); - setSizeGripEnabled(TRUE); + setModal( false ); + setAttribute( Qt::WA_DeleteOnClose, true ); + setWindowTitle(tr("EXTRUSION_ALONG_LINE")); + setSizeGripEnabled(true); - QGridLayout* SMESHGUI_ExtrusionDlgLayout = new QGridLayout(this); - SMESHGUI_ExtrusionDlgLayout->setSpacing(6); - SMESHGUI_ExtrusionDlgLayout->setMargin(11); + QVBoxLayout* SMESHGUI_ExtrusionDlgLayout = new QVBoxLayout(this); + SMESHGUI_ExtrusionDlgLayout->setSpacing(SPACING); + SMESHGUI_ExtrusionDlgLayout->setMargin(MARGIN); /***************************************************************/ - GroupConstructors = new QButtonGroup("GroupConstructors", this); - GroupConstructors->setTitle(tr("SMESH_EXTRUSION")); - GroupConstructors->setExclusive(TRUE); - GroupConstructors->setColumnLayout(0, Qt::Vertical); - GroupConstructors->layout()->setSpacing(0); - GroupConstructors->layout()->setMargin(0); - QGridLayout* GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout()); - GroupConstructorsLayout->setAlignment(Qt::AlignTop); - GroupConstructorsLayout->setSpacing(6); - GroupConstructorsLayout->setMargin(11); - RadioButton1= new QRadioButton(GroupConstructors, "RadioButton1"); - RadioButton1->setText(tr("")); - RadioButton1->setPixmap(image0); - GroupConstructorsLayout->addWidget(RadioButton1, 0, 0); - RadioButton2= new QRadioButton(GroupConstructors, "RadioButton2"); - RadioButton2->setText(tr("")); - RadioButton2->setPixmap(image1); - GroupConstructorsLayout->addWidget(RadioButton2, 0, 2); - SMESHGUI_ExtrusionDlgLayout->addWidget(GroupConstructors, 0, 0); + ConstructorsBox = new QGroupBox(tr("SMESH_EXTRUSION"), this); + GroupConstructors = new QButtonGroup(this); + QHBoxLayout* ConstructorsBoxLayout = new QHBoxLayout(ConstructorsBox); + ConstructorsBoxLayout->setSpacing(SPACING); + ConstructorsBoxLayout->setMargin(MARGIN); + + RadioButton1= new QRadioButton(ConstructorsBox); + RadioButton1->setIcon(image0); + RadioButton2= new QRadioButton(ConstructorsBox); + RadioButton2->setIcon(image1); + + ConstructorsBoxLayout->addWidget(RadioButton1); + ConstructorsBoxLayout->addWidget(RadioButton2); + + GroupConstructors->addButton(RadioButton1, 0); + GroupConstructors->addButton(RadioButton2, 1); /***************************************************************/ - GroupButtons = new QGroupBox(this, "GroupButtons"); - GroupButtons->setGeometry(QRect(10, 10, 281, 48)); - GroupButtons->setTitle(tr("")); - GroupButtons->setColumnLayout(0, Qt::Vertical); - GroupButtons->layout()->setSpacing(0); - GroupButtons->layout()->setMargin(0); - QGridLayout* GroupButtonsLayout = new QGridLayout(GroupButtons->layout()); - GroupButtonsLayout->setAlignment(Qt::AlignTop); - GroupButtonsLayout->setSpacing(6); - GroupButtonsLayout->setMargin(11); - buttonHelp = new QPushButton(GroupButtons, "buttonHelp"); - buttonHelp->setText(tr("SMESH_BUT_HELP" )); - buttonHelp->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonHelp, 0, 4); - buttonCancel = new QPushButton(GroupButtons, "buttonCancel"); - buttonCancel->setText(tr("SMESH_BUT_CLOSE" )); - buttonCancel->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonCancel, 0, 3); - buttonApply = new QPushButton(GroupButtons, "buttonApply"); - buttonApply->setText(tr("SMESH_BUT_APPLY" )); - buttonApply->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonApply, 0, 1); - QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - GroupButtonsLayout->addItem(spacer_9, 0, 2); - buttonOk = new QPushButton(GroupButtons, "buttonOk"); - buttonOk->setText(tr("SMESH_BUT_OK" )); - buttonOk->setAutoDefault(TRUE); - buttonOk->setDefault(TRUE); - GroupButtonsLayout->addWidget(buttonOk, 0, 0); - SMESHGUI_ExtrusionDlgLayout->addWidget(GroupButtons, 2, 0); + GroupButtons = new QGroupBox(this); + QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons); + GroupButtonsLayout->setSpacing(SPACING); + GroupButtonsLayout->setMargin(MARGIN); + + buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk->setAutoDefault(true); + buttonOk->setDefault(true); + buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); + buttonApply->setAutoDefault(true); + buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons); + buttonCancel->setAutoDefault(true); + buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons); + buttonHelp->setAutoDefault(true); + + GroupButtonsLayout->addWidget(buttonOk); + GroupButtonsLayout->addSpacing(10); + GroupButtonsLayout->addWidget(buttonApply); + GroupButtonsLayout->addSpacing(10); + GroupButtonsLayout->addStretch(); + GroupButtonsLayout->addWidget(buttonCancel); + GroupButtonsLayout->addWidget(buttonHelp); /***************************************************************/ - GroupArguments = new QGroupBox(this, "GroupArguments"); - GroupArguments->setTitle(tr("EXTRUSION_1D")); - GroupArguments->setColumnLayout(0, Qt::Vertical); - GroupArguments->layout()->setSpacing(0); - GroupArguments->layout()->setMargin(0); - QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments->layout()); - GroupArgumentsLayout->setAlignment(Qt::AlignTop); - GroupArgumentsLayout->setSpacing(6); - GroupArgumentsLayout->setMargin(11); + GroupArguments = new QGroupBox(tr("EXTRUSION_1D"), this); + QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments); + GroupArgumentsLayout->setSpacing(SPACING); + GroupArgumentsLayout->setMargin(MARGIN); // Controls for elements selection - TextLabelElements = new QLabel(GroupArguments, "TextLabelElements"); - TextLabelElements->setText(tr("SMESH_ID_ELEMENTS" )); - TextLabelElements->setFixedWidth(74); - GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0); - - SelectElementsButton = new QPushButton(GroupArguments, "SelectElementsButton"); - SelectElementsButton->setText(tr("" )); - SelectElementsButton->setPixmap(image2); - SelectElementsButton->setToggleButton(FALSE); - GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1); + TextLabelElements = new QLabel(tr("SMESH_ID_ELEMENTS"), GroupArguments); + + SelectElementsButton = new QPushButton(GroupArguments); + SelectElementsButton->setIcon(image2); - LineEditElements = new QLineEdit(GroupArguments, "LineEditElements"); - LineEditElements->setValidator(new SMESHGUI_IdValidator(this, "validator")); - GroupArgumentsLayout->addMultiCellWidget(LineEditElements, 0, 0, 2, 7); + LineEditElements = new QLineEdit(GroupArguments); + LineEditElements->setValidator(new SMESHGUI_IdValidator(this)); // Control for the whole mesh selection - CheckBoxMesh = new QCheckBox(GroupArguments, "CheckBoxMesh"); - CheckBoxMesh->setText(tr("SMESH_SELECT_WHOLE_MESH" )); - GroupArgumentsLayout->addMultiCellWidget(CheckBoxMesh, 1, 1, 0, 7); + CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments); // Controls for vector selection - TextLabelVector = new QLabel(GroupArguments, "TextLabelVector"); - TextLabelVector->setText(tr("SMESH_VECTOR")); - GroupArgumentsLayout->addWidget(TextLabelVector, 2, 0); + TextLabelVector = new QLabel(tr("SMESH_VECTOR"), GroupArguments); - TextLabelDx = new QLabel(GroupArguments, "TextLabelDx"); - TextLabelDx->setText(tr("SMESH_DX")); - GroupArgumentsLayout->addWidget(TextLabelDx, 2, 2); + TextLabelDx = new QLabel(tr("SMESH_DX"), GroupArguments); + SpinBox_Dx = new SMESHGUI_SpinBox(GroupArguments); - SpinBox_Dx = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Dx"); - GroupArgumentsLayout->addWidget(SpinBox_Dx, 2, 3); + TextLabelDy = new QLabel(tr("SMESH_DY"), GroupArguments); + SpinBox_Dy = new SMESHGUI_SpinBox(GroupArguments); - TextLabelDy = new QLabel(GroupArguments, "TextLabelDy"); - TextLabelDy->setText(tr("SMESH_DY")); - GroupArgumentsLayout->addWidget(TextLabelDy, 2, 4); - - SpinBox_Dy = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Dy"); - GroupArgumentsLayout->addWidget(SpinBox_Dy, 2, 5); - - TextLabelDz = new QLabel(GroupArguments, "TextLabelDz"); - TextLabelDz->setText(tr("SMESH_DZ")); - GroupArgumentsLayout->addWidget(TextLabelDz, 2, 6); - - SpinBox_Dz = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Dz"); - GroupArgumentsLayout->addWidget(SpinBox_Dz, 2, 7); + TextLabelDz = new QLabel(tr("SMESH_DZ"), GroupArguments); + SpinBox_Dz = new SMESHGUI_SpinBox(GroupArguments); // Controls for nb. steps defining - TextLabelNbSteps = new QLabel(GroupArguments, "TextLabelNbSteps"); - TextLabelNbSteps->setText(tr("SMESH_NUMBEROFSTEPS" )); - GroupArgumentsLayout->addMultiCellWidget(TextLabelNbSteps, 3, 3, 0, 1); - - SpinBox_NbSteps = new QSpinBox(GroupArguments, "SpinBox_NbSteps"); - GroupArgumentsLayout->addMultiCellWidget(SpinBox_NbSteps, 3, 3, 2, 7); + TextLabelNbSteps = new QLabel(tr("SMESH_NUMBEROFSTEPS"), GroupArguments); + SpinBox_NbSteps = new QSpinBox(GroupArguments); // CheckBox for groups generation MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments); - MakeGroupsCheck->setChecked(true); - GroupArgumentsLayout->addMultiCellWidget(MakeGroupsCheck, 4, 4, 0, 7); + GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0); + GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1); + GroupArgumentsLayout->addWidget(LineEditElements, 0, 2, 1, 6); + GroupArgumentsLayout->addWidget(CheckBoxMesh, 0, 0, 1, 8); + GroupArgumentsLayout->addWidget(TextLabelVector, 2, 0); + GroupArgumentsLayout->addWidget(TextLabelDx, 2, 2); + GroupArgumentsLayout->addWidget(SpinBox_Dx, 2, 3); + GroupArgumentsLayout->addWidget(TextLabelDy, 2, 4); + GroupArgumentsLayout->addWidget(SpinBox_Dy, 2, 5); + GroupArgumentsLayout->addWidget(TextLabelDz, 2, 6); + GroupArgumentsLayout->addWidget(SpinBox_Dz, 2, 7); + GroupArgumentsLayout->addWidget(TextLabelNbSteps, 3, 0); + GroupArgumentsLayout->addWidget(SpinBox_NbSteps, 3, 2, 1, 6); + GroupArgumentsLayout->addWidget(MakeGroupsCheck, 4, 0, 1, 8); - SMESHGUI_ExtrusionDlgLayout->addWidget(GroupArguments, 1, 0); + /***************************************************************/ + SMESHGUI_ExtrusionDlgLayout->addWidget(ConstructorsBox); + SMESHGUI_ExtrusionDlgLayout->addWidget(GroupArguments); + SMESHGUI_ExtrusionDlgLayout->addWidget(GroupButtons); /* Initialisations */ SpinBox_Dx->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); SpinBox_Dy->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); SpinBox_Dz->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); - QIntValidator* anIntValidator = new QIntValidator(SpinBox_NbSteps); - SpinBox_NbSteps->setValidator(anIntValidator); SpinBox_NbSteps->setRange(1, 999999); - GroupArguments->show(); - RadioButton1->setChecked(TRUE); + RadioButton1->setChecked(true); + MakeGroupsCheck->setChecked(true); mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); @@ -253,7 +217,7 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule, SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH); SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter (GROUP); - QPtrList aListOfFilters; + QList aListOfFilters; if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter); if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter); @@ -266,29 +230,27 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule, /***************************************************************/ // signals and slots connections - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); // to update state of the Ok & Apply buttons connect(SpinBox_Dx, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable())); connect(SpinBox_Dy, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable())); connect(SpinBox_Dz, SIGNAL(valueChanged(double)), SLOT(CheckIsEnable())); - connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int))); - connect(SelectElementsButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument())); - connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); - connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(GroupConstructors, SIGNAL(buttonClicked(int)), SLOT(ConstructorsClicked(int))); + connect(SelectElementsButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); /* to close dialog if study change */ - connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); - connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&))); - connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool))); + connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&))); + connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool))); /***************************************************************/ - this->show(); // displays Dialog - ConstructorsClicked(0); SelectionIntoArgument(); } @@ -299,7 +261,6 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule, //================================================================================= SMESHGUI_ExtrusionDlg::~SMESHGUI_ExtrusionDlg() { - // no need to delete child widgets, Qt does it all for us } //================================================================================= @@ -406,7 +367,7 @@ bool SMESHGUI_ExtrusionDlg::ClickOnApply() try { SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); - QApplication::setOverrideCursor(Qt::waitCursor); + QApplication::setOverrideCursor(Qt::WaitCursor); if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) SMESH::ListOfGroups_var groups = @@ -465,16 +426,17 @@ void SMESHGUI_ExtrusionDlg::ClickOnHelp() if (app) app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); else { - QString platform; + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName)); } } @@ -498,7 +460,7 @@ void SMESHGUI_ExtrusionDlg::onTextChange (const QString& theNewText) // hilight entered elements/nodes if (!myIO.IsNull()) { - QStringList aListId = QStringList::split(" ", theNewText, false); + QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts); if (send == LineEditElements) { @@ -685,8 +647,8 @@ void SMESHGUI_ExtrusionDlg::SetEditCurrentArgument() //================================================================================= void SMESHGUI_ExtrusionDlg::DeactivateActiveDialog() { - if (GroupConstructors->isEnabled()) { - GroupConstructors->setEnabled(false); + if (ConstructorsBox->isEnabled()) { + ConstructorsBox->setEnabled(false); GroupArguments->setEnabled(false); GroupButtons->setEnabled(false); mySMESHGUI->ResetState(); @@ -702,7 +664,7 @@ void SMESHGUI_ExtrusionDlg::ActivateThisDialog() { // Emit a signal to deactivate the active dialog mySMESHGUI->EmitSignalDeactivateDialog(); - GroupConstructors->setEnabled(true); + ConstructorsBox->setEnabled(true); GroupArguments->setEnabled(true); GroupButtons->setEnabled(true); @@ -718,30 +680,10 @@ void SMESHGUI_ExtrusionDlg::ActivateThisDialog() //================================================================================= void SMESHGUI_ExtrusionDlg::enterEvent (QEvent*) { - if (!GroupConstructors->isEnabled()) + if (!ConstructorsBox->isEnabled()) ActivateThisDialog(); } -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -//void SMESHGUI_ExtrusionDlg::closeEvent (QCloseEvent*) -//{ -// /* same than click on cancel button */ -// this->ClickOnCancel(); -//} -// -//================================================================================= -// function : hideEvent() -// purpose : caused by ESC key -//================================================================================= -//void SMESHGUI_ExtrusionDlg::hideEvent (QHideEvent*) -//{ -// if (!isMinimized()) -// ClickOnCancel(); -//} - //================================================================================= // function : onSelectMesh() // purpose : @@ -791,9 +733,7 @@ void SMESHGUI_ExtrusionDlg::onSelectMesh (bool toSelectMesh) //================================================================================= int SMESHGUI_ExtrusionDlg::GetConstructorId() { - if (GroupConstructors != NULL && GroupConstructors->selected() != NULL) - return GroupConstructors->id(GroupConstructors->selected()); - return -1; + return GroupConstructors->checkedId(); } //================================================================================= @@ -806,9 +746,8 @@ void SMESHGUI_ExtrusionDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) - { - e->accept(); - ClickOnHelp(); - } + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + ClickOnHelp(); + } } diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.h b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.h index 9a9c21e7a..3b4b28fb6 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.h +++ b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.h @@ -1,44 +1,44 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_ExtrusionDlg.h +// Author : Michael ZORIN, Open CASCADE S.A.S. // -// File : SMESHGUI_ExtrusionDlg.h -// Author : Michael ZORIN -// Module : SMESH -// $Header: -#ifndef DIALOGBOX_EXTRUSION_H -#define DIALOGBOX_EXTRUSION_H +#ifndef SMESHGUI_EXTRUSIONDLG_H +#define SMESHGUI_EXTRUSIONDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include "LightApp_SelectionMgr.h" -#include "SUIT_SelectionFilter.h" -#include "Handle_SALOME_InteractiveObject.hxx" +// SALOME GUI includes +#include -// QT Includes -#include +// Qt includes +#include + +// IDL includes +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) -class QGridLayout; class QButtonGroup; class QRadioButton; class QGroupBox; @@ -51,12 +51,9 @@ class QPushButton; class SMESHGUI; class SMESH_Actor; class SMESHGUI_SpinBox; -class SVTK_ViewWindow; class SVTK_Selector; - -// IDL Headers -#include -#include CORBA_SERVER_HEADER(SMESH_Mesh) +class LightApp_SelectionMgr; +class SUIT_SelectionFilter; //================================================================================= // class : SMESHGUI_ExtrusionDlg @@ -67,74 +64,71 @@ class SMESHGUI_EXPORT SMESHGUI_ExtrusionDlg : public QDialog Q_OBJECT public: - SMESHGUI_ExtrusionDlg (SMESHGUI*, - bool modal = FALSE); + SMESHGUI_ExtrusionDlg( SMESHGUI* ); ~SMESHGUI_ExtrusionDlg(); private: - void Init (bool ResetControls = true); - void enterEvent (QEvent*); /* mouse enter the QWidget */ - void keyPressEvent(QKeyEvent*); - int GetConstructorId(); - //void closeEvent (QCloseEvent*); - //void hideEvent (QHideEvent*); /* ESC key */ - - SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ - LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - //QString myElementsId; - int myNbOkElements; /* to check when elements are defined */ - SVTK_Selector* mySelector; - - bool myBusy; - SMESH::SMESH_Mesh_var myMesh; - SMESH::long_array_var myElementsId; - SMESH_Actor* myActor; + void Init( bool = true ); + void enterEvent( QEvent* ); /* mouse enter the QWidget */ + void keyPressEvent( QKeyEvent* ); + int GetConstructorId(); + + SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ + LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ + QLineEdit* myEditCurrentArgument; /* Current LineEdit */ + int myNbOkElements; /* to check when elements are defined */ + SVTK_Selector* mySelector; + + bool myBusy; + SMESH::SMESH_Mesh_var myMesh; + SMESH::long_array_var myElementsId; + SMESH_Actor* myActor; Handle(SALOME_InteractiveObject) myIO; - SUIT_SelectionFilter* myMeshOrSubMeshOrGroupFilter; + SUIT_SelectionFilter* myMeshOrSubMeshOrGroupFilter; // widgets - QButtonGroup* GroupConstructors; - QRadioButton* RadioButton1; - QRadioButton* RadioButton2; - - QGroupBox* GroupArguments; - QLabel* TextLabelElements; - QPushButton* SelectElementsButton; - QLineEdit* LineEditElements; - QCheckBox* CheckBoxMesh; - QLabel* TextLabelVector; - QLabel* TextLabelDx; - SMESHGUI_SpinBox* SpinBox_Dx; - QLabel* TextLabelDy; - SMESHGUI_SpinBox* SpinBox_Dy; - QLabel* TextLabelDz; - SMESHGUI_SpinBox* SpinBox_Dz; - QLabel* TextLabelNbSteps; - QSpinBox* SpinBox_NbSteps; - QCheckBox* MakeGroupsCheck; - - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QPushButton* buttonHelp; - - QString myHelpFileName; + QGroupBox* ConstructorsBox; + QButtonGroup* GroupConstructors; + QRadioButton* RadioButton1; + QRadioButton* RadioButton2; + + QGroupBox* GroupArguments; + QLabel* TextLabelElements; + QPushButton* SelectElementsButton; + QLineEdit* LineEditElements; + QCheckBox* CheckBoxMesh; + QLabel* TextLabelVector; + QLabel* TextLabelDx; + SMESHGUI_SpinBox* SpinBox_Dx; + QLabel* TextLabelDy; + SMESHGUI_SpinBox* SpinBox_Dy; + QLabel* TextLabelDz; + SMESHGUI_SpinBox* SpinBox_Dz; + QLabel* TextLabelNbSteps; + QSpinBox* SpinBox_NbSteps; + QCheckBox* MakeGroupsCheck; + + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QPushButton* buttonApply; + QPushButton* buttonHelp; + + QString myHelpFileName; private slots: - void ConstructorsClicked (int); - void CheckIsEnable(); - void ClickOnOk(); - bool ClickOnApply(); - void ClickOnCancel(); - void ClickOnHelp(); - void SetEditCurrentArgument(); - void SelectionIntoArgument(); - void DeactivateActiveDialog(); - void ActivateThisDialog(); - void onTextChange (const QString&); - void onSelectMesh (bool toSelectMesh); + void ConstructorsClicked( int ); + void CheckIsEnable(); + void ClickOnOk(); + bool ClickOnApply(); + void ClickOnCancel(); + void ClickOnHelp(); + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void DeactivateActiveDialog(); + void ActivateThisDialog(); + void onTextChange( const QString& ); + void onSelectMesh( bool ); }; -#endif // DIALOGBOX_EXTRUSION_H +#endif // SMESHGUI_EXTRUSIONDLG_H diff --git a/src/SMESHGUI/SMESHGUI_Filter.cxx b/src/SMESHGUI/SMESHGUI_Filter.cxx index bb0905239..de8af3acd 100755 --- a/src/SMESHGUI/SMESHGUI_Filter.cxx +++ b/src/SMESHGUI/SMESHGUI_Filter.cxx @@ -1,46 +1,36 @@ -// SMESHGUI_PredicateFilter : Filters for VTK viewer +// SMESHGUI_Filter : Filters for VTK viewer // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_Filter.cxx +// Author : Sergey LITONIN, Open CASCADE S.A.S. // -// -// File : SMESHGUI_Filter.cxx -// Author : Sergey LITONIN -// Module : SMESH +// SMESH includes #include "SMESHGUI_Filter.h" -#include "SMESHGUI.h" #include "SMESHGUI_Utils.h" -#include "SMESH_Actor.h" -#include "SMDS_Mesh.hxx" -#include "SMDS_MeshElement.hxx" -#include "SMDSAbs_ElementType.hxx" - -// OCCT Includes -#include -#include - -// VTK Includes -#include +#include +#include +#include IMPLEMENT_STANDARD_HANDLE(SMESHGUI_Filter, VTKViewer_Filter) IMPLEMENT_STANDARD_RTTIEXT(SMESHGUI_Filter, VTKViewer_Filter) @@ -138,7 +128,7 @@ bool SMESHGUI_PredicateFilter::IsObjValid( const int theObjId ) const //======================================================================= bool SMESHGUI_PredicateFilter::IsNodeFilter() const { - return GetId() == SMESHGUI_NodeFilter; + return GetId() == SMESH::NodeFilter; } //======================================================================= @@ -182,12 +172,12 @@ void SMESHGUI_PredicateFilter::SetActor( SALOME_Actor* theActor ) //======================================================================= int SMESHGUI_PredicateFilter::GetId() const { - if ( myPred->GetElementType() == SMESH::NODE ) return SMESHGUI_NodeFilter; - else if ( myPred->GetElementType() == SMESH::EDGE ) return SMESHGUI_EdgeFilter; - else if ( myPred->GetElementType() == SMESH::FACE ) return SMESHGUI_FaceFilter; - else if ( myPred->GetElementType() == SMESH::VOLUME ) return SMESHGUI_VolumeFilter; - else if ( myPred->GetElementType() == SMESH::ALL ) return SMESHGUI_AllElementsFilter; - else return SMESHGUI_UnknownFilter; + if ( myPred->GetElementType() == SMESH::NODE ) return SMESH::NodeFilter; + else if ( myPred->GetElementType() == SMESH::EDGE ) return SMESH::EdgeFilter; + else if ( myPred->GetElementType() == SMESH::FACE ) return SMESH::FaceFilter; + else if ( myPred->GetElementType() == SMESH::VOLUME ) return SMESH::VolumeFilter; + else if ( myPred->GetElementType() == SMESH::ALL ) return SMESH::AllElementsFilter; + else return SMESH::UnknownFilter; } @@ -256,7 +246,7 @@ bool SMESHGUI_QuadrangleFilter::IsObjValid( const int theObjId ) const //======================================================================= int SMESHGUI_QuadrangleFilter::GetId() const { - return SMESHGUI_QuadFilter; + return SMESH::QuadFilter; } //======================================================================= @@ -335,7 +325,7 @@ bool SMESHGUI_TriangleFilter::IsObjValid( const int theObjId ) const //======================================================================= int SMESHGUI_TriangleFilter::GetId() const { - return SMESHGUI_TriaFilter; + return SMESH::TriaFilter; } //======================================================================= @@ -411,7 +401,7 @@ bool SMESHGUI_FacesFilter::IsObjValid( const int theObjId ) const //======================================================================= int SMESHGUI_FacesFilter::GetId() const { - return SMESHGUI_FaceFilter; + return SMESH::FaceFilter; } //======================================================================= @@ -488,7 +478,7 @@ bool SMESHGUI_VolumesFilter::IsObjValid( const int theObjId ) const //======================================================================= int SMESHGUI_VolumesFilter::GetId() const { - return SMESHGUI_VolumeFilter; + return SMESH::VolumeFilter; } //======================================================================= diff --git a/src/SMESHGUI/SMESHGUI_Filter.h b/src/SMESHGUI/SMESHGUI_Filter.h index 4f912cdb8..8fdbc5a2f 100755 --- a/src/SMESHGUI/SMESHGUI_Filter.h +++ b/src/SMESHGUI/SMESHGUI_Filter.h @@ -1,53 +1,56 @@ -// SMESHGUI_Filter : Filters for VTK viewer +// SMESHGUI_Filter : Filters for VTK viewer // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_Filter.h +// Author : Sergey LITONIN, Open CASCADE S.A.S. // -// File : SMESHGUI_Filter.h -// Author : Sergey LITONIN -// Module : SMESH -#ifndef SMESHGUI_Filter_HeaderFile -#define SMESHGUI_Filter_HeaderFile +#ifndef SMESHGUI_FILTER_H +#define SMESHGUI_FILTER_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include "VTKViewer_Filter.h" +// SALOME GUI includes +#include +// IDL includes #include #include CORBA_SERVER_HEADER(SMESH_Filter) class SALOME_Actor; -enum SMESHGUI_FilterType +namespace SMESH { - SMESHGUI_UnknownFilter = -1, - SMESHGUI_NodeFilter = 0, - SMESHGUI_EdgeFilter = 1, - SMESHGUI_FaceFilter = 2, - SMESHGUI_VolumeFilter = 3, - SMESHGUI_AllElementsFilter = 4, - SMESHGUI_QuadFilter = 5, - SMESHGUI_TriaFilter = 6, - SMESHGUI_LastFilter + enum SMESHGUI_FilterType { + UnknownFilter = -1, + NodeFilter = 0, + EdgeFilter = 1, + FaceFilter = 2, + VolumeFilter = 3, + AllElementsFilter = 4, + QuadFilter = 5, + TriaFilter = 6, + LastFilter + }; }; /* @@ -57,12 +60,11 @@ enum SMESHGUI_FilterType DEFINE_STANDARD_HANDLE(SMESHGUI_Filter, VTKViewer_Filter) -class SMESHGUI_Filter : public VTKViewer_Filter +class SMESHGUI_EXPORT SMESHGUI_Filter : public VTKViewer_Filter { - public: + virtual bool IsObjValid( const int ) const = 0; - virtual bool IsObjValid( const int theObjId ) const = 0; public: DEFINE_STANDARD_RTTI(SMESHGUI_Filter) }; @@ -75,15 +77,14 @@ public: DEFINE_STANDARD_HANDLE(SMESHGUI_PredicateFilter, SMESHGUI_Filter) -class SMESHGUI_PredicateFilter : public SMESHGUI_Filter +class SMESHGUI_EXPORT SMESHGUI_PredicateFilter : public SMESHGUI_Filter { - public: - SMESHGUI_PredicateFilter(); - virtual ~SMESHGUI_PredicateFilter(); + SMESHGUI_PredicateFilter(); + virtual ~SMESHGUI_PredicateFilter(); - virtual bool IsValid( const int theCellId ) const; - virtual bool IsObjValid( const int theObjId ) const; + virtual bool IsValid( const int ) const; + virtual bool IsObjValid( const int ) const; virtual int GetId() const; virtual bool IsNodeFilter() const; void SetPredicate( SMESH::Predicate_ptr ); @@ -91,7 +92,6 @@ public: void SetActor( SALOME_Actor* ); private: - SMESH::Predicate_var myPred; public: @@ -105,15 +105,14 @@ public: DEFINE_STANDARD_HANDLE(SMESHGUI_QuadrangleFilter, SMESHGUI_Filter) -class SMESHGUI_QuadrangleFilter : public SMESHGUI_Filter +class SMESHGUI_EXPORT SMESHGUI_QuadrangleFilter : public SMESHGUI_Filter { - public: - SMESHGUI_QuadrangleFilter(); - virtual ~SMESHGUI_QuadrangleFilter(); + SMESHGUI_QuadrangleFilter(); + virtual ~SMESHGUI_QuadrangleFilter(); - virtual bool IsValid( const int theCellId ) const; - virtual bool IsObjValid( const int theObjId ) const; + virtual bool IsValid( const int ) const; + virtual bool IsObjValid( const int ) const; virtual int GetId() const; virtual bool IsNodeFilter() const; @@ -128,15 +127,14 @@ public: DEFINE_STANDARD_HANDLE(SMESHGUI_TriangleFilter, SMESHGUI_Filter) -class SMESHGUI_TriangleFilter : public SMESHGUI_Filter +class SMESHGUI_EXPORT SMESHGUI_TriangleFilter : public SMESHGUI_Filter { - public: - SMESHGUI_TriangleFilter(); - virtual ~SMESHGUI_TriangleFilter(); + SMESHGUI_TriangleFilter(); + virtual ~SMESHGUI_TriangleFilter(); - virtual bool IsValid( const int theCellId ) const; - virtual bool IsObjValid( const int theObjId ) const; + virtual bool IsValid( const int ) const; + virtual bool IsObjValid( const int ) const; virtual int GetId() const; virtual bool IsNodeFilter() const; @@ -151,15 +149,14 @@ public: DEFINE_STANDARD_HANDLE(SMESHGUI_FacesFilter, SMESHGUI_Filter) -class SMESHGUI_FacesFilter : public SMESHGUI_Filter +class SMESHGUI_EXPORT SMESHGUI_FacesFilter : public SMESHGUI_Filter { - public: - SMESHGUI_FacesFilter(); - virtual ~SMESHGUI_FacesFilter(); + SMESHGUI_FacesFilter(); + virtual ~SMESHGUI_FacesFilter(); - virtual bool IsValid( const int theCellId ) const; - virtual bool IsObjValid( const int theObjId ) const; + virtual bool IsValid( const int ) const; + virtual bool IsObjValid( const int ) const; virtual int GetId() const; virtual bool IsNodeFilter() const; @@ -174,15 +171,14 @@ public: DEFINE_STANDARD_HANDLE(SMESHGUI_VolumesFilter, SMESHGUI_Filter) -class SMESHGUI_VolumesFilter : public SMESHGUI_Filter +class SMESHGUI_EXPORT SMESHGUI_VolumesFilter : public SMESHGUI_Filter { - public: - SMESHGUI_VolumesFilter(); - virtual ~SMESHGUI_VolumesFilter(); + SMESHGUI_VolumesFilter(); + virtual ~SMESHGUI_VolumesFilter(); - virtual bool IsValid( const int theCellId ) const; - virtual bool IsObjValid( const int theObjId ) const; + virtual bool IsValid( const int ) const; + virtual bool IsObjValid( const int ) const; virtual int GetId() const; virtual bool IsNodeFilter() const; @@ -190,4 +186,4 @@ public: DEFINE_STANDARD_RTTI(SMESHGUI_VolumesFilter) }; -#endif +#endif // SMESHGUI_FILTER_H diff --git a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx index db1157c1d..caa1fb900 100755 --- a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx @@ -1,30 +1,29 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_FilterDlg.cxx +// Author : Sergey LITONIN, Open CASCADE S.A.S. // -// -// File : SMESHGUI_FilterDlg.cxx -// Author : Sergey LITONIN -// Module : SMESH +// SMESH includes #include "SMESHGUI_FilterDlg.h" #include "SMESHGUI.h" @@ -34,36 +33,39 @@ #include "SMESHGUI_FilterUtils.h" #include "SMESHGUI_FilterLibraryDlg.h" -#include "SMESH_Actor.h" -#include "SMESH_NumberFilter.hxx" -#include "SMESH_TypeFilter.hxx" +#include +#include +#include + +// SALOME GEOM includes +#include +#include +#include -#include "GEOMBase.h" -#include "GEOM_FaceFilter.h" -#include "GEOM_TypeFilter.h" +// SALOME GUI includes +#include +#include +#include +#include -#include "SUIT_Desktop.h" -#include "SUIT_ResourceMgr.h" -#include "SUIT_Session.h" -#include "SUIT_MessageBox.h" +#include +#include +#include +#include -#include "LightApp_Application.h" -#include "SalomeApp_Tools.h" -#include "SalomeApp_Study.h" +#include +#include +#include -#include "SALOME_ListIO.hxx" -#include "SALOME_ListIteratorOfListIO.hxx" -#include "SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx" -#include "SALOMEDSClient_Study.hxx" +#include -#include "SVTK_ViewWindow.h" -#include "SVTK_Selector.h" +// SALOME KERNEL includes +#include -// OCCT Includes +// OCCT includes #include #include #include -#include #include #include #include @@ -72,57 +74,63 @@ #include #include -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// IDL Headers -#include "SALOMEconfig.h" +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// IDL includes +#include #include CORBA_SERVER_HEADER(SMESH_Group) -#define SPACING 5 -#define MARGIN 10 - -using namespace SMESH; +#define SPACING 6 +#define MARGIN 11 +//--------------------------------------- +// maxLength +//--------------------------------------- static int maxLength (const QMap theMap, const QFontMetrics& theMetrics) { int aRes = 0; QMap::const_iterator anIter; for (anIter = theMap.begin(); anIter != theMap.end(); ++anIter) - aRes = Max(aRes, theMetrics.width(anIter.data())); + aRes = qMax(aRes, theMetrics.width(anIter.value())); return aRes; } +//--------------------------------------- +// getFilterId +//--------------------------------------- static int getFilterId (SMESH::ElementType theType) { switch (theType) { - case SMESH::NODE : return SMESHGUI_NodeFilter; - case SMESH::EDGE : return SMESHGUI_EdgeFilter; - case SMESH::FACE : return SMESHGUI_FaceFilter; - case SMESH::VOLUME : return SMESHGUI_VolumeFilter; - case SMESH::ALL : return SMESHGUI_AllElementsFilter; - default : return SMESHGUI_UnknownFilter; + case SMESH::NODE : return SMESH::NodeFilter; + case SMESH::EDGE : return SMESH::EdgeFilter; + case SMESH::FACE : return SMESH::FaceFilter; + case SMESH::VOLUME : return SMESH::VolumeFilter; + case SMESH::ALL : return SMESH::AllElementsFilter; + default : return SMESH::UnknownFilter; } } @@ -131,33 +139,32 @@ static int getFilterId (SMESH::ElementType theType) Description : Class for storing additional parameters of criterion */ -class SMESHGUI_FilterTable::AdditionalWidget : public QFrame +class SMESHGUI_FilterTable::AdditionalWidget : public QWidget { public: enum { Tolerance }; public: - - AdditionalWidget(QWidget* theParent); - virtual ~AdditionalWidget(); - - virtual void GetParameters(QValueList&) const; - virtual bool IsValid(const bool theMsg = true) const; - virtual double GetDouble(const int theId) const; - virtual int GetInteger(const int theId) const; - virtual QString GetString(const int theId) const; - virtual void SetDouble(const int theId, const double theVal); - virtual void SetInteger(const int theId, const int theVal); - virtual void SetString(const int theId, const QString& theVal); - void SetEditable(const int theId, const bool isEditable); - void SetEditable(const bool isEditable); + AdditionalWidget(QWidget* theParent); + virtual ~AdditionalWidget(); + + virtual QList GetParameters() const; + virtual bool IsValid(const bool = true) const; + virtual double GetDouble(const int) const; + virtual int GetInteger(const int) const; + virtual QString GetString(const int) const; + virtual void SetDouble(const int, const double); + virtual void SetInteger(const int, const int); + virtual void SetString(const int, const QString&); + void SetEditable(const int, const bool); + void SetEditable(const bool); private: QMap< int, QLineEdit* > myLineEdits; }; SMESHGUI_FilterTable::AdditionalWidget::AdditionalWidget (QWidget* theParent) - : QFrame(theParent) + : QWidget(theParent) { QLabel* aLabel = new QLabel(tr("SMESH_TOLERANCE"), this); myLineEdits[ Tolerance ] = new QLineEdit(this); @@ -165,25 +172,27 @@ SMESHGUI_FilterTable::AdditionalWidget::AdditionalWidget (QWidget* theParent) aValidator->setBottom(0); myLineEdits[ Tolerance ]->setValidator(aValidator); - QHBoxLayout* aLay = new QHBoxLayout(this, 0, SPACING); + QHBoxLayout* aLay = new QHBoxLayout(this); + aLay->setSpacing(SPACING); + aLay->setMargin(0); + aLay->addWidget(aLabel); aLay->addWidget(myLineEdits[ Tolerance ]); - - QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); - aLay->addItem(aSpacer); + aLay->addStretch(); QString aText = QString("%1").arg(Precision::Confusion()); myLineEdits[ Tolerance ]->setText(aText); } - SMESHGUI_FilterTable::AdditionalWidget::~AdditionalWidget() +SMESHGUI_FilterTable::AdditionalWidget::~AdditionalWidget() { } -void SMESHGUI_FilterTable::AdditionalWidget::GetParameters (QValueList& theList) const +QList SMESHGUI_FilterTable::AdditionalWidget::GetParameters() const { - theList.clear(); + QList theList; theList.append(Tolerance); + return theList; } bool SMESHGUI_FilterTable::AdditionalWidget::IsValid (const bool theMsg) const @@ -191,17 +200,16 @@ bool SMESHGUI_FilterTable::AdditionalWidget::IsValid (const bool theMsg) const if (!isEnabled()) return true; - QValueList aParams; - GetParameters(aParams); - QValueList::const_iterator anIter; + QList aParams = GetParameters(); + QList::const_iterator anIter; for (anIter = aParams.begin(); anIter != aParams.end(); ++anIter) { const QLineEdit* aWg = myLineEdits[ *anIter ]; int p = 0; QString aText = aWg->text(); if (aWg->isEnabled() && aWg->validator()->validate(aText, p) != QValidator::Acceptable) { if (theMsg) - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), - tr("SMESHGUI_INVALID_PARAMETERS"), QMessageBox::Ok); + SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), + tr("SMESHGUI_INVALID_PARAMETERS")); return false; } } @@ -245,16 +253,15 @@ void SMESHGUI_FilterTable::AdditionalWidget::SetString (const int theId, const Q void SMESHGUI_FilterTable::AdditionalWidget::SetEditable (const int theId, const bool isEditable) { if (myLineEdits.contains(theId)) - myLineEdits[ theId ]->setEdited(isEditable); + myLineEdits[ theId ]->setReadOnly(!isEditable); } void SMESHGUI_FilterTable::AdditionalWidget::SetEditable (const bool isEditable) { - QValueList aParams; - GetParameters(aParams); - QValueList::const_iterator anIter; + QList aParams = GetParameters(); + QList::const_iterator anIter; for (anIter = aParams.begin(); anIter != aParams.end(); ++anIter) - myLineEdits[ *anIter ]->setEdited(isEditable); + SetEditable( *anIter, isEditable ); } /* @@ -262,83 +269,246 @@ void SMESHGUI_FilterTable::AdditionalWidget::SetEditable (const bool isEditable) Description : Combo table item. Identificator corresponding to string may be assigned */ -class SMESHGUI_FilterTable::ComboItem : public QComboTableItem +class SMESHGUI_FilterTable::ComboItem : public QTableWidgetItem { public: - ComboItem(QTable*, const QMap&); - virtual ~ComboItem(); + static int Type(); + + ComboItem( const QMap& ); - virtual void setStringList (const QStringList & l); - void setStringList(const QMap& theIds); + void setItems( const QMap& ); + void clear(); + int count() const; - int GetValue() const; - void SetValue(const int); + int value() const; + void setValue( const int ); private: + int id( int ) const; + int index( int ) const; - QMap myNumToId; - QMap myIdToNum; +private: + QMap myIdToIdx; }; -SMESHGUI_FilterTable::ComboItem::ComboItem (QTable* theParent, - const QMap& theIds) -: QComboTableItem(theParent, QStringList()) +int SMESHGUI_FilterTable::ComboItem::Type() { - setStringList(theIds); + return QTableWidgetItem::UserType + 1; } -void SMESHGUI_FilterTable::ComboItem::setStringList (const QStringList & l) +SMESHGUI_FilterTable::ComboItem::ComboItem( const QMap& theIds ) + : QTableWidgetItem( Type() ) { - QComboTableItem::setStringList(l); + setItems( theIds ); } -void SMESHGUI_FilterTable::ComboItem::setStringList (const QMap& theIds) +void SMESHGUI_FilterTable::ComboItem::setItems( const QMap& theIds ) { - int i = 0; - QStringList aList; - QMap::const_iterator anIter; - for (anIter = theIds.begin(); anIter != theIds.end(); ++anIter) { - myNumToId[ i ] = anIter.key(); - myIdToNum[ anIter.key() ] = i; - aList.append(anIter.data()); - i++; + myIdToIdx.clear(); + QMap::const_iterator it; + QStringList items; + for ( it = theIds.begin(); it != theIds.end(); ++it ) { + myIdToIdx[it.key()] = items.count(); + items.append( it.value() ); } + setData( Qt::UserRole, items ); + setValue( id( 0 ) ); +} + +void SMESHGUI_FilterTable::ComboItem::clear() +{ + QMap empty; + setItems( empty ); +} + +int SMESHGUI_FilterTable::ComboItem::count() const +{ + return myIdToIdx.count(); +} + +int SMESHGUI_FilterTable::ComboItem::value() const +{ + return( id( data( Qt::UserRole ).toStringList().indexOf( text() ) ) ); +} + +void SMESHGUI_FilterTable::ComboItem::setValue( const int theId ) +{ + int idx = index( theId ); + QStringList items = data( Qt::UserRole ).toStringList(); + setText( idx >= 0 && idx < items.count() ? items[idx] : "" ); +} - setStringList(aList); +int SMESHGUI_FilterTable::ComboItem::id( int idx ) const +{ + QMap::const_iterator it; + for ( it = myIdToIdx.begin(); it != myIdToIdx.end(); ++it ) + if ( it.value() == idx ) return it.key(); + return -1; } -SMESHGUI_FilterTable::ComboItem::~ComboItem() +int SMESHGUI_FilterTable::ComboItem::index( int i ) const { + return myIdToIdx.contains( i ) ? myIdToIdx[i] : -1; } +/* + Class : SMESHGUI_FilterTable::CheckItem + Description : Check table item. +*/ -int SMESHGUI_FilterTable::ComboItem::GetValue() const +class SMESHGUI_FilterTable::CheckItem : public QTableWidgetItem { - return myNumToId[ currentItem() ]; +public: + static int Type(); + + CheckItem( bool = false ); + CheckItem( const QString&, bool = false ); + ~CheckItem(); + + void setChecked( bool ); + bool checked() const; +}; + +int SMESHGUI_FilterTable::CheckItem::Type() +{ + return QTableWidgetItem::UserType + 2; +} + +SMESHGUI_FilterTable::CheckItem::CheckItem( bool value ) + : QTableWidgetItem( Type() ) +{ + Qt::ItemFlags f = flags(); + f = f | Qt::ItemIsUserCheckable; + f = f & ~Qt::ItemIsTristate; + setFlags( f ); + setChecked(value); +} + +SMESHGUI_FilterTable::CheckItem::CheckItem( const QString& text, bool value ) + : QTableWidgetItem( Type() ) +{ + Qt::ItemFlags f = flags(); + f = f | Qt::ItemIsUserCheckable; + f = f & ~Qt::ItemIsTristate; + setFlags( f ); + setChecked( value ); + setText( text ); +} + +SMESHGUI_FilterTable::CheckItem::~CheckItem() +{ +} + +void SMESHGUI_FilterTable::CheckItem::setChecked( bool value ) +{ + setCheckState( value ? Qt::Checked : Qt::Unchecked ); +} + +bool SMESHGUI_FilterTable::CheckItem::checked() const +{ + return checkState() == Qt::Checked; +} + +/* + Class : SMESHGUI_FilterTable::ComboDelegate + Description : Table used by this widget +*/ + +class SMESHGUI_FilterTable::ComboDelegate : public QItemDelegate +{ +public: + ComboDelegate( QObject* = 0 ); + ~ComboDelegate(); + + QWidget* createEditor( QWidget*, const QStyleOptionViewItem&, + const QModelIndex& ) const; + + void setEditorData( QWidget*, const QModelIndex& ) const; + void setModelData( QWidget*, QAbstractItemModel*, const QModelIndex& ) const; + + void updateEditorGeometry( QWidget*, const QStyleOptionViewItem&, + const QModelIndex& ) const; +private: + QTableWidget* myTable; +}; + +SMESHGUI_FilterTable::ComboDelegate::ComboDelegate( QObject* parent ) + : QItemDelegate( parent ), + myTable( qobject_cast( parent ) ) +{ +} + +SMESHGUI_FilterTable::ComboDelegate::~ComboDelegate() +{ +} + +QWidget* SMESHGUI_FilterTable::ComboDelegate::createEditor( QWidget* parent, + const QStyleOptionViewItem& option, + const QModelIndex& index ) const +{ + QStringList l = index.data( Qt::UserRole ).toStringList(); + if ( !l.isEmpty() ) { + QComboBox* cb = new QComboBox( parent ); + cb->setFrame( false ); + cb->addItems( l ); + return cb; + } + return QItemDelegate::createEditor( parent, option, index ); +} + +void SMESHGUI_FilterTable::ComboDelegate::setEditorData( QWidget* editor, + const QModelIndex& index ) const +{ + QString value = index.model()->data( index, Qt::DisplayRole ).toString(); + QComboBox* cb = static_cast( editor ); + bool bOk = false; + if ( cb ) { + int i = cb->findText( value ); + if ( i >= 0 ) { + cb->setCurrentIndex( i ); + bOk = true; + } + } + if ( !bOk ) QItemDelegate::setEditorData( editor, index ); } -void SMESHGUI_FilterTable::ComboItem::SetValue (const int theVal) +void SMESHGUI_FilterTable::ComboDelegate::setModelData( QWidget* editor, + QAbstractItemModel* model, + const QModelIndex& index) const { - setCurrentItem(myIdToNum[ theVal ]); + QComboBox* cb = static_cast( editor ); + if ( cb ) model->setData( index, cb->currentText(), Qt::DisplayRole ); + else QItemDelegate::setModelData( editor, model, index ); } +void SMESHGUI_FilterTable::ComboDelegate::updateEditorGeometry( QWidget* editor, + const QStyleOptionViewItem& option, + const QModelIndex& index ) const +{ + editor->setGeometry( option.rect ); +} /* Class : SMESHGUI_FilterTable::Table Description : Table used by this widget */ -class SMESHGUI_FilterTable::Table : public QTable +class SMESHGUI_FilterTable::Table : public QTableWidget { public: - Table(QWidget* parent); - Table(int numRows, int numCols, QWidget* parent = 0); - virtual ~Table(); + Table( QWidget* = 0 ); + Table( int, int, QWidget* = 0 ); + virtual ~Table(); + + void setEditable( bool, int, int ); + bool isEditable( int, int ) const; - void SetEditable(const bool state, const int row, const int col); - bool IsEditable(const int row, const int col) const; + void setReadOnly( bool ); + bool isReadOnly() const; - virtual void insertRows(int row, int count = 1); - virtual QString text(int row, int col) const; + void insertRows( int, int = 1 ); + QString text( int, int ); + + QList selectedRows(); }; //======================================================================= @@ -346,13 +516,21 @@ public: // Purpose : Constructor //======================================================================= SMESHGUI_FilterTable::Table::Table (QWidget* parent) -: QTable(parent, "SMESHGUI_FilterTable::Table") +: QTableWidget(parent) { + // set custom item delegate + setItemDelegate( new ComboDelegate(this) ); + // set edit triggers by default + setReadOnly( false ); } SMESHGUI_FilterTable::Table::Table (int numRows, int numCols, QWidget* parent) -: QTable(numRows, numCols, parent, "SMESHGUI_FilterTable::Table") +: QTableWidget(numRows, numCols, parent) { + // set custom item delegate + setItemDelegate( new ComboDelegate(this) ); + // set edit triggers by default + setReadOnly( false ); } SMESHGUI_FilterTable::Table::~Table() @@ -360,30 +538,44 @@ SMESHGUI_FilterTable::Table::~Table() } //======================================================================= -// name : SMESHGUI_FilterTable::Table::SetEditable +// name : SMESHGUI_FilterTable::Table::setEditable // Purpose : Set editable of specified cell //======================================================================= -void SMESHGUI_FilterTable::Table::SetEditable (const bool isEditable, - const int row, const int col) +void SMESHGUI_FilterTable::Table::setEditable (bool isEditable, + int row, int col) { - QTableItem* anItem = item(row, col); - if(anItem) - takeItem(anItem); - - if (!isEditable) - setItem(row, col, new QTableItem(this, QTableItem::Never, "")); - else - setItem(row, col, new QTableItem(this, QTableItem::OnTyping, "")); + QTableWidgetItem* anItem = item( row, col ); + if ( anItem ) { + Qt::ItemFlags f = anItem->flags(); + if ( !isEditable ) f = f & ~Qt::ItemIsEditable; + else f = f | Qt::ItemIsEditable; + anItem->setFlags( f ); + } } //======================================================================= -// name : SMESHGUI_FilterTable::Table::IsEditable +// name : SMESHGUI_FilterTable::Table::isEditable // Purpose : Verify wheter cell is editable //======================================================================= -bool SMESHGUI_FilterTable::Table::IsEditable (const int row, const int col) const +bool SMESHGUI_FilterTable::Table::isEditable (int row, int col) const +{ + QTableWidgetItem* anItem = item( row, col ); + return anItem == 0 || anItem->flags() & Qt::ItemIsEditable; +} + +void SMESHGUI_FilterTable::Table::setReadOnly( bool on ) { - QTableItem* anItem = item(row, col); - return anItem == 0 || anItem->editType() != QTableItem::Never; + setEditTriggers( on ? + QAbstractItemView::DoubleClicked | + QAbstractItemView::SelectedClicked | + QAbstractItemView::EditKeyPressed | + QAbstractItemView::AnyKeyPressed : + QAbstractItemView::NoEditTriggers ); +} + +bool SMESHGUI_FilterTable::Table::isReadOnly() const +{ + return editTriggers() != QAbstractItemView::NoEditTriggers; } //======================================================================= @@ -392,30 +584,35 @@ bool SMESHGUI_FilterTable::Table::IsEditable (const int row, const int col) cons //======================================================================= void SMESHGUI_FilterTable::Table::insertRows (int row, int count) { - int anEditRow = currEditRow(); - int anEditCol = currEditCol(); - - if (anEditRow >= 0 && anEditCol >= 0) - endEdit(anEditRow, anEditCol, true, false); - - QTable::insertRows( row, count ); + closePersistentEditor( currentItem() ); + while ( count-- ) insertRow( row ); } //======================================================================= // name : SMESHGUI_FilterTable::Table::text // Purpose : Get text from cell (virtual redefined) //======================================================================= -QString SMESHGUI_FilterTable::Table::text (int row, int col) const +QString SMESHGUI_FilterTable::Table::text (int row, int col) { - int anEditRow = currEditRow(); - int anEditCol = currEditCol(); + closePersistentEditor( currentItem() ); + QTableWidgetItem* anItem = item( row, col ); + return anItem ? anItem->text() : QString(); +} - if (anEditRow >= 0 && anEditCol >= 0 && anEditRow == row && anEditCol == col) - ((Table*)this)->endEdit(row, col, true, false); +QList SMESHGUI_FilterTable::Table::selectedRows() +{ + QList selItems = selectedItems(); + QTableWidgetItem* anItem; + QList rows; - return QTable::text(row, col); -} + foreach( anItem, selItems ) { + int r = row( anItem ); + if ( !rows.contains( r ) ) rows.append( r ); + } + qSort( rows ); + return rows; +} /* Class : SMESHGUI_FilterTable @@ -431,13 +628,16 @@ QString SMESHGUI_FilterTable::Table::text (int row, int col) const //======================================================================= SMESHGUI_FilterTable::SMESHGUI_FilterTable( SMESHGUI* theModule, QWidget* parent, - const int type) -: QFrame(parent), + const int type ) +: QWidget( parent ), myIsLocked( false ), mySMESHGUI( theModule ) { myEntityType = -1; - Init(type); + + QList aTypes; + aTypes.append(type); + Init(aTypes); } //======================================================================= @@ -446,8 +646,8 @@ SMESHGUI_FilterTable::SMESHGUI_FilterTable( SMESHGUI* theModule, //======================================================================= SMESHGUI_FilterTable::SMESHGUI_FilterTable( SMESHGUI* theModule, QWidget* parent, - const QValueList& types) -: QFrame(parent), + const QList& types ) +: QWidget( parent ), myIsLocked( false ), mySMESHGUI( theModule ) { @@ -463,18 +663,7 @@ SMESHGUI_FilterTable::~SMESHGUI_FilterTable() // name : SMESHGUI_FilterTable::Init // Purpose : Create table corresponding to the specified type //======================================================================= -void SMESHGUI_FilterTable::Init (const int type) -{ - QValueList aTypes; - aTypes.append(type); - Init(aTypes); -} - -//======================================================================= -// name : SMESHGUI_FilterTable::Init -// Purpose : Create table corresponding to the specified type -//======================================================================= -void SMESHGUI_FilterTable::Init (const QValueList& theTypes) +void SMESHGUI_FilterTable::Init (const QList& theTypes) { if (theTypes.isEmpty()) return; @@ -487,38 +676,43 @@ void SMESHGUI_FilterTable::Init (const QValueList& theTypes) // create main layout QVBoxLayout* aMainLay = new QVBoxLayout(this); - QGroupBox* aMainGrp = new QGroupBox(1, Qt::Horizontal, this); - aMainGrp->setFrameStyle(QFrame::NoFrame); - aMainGrp->setInsideMargin(0); - aMainLay->addWidget(aMainGrp); + aMainLay->setMargin( 0 ); + aMainLay->setSpacing( SPACING ); // create switch of entity types - myEntityTypeGrp = new QButtonGroup(1, Qt::Vertical, tr("ENTITY_TYPE"), aMainGrp); + myEntityTypeBox = new QGroupBox(tr("ENTITY_TYPE"), this); + QHBoxLayout* myEntityTypeBoxLayout = new QHBoxLayout(myEntityTypeBox); + myEntityTypeBoxLayout->setMargin( MARGIN ); + myEntityTypeBoxLayout->setSpacing( SPACING ); + myEntityTypeGrp = new QButtonGroup(this); + const QMap& aSupportedTypes = getSupportedTypes(); QMap::const_iterator anIter; for (anIter = aSupportedTypes.begin(); anIter != aSupportedTypes.end(); ++anIter) { - QRadioButton* aBtn = new QRadioButton(anIter.data(), myEntityTypeGrp); - myEntityTypeGrp->insert(aBtn, anIter.key()); + QRadioButton* aBtn = new QRadioButton(anIter.value(), myEntityTypeBox); + myEntityTypeGrp->addButton(aBtn, anIter.key()); + myEntityTypeBoxLayout->addWidget(aBtn); } - myTableGrp = new QGroupBox(1, Qt::Horizontal, tr("FILTER"), aMainGrp ); - QFrame* aTableFrame = new QFrame(myTableGrp); + myTableGrp = new QGroupBox(tr("FILTER"), this ); // create table - mySwitchTableGrp = new QGroupBox(1, Qt::Horizontal, aTableFrame); - mySwitchTableGrp->setFrameStyle(QFrame::NoFrame); - mySwitchTableGrp->setInsideMargin(0); + mySwitchTableGrp = new QWidget(myTableGrp); + QVBoxLayout* mySwitchTableGrpLayout = new QVBoxLayout(mySwitchTableGrp); + mySwitchTableGrpLayout->setMargin(0); + mySwitchTableGrpLayout->setSpacing(0); myTables[ aType ] = createTable(mySwitchTableGrp, aType); + mySwitchTableGrpLayout->addWidget(myTables[ aType ]); // create buttons - myAddBtn = new QPushButton(tr("ADD"), aTableFrame); - myRemoveBtn = new QPushButton(tr("REMOVE"), aTableFrame); - myClearBtn = new QPushButton(tr("CLEAR"), aTableFrame); - myInsertBtn = new QPushButton(tr("INSERT"), aTableFrame); - myCopyFromBtn = new QPushButton(tr("COPY_FROM"), aTableFrame); - myAddToBtn = new QPushButton(tr("ADD_TO"), aTableFrame); + myAddBtn = new QPushButton(tr("ADD"), myTableGrp); + myRemoveBtn = new QPushButton(tr("REMOVE"), myTableGrp); + myClearBtn = new QPushButton(tr("CLEAR"), myTableGrp); + myInsertBtn = new QPushButton(tr("INSERT"), myTableGrp); + myCopyFromBtn = new QPushButton(tr("COPY_FROM"), myTableGrp); + myAddToBtn = new QPushButton(tr("ADD_TO"), myTableGrp); myAddBtn->setAutoDefault(false); myRemoveBtn->setAutoDefault(false); @@ -531,23 +725,28 @@ void SMESHGUI_FilterTable::Init (const QValueList& theTypes) myAddToBtn->hide(); // layout widgets - QGridLayout* aLay = new QGridLayout(aTableFrame, 8, 2, 0, SPACING); - - aLay->addMultiCellWidget(mySwitchTableGrp, 0, 6, 0, 0); - aLay->addWidget(myAddBtn, 0, 1); - aLay->addWidget(myInsertBtn, 1, 1); - aLay->addWidget(myRemoveBtn, 2, 1); - aLay->addWidget(myClearBtn, 3, 1); - aLay->addWidget(myCopyFromBtn, 5, 1); - aLay->addWidget(myAddToBtn, 6, 1); - aLay->addMultiCellWidget(createAdditionalFrame(aTableFrame), 7, 7, 0, 1 ); - - aLay->setColStretch(0, 1); - aLay->setColStretch(1, 0); - - QSpacerItem* aVSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); - aLay->addItem(aVSpacer, 4, 1); - + QGridLayout* aLay = new QGridLayout(myTableGrp); + aLay->setMargin(0); + aLay->setSpacing(SPACING); + + aLay->addWidget(mySwitchTableGrp, 0, 0, 7, 1); + aLay->addWidget(myAddBtn, 0, 1); + aLay->addWidget(myInsertBtn, 1, 1); + aLay->addWidget(myRemoveBtn, 2, 1); + aLay->addWidget(myClearBtn, 3, 1); + aLay->addWidget(myCopyFromBtn, 5, 1); + aLay->addWidget(myAddToBtn, 6, 1); + aLay->addWidget(createAdditionalFrame(myTableGrp), 7, 0, 1, 2 ); + + aLay->setRowMinimumHeight(4, 10); + aLay->setRowStretch(4, 1); + aLay->setColumnStretch(0, 1); + aLay->setColumnStretch(1, 0); + + // layout + aMainLay->addWidget(myEntityTypeBox); + aMainLay->addWidget(myTableGrp); + // signals and slots connect(myAddBtn, SIGNAL(clicked()), this, SLOT(onAddBtn())); connect(myInsertBtn, SIGNAL(clicked()), this, SLOT(onInsertBtn())); @@ -557,7 +756,7 @@ void SMESHGUI_FilterTable::Init (const QValueList& theTypes) connect(myCopyFromBtn, SIGNAL(clicked()), this, SLOT(onCopyFromBtn())); connect(myAddToBtn, SIGNAL(clicked()), this, SLOT(onAddToBtn())); - connect(myEntityTypeGrp, SIGNAL(clicked(int)), this, SLOT(onEntityType(int))); + connect(myEntityTypeGrp, SIGNAL(buttonClicked(int)), this, SLOT(onEntityType(int))); myLibDlg = 0; } @@ -567,32 +766,31 @@ void SMESHGUI_FilterTable::Init (const QValueList& theTypes) QMap::const_iterator anIt; for (anIt = aSupportedTypes.begin(); anIt != aSupportedTypes.end(); ++anIt) { - QButton* aBtn = myEntityTypeGrp->find(anIt.key()); - theTypes.contains(anIt.key()) ? aBtn->show() : aBtn->hide(); + QAbstractButton* aBtn = myEntityTypeGrp->button(anIt.key()); + if ( aBtn ) aBtn->setVisible( theTypes.contains(anIt.key()) ); } // select first button if there is no selected buttons or it is hidden - QButton* aBtn = myEntityTypeGrp->selected(); - if ( aBtn == 0 || theTypes.find(myEntityTypeGrp->id(aBtn)) == theTypes.end()) - myEntityTypeGrp->setButton(theTypes.first()); + int aBtnId = myEntityTypeGrp->checkedId(); + if ( aBtnId == -1 || !theTypes.contains(aBtnId) ) { + QAbstractButton* aBtn = myEntityTypeGrp->button(theTypes.first()); + if ( aBtn ) aBtn->setChecked(true); + } - if (theTypes.count() == 1) - myEntityTypeGrp->hide(); - else - myEntityTypeGrp->show(); + myEntityTypeBox->setVisible(theTypes.count() > 1); myTableGrp->updateGeometry(); - int aType = myEntityTypeGrp->id(myEntityTypeGrp->selected()); - onEntityType(aType); + int cType = myEntityTypeGrp->checkedId(); + onEntityType(cType); } //======================================================================= -// name : SMESHGUI_FilterTable::GetTableGrp +// name : SMESHGUI_FilterTable::createAdditionalFrame // Purpose : Get group box containing table. May be used for adding new widgets in it //======================================================================= QWidget* SMESHGUI_FilterTable::createAdditionalFrame (QWidget* theParent) { - QFrame* aFrame = new QFrame(theParent); + QWidget* aFrame = new QWidget(theParent); QFrame* aLine1 = new QFrame(aFrame); QFrame* aLine2 = new QFrame(aFrame); @@ -603,13 +801,15 @@ QWidget* SMESHGUI_FilterTable::createAdditionalFrame (QWidget* theParent) QLabel* aLabel = new QLabel(tr("ADDITIONAL_PARAMETERS"), aFrame); - myWgStack = new QWidgetStack(aFrame); + myWgStack = new QStackedWidget(aFrame); - QGridLayout* aLay = new QGridLayout(aFrame, 2, 3, 0, SPACING); - aLay->addWidget(aLine1, 0, 0); - aLay->addWidget(aLabel, 0, 1); - aLay->addWidget(aLine2, 0, 2); - aLay->addMultiCellWidget(myWgStack, 1, 1, 0, 2); + QGridLayout* aLay = new QGridLayout(aFrame); + aLay->setMargin(0); + aLay->setSpacing(SPACING); + aLay->addWidget(aLine1, 0, 0); + aLay->addWidget(aLabel, 0, 1); + aLay->addWidget(aLine2, 0, 2); + aLay->addWidget(myWgStack, 1, 0, 1, 3); return aFrame; } @@ -637,18 +837,20 @@ void SMESHGUI_FilterTable::onEntityType (int theType) emit NeedValidation(); if (!myIsValid) { - myEntityTypeGrp->setButton(myEntityType); + myEntityTypeGrp->button(myEntityType)->setChecked(true); return; } myEntityType = theType; - if (!myTables.contains(theType)) + if (!myTables.contains(theType)) { myTables[ theType ] = createTable(mySwitchTableGrp, theType); + ((QVBoxLayout*)mySwitchTableGrp->layout())->addWidget(myTables[ theType ]); + } TableMap::iterator anIter; for (anIter = myTables.begin(); anIter != myTables.end(); ++anIter) - myEntityType == anIter.key() ? anIter.data()->show() : anIter.data()->hide(); + anIter.value()->setVisible( myEntityType == anIter.key() ); updateBtnState(); qApp->processEvents(); @@ -656,7 +858,6 @@ void SMESHGUI_FilterTable::onEntityType (int theType) adjustSize(); emit EntityTypeChanged(theType); - } //======================================================================= @@ -668,20 +869,20 @@ bool SMESHGUI_FilterTable::IsValid (const bool theMess, const int theEntityType) int aType = theEntityType == -1 ? GetType() : theEntityType; Table* aTable = myTables[ aType ]; - for (int i = 0, n = aTable->numRows(); i < n; i++) + for (int i = 0, n = aTable->rowCount(); i < n; i++) { int aCriterion = GetCriterionType(i, aType); - if (aCriterion == FT_RangeOfIds || - aCriterion == FT_BelongToGeom || - aCriterion == FT_BelongToPlane || - aCriterion == FT_BelongToCylinder || - aCriterion == FT_BelongToGenSurface || - aCriterion == FT_LyingOnGeom) { + if (aCriterion == SMESH::FT_RangeOfIds || + aCriterion == SMESH::FT_BelongToGeom || + aCriterion == SMESH::FT_BelongToPlane || + aCriterion == SMESH::FT_BelongToCylinder || + aCriterion == SMESH::FT_BelongToGenSurface || + aCriterion == SMESH::FT_LyingOnGeom) { if (aTable->text(i, 2).isEmpty()) { if (theMess) - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), - tr("ERROR"), QMessageBox::Ok); + SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), + tr("ERROR")); return false; } } else { @@ -690,10 +891,10 @@ bool SMESHGUI_FilterTable::IsValid (const bool theMess, const int theEntityType) double aThreshold = (int)aTable->text(i, 2).toDouble(&aRes); aTable->blockSignals(false); - if (!aRes && aTable->IsEditable(i, 2)) { + if (!aRes && aTable->isEditable(i, 2)) { if (theMess) - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), - tr("ERROR"), QMessageBox::Ok); + SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), + tr("ERROR")); return false; } else if (aType == SMESH::EDGE && @@ -701,13 +902,13 @@ bool SMESHGUI_FilterTable::IsValid (const bool theMess, const int theEntityType) aThreshold == 1) { if (theMess) - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), - tr("MULTIEDGES_ERROR"), QMessageBox::Ok); + SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), + tr("MULTIEDGES_ERROR")); return false; } } - QTableItem* anItem = aTable->item(i, 0); + QTableWidgetItem* anItem = aTable->item(i, 0); if (myAddWidgets.contains(anItem) && !myAddWidgets[ anItem ]->IsValid()) return false; } @@ -739,7 +940,7 @@ int SMESHGUI_FilterTable::GetType() const //======================================================================= void SMESHGUI_FilterTable::SetType (const int type) { - myEntityTypeGrp->setButton(type); + myEntityTypeGrp->button(type)->setChecked(true); onEntityType(type); } @@ -761,7 +962,7 @@ int SMESHGUI_FilterTable::GetCriterionType (const int theRow, const int theType) int aType = theType == -1 ? GetType() : theType; Table* aTable = myTables[ aType ]; ComboItem* anItem = (ComboItem*)aTable->item(theRow, 0); - return anItem != 0 ? anItem->GetValue() : FT_Undefined; + return anItem != 0 ? anItem->value() : SMESH::FT_Undefined; } //======================================================================= @@ -775,32 +976,32 @@ void SMESHGUI_FilterTable::GetCriterion (const int theRow, int aType = theEntityType == -1 ? GetType() : theEntityType; Table* aTable = myTables[ aType ]; - theCriterion.Type = ((ComboItem*)aTable->item(theRow, 0))->GetValue(); - theCriterion.UnaryOp = ((QCheckTableItem*)aTable->item(theRow, 3))->isChecked() ? FT_LogicalNOT : FT_Undefined; - theCriterion.BinaryOp = theRow != aTable->numRows() - 1 ? - ((ComboItem*)aTable->item(theRow, 4))->GetValue() : FT_Undefined; - theCriterion.TypeOfElement = (ElementType)aType; + theCriterion.Type = ((ComboItem*)aTable->item(theRow, 0))->value(); + theCriterion.UnaryOp = ((CheckItem*)aTable->item(theRow, 3))->checked() ? SMESH::FT_LogicalNOT : SMESH::FT_Undefined; + theCriterion.BinaryOp = theRow != aTable->rowCount() - 1 ? + ((ComboItem*)aTable->item(theRow, 4))->value() : SMESH::FT_Undefined; + theCriterion.TypeOfElement = (SMESH::ElementType)aType; int aCriterionType = GetCriterionType(theRow, aType); - if (aCriterionType != FT_RangeOfIds && - aCriterionType != FT_BelongToGeom && - aCriterionType != FT_BelongToPlane && - aCriterionType != FT_BelongToCylinder && - aCriterionType != FT_BelongToGenSurface && - aCriterionType != FT_LyingOnGeom) + if ( aCriterionType != SMESH::FT_RangeOfIds && + aCriterionType != SMESH::FT_BelongToGeom && + aCriterionType != SMESH::FT_BelongToPlane && + aCriterionType != SMESH::FT_BelongToCylinder && + aCriterionType != SMESH::FT_BelongToGenSurface && + aCriterionType != SMESH::FT_LyingOnGeom) { - theCriterion.Compare = ((ComboItem*)aTable->item(theRow, 1))->GetValue(); + theCriterion.Compare = ((ComboItem*)aTable->item(theRow, 1))->value(); theCriterion.Threshold = aTable->item(theRow, 2)->text().toDouble(); } else - { - theCriterion.ThresholdStr = aTable->text(theRow, 2).latin1(); - if ( aCriterionType != FT_RangeOfIds ) - theCriterion.ThresholdID = aTable->text( theRow, 5 ).latin1(); - } + { + theCriterion.ThresholdStr = aTable->text(theRow, 2).toLatin1().data(); + if ( aCriterionType != SMESH::FT_RangeOfIds ) + theCriterion.ThresholdID = aTable->text( theRow, 5 ).toLatin1().data(); + } - QTableItem* anItem = aTable->item(theRow, 0); + QTableWidgetItem* anItem = aTable->item(theRow, 0); if (myAddWidgets.contains(anItem)) theCriterion.Tolerance = myAddWidgets[ anItem ]->GetDouble(AdditionalWidget::Tolerance); } @@ -817,46 +1018,46 @@ void SMESHGUI_FilterTable::SetCriterion (const int theRow, Table* aTable = myTables[ aType ]; - if (theRow > aTable->numRows() - 1) + if (theRow > aTable->rowCount() - 1) return; - ((ComboItem*)aTable->item(theRow, 0))->SetValue(theCriterion.Type); + ((ComboItem*)aTable->item(theRow, 0))->setValue(theCriterion.Type); onCriterionChanged(theRow, 0, aType); - ((ComboItem*)aTable->item(theRow, 1))->SetValue(theCriterion.Compare); - ((QCheckTableItem*)aTable->item(theRow, 3))->setChecked(theCriterion.UnaryOp == FT_LogicalNOT); + ((ComboItem*)aTable->item(theRow, 1))->setValue(theCriterion.Compare); + ((CheckItem*)aTable->item(theRow, 3))->setChecked(theCriterion.UnaryOp == SMESH::FT_LogicalNOT); - if (theCriterion.BinaryOp != FT_Undefined) + if (theCriterion.BinaryOp != SMESH::FT_Undefined) { - if (!aTable->IsEditable(theRow, 4)) - aTable->setItem(theRow, 4, getBinaryItem(aTable)); - ((ComboItem*)aTable->item(theRow, 4))->SetValue(theCriterion.BinaryOp); + if (!aTable->isEditable(theRow, 4)) + aTable->setItem(theRow, 4, getBinaryItem()); + ((ComboItem*)aTable->item(theRow, 4))->setValue(theCriterion.BinaryOp); } else - aTable->SetEditable(false, theRow, 4); - - if (theCriterion.Type != FT_RangeOfIds && - theCriterion.Type != FT_BelongToGeom && - theCriterion.Type != FT_BelongToPlane && - theCriterion.Type != FT_BelongToCylinder && - theCriterion.Type != FT_BelongToGenSurface && - theCriterion.Type != FT_LyingOnGeom && - theCriterion.Type != FT_FreeBorders && - theCriterion.Type != FT_FreeEdges && - theCriterion.Type != FT_BadOrientedVolume) - aTable->setText(theRow, 2, QString("%1").arg(theCriterion.Threshold, 0, 'g', 15)); + aTable->setEditable(false, theRow, 4); + + if (theCriterion.Type != SMESH::FT_RangeOfIds && + theCriterion.Type != SMESH::FT_BelongToGeom && + theCriterion.Type != SMESH::FT_BelongToPlane && + theCriterion.Type != SMESH::FT_BelongToCylinder && + theCriterion.Type != SMESH::FT_BelongToGenSurface && + theCriterion.Type != SMESH::FT_LyingOnGeom && + theCriterion.Type != SMESH::FT_FreeBorders && + theCriterion.Type != SMESH::FT_FreeEdges && + theCriterion.Type != SMESH::FT_BadOrientedVolume) + aTable->item( theRow, 2 )->setText(QString("%1").arg(theCriterion.Threshold, 0, 'g', 15)); else - { - aTable->setText(theRow, 2, QString(theCriterion.ThresholdStr)); - if ( theCriterion.Type != FT_RangeOfIds ) - aTable->setText( theRow, 5, QString( theCriterion.ThresholdID ) ); - } + { + aTable->item( theRow, 2 )->setText(QString(theCriterion.ThresholdStr)); + if ( theCriterion.Type != SMESH::FT_RangeOfIds ) + aTable->item( theRow, 5 )->setText( QString( theCriterion.ThresholdID ) ); + } - if (theCriterion.Compare == FT_EqualTo || - theCriterion.Type == FT_BelongToPlane || - theCriterion.Type == FT_BelongToCylinder || - theCriterion.Type == FT_BelongToGenSurface) + if (theCriterion.Compare == SMESH::FT_EqualTo || + theCriterion.Type == SMESH::FT_BelongToPlane || + theCriterion.Type == SMESH::FT_BelongToCylinder || + theCriterion.Type == SMESH::FT_BelongToGenSurface) { - QTableItem* anItem = aTable->item(theRow, 0); + QTableWidgetItem* anItem = aTable->item(theRow, 0); if (!myAddWidgets.contains(anItem)) { myAddWidgets[ anItem ] = new AdditionalWidget(myWgStack); @@ -877,7 +1078,7 @@ void SMESHGUI_FilterTable::Update() { Table* aTable = myTables[ GetType() ]; int aCurrRow = aTable->currentRow(); - int numRows = aTable->numRows(); + int numRows = aTable->rowCount(); if ((aCurrRow < 0 || aCurrRow >= numRows) && numRows > 0) aTable->setCurrentCell(0, 0); updateAdditionalWidget(); @@ -893,7 +1094,7 @@ void SMESHGUI_FilterTable::AddCriterion (const SMESH::Filter::Criterion& theCrit int aType = theEntityType == -1 ? GetType() : theEntityType; Table* aTable = myTables[ aType ]; addRow(aTable, aType); - SetCriterion(aTable->numRows() - 1, theCriterion); + SetCriterion(aTable->rowCount() - 1, theCriterion); } //======================================================================= @@ -902,7 +1103,7 @@ void SMESHGUI_FilterTable::AddCriterion (const SMESH::Filter::Criterion& theCrit //======================================================================= int SMESHGUI_FilterTable::NumRows (const int theEntityType) const { - return myTables[ theEntityType == -1 ? GetType() : theEntityType ]->numRows(); + return myTables[ theEntityType == -1 ? GetType() : theEntityType ]->rowCount(); } //======================================================================= @@ -912,12 +1113,12 @@ int SMESHGUI_FilterTable::NumRows (const int theEntityType) const void SMESHGUI_FilterTable::Clear (const int theType) { int aType = theType == -1 ? GetType() : theType; - QTable* aTable = myTables[ aType ]; + Table* aTable = myTables[ aType ]; - if (aTable->numRows() == 0) + if (aTable->rowCount() == 0) return; - while (aTable->numRows() > 0) + while (aTable->rowCount() > 0) { removeAdditionalWidget(aTable, 0); aTable->removeRow(0); @@ -958,25 +1159,22 @@ void SMESHGUI_FilterTable::onRemoveBtn() { Table* aTable = myTables[ GetType() ]; - if (aTable->numRows() == 0) + if (aTable->rowCount() == 0) return; - QMemArray aRows; - for (int i = 0, n = aTable->numRows(); i < n; i++) + QList items = aTable->selectedItems(); + + QList aRows = aTable->selectedRows(); // already sorted + int i; + foreach( i, aRows ) { - if (aTable->isRowSelected(i)) - { - aRows.resize(aRows.size() + 1); - aRows[ (int)(aRows.size() - 1) ] = i; - removeAdditionalWidget(aTable, i); - } + removeAdditionalWidget(aTable, i); + aTable->removeRow(i); } - aTable->removeRows(aRows); - // remove control of binary logical operation from last row - if (aTable->numRows() > 0) - aTable->SetEditable(false, aTable->numRows() - 1, 4); + if (aTable->rowCount() > 0) + aTable->setEditable(false, aTable->rowCount() - 1, 4); updateBtnState(); } @@ -989,26 +1187,26 @@ void SMESHGUI_FilterTable::updateAdditionalWidget() { Table* aTable = myTables[ GetType() ]; int aRow = aTable->currentRow(); - if (aRow < 0 || aRow >= aTable->numRows()) + if (aRow < 0 || aRow >= aTable->rowCount()) { myWgStack->setEnabled(false); return; } ComboItem* anItem = ((ComboItem*)aTable->item(aRow, 0)); - bool toEnable = ((ComboItem*)aTable->item(aRow, 1))->GetValue() == FT_EqualTo && - GetCriterionType(aRow) != FT_BelongToGeom && - GetCriterionType(aRow) != FT_LyingOnGeom && - GetCriterionType(aRow) != FT_RangeOfIds && - GetCriterionType(aRow) != FT_FreeEdges && - GetCriterionType(aRow) != FT_BadOrientedVolume; + bool toEnable = ((ComboItem*)aTable->item(aRow, 1))->value() == SMESH::FT_EqualTo && + GetCriterionType(aRow) != SMESH::FT_BelongToGeom && + GetCriterionType(aRow) != SMESH::FT_LyingOnGeom && + GetCriterionType(aRow) != SMESH::FT_RangeOfIds && + GetCriterionType(aRow) != SMESH::FT_FreeEdges && + GetCriterionType(aRow) != SMESH::FT_BadOrientedVolume; if (!myAddWidgets.contains(anItem)) { myAddWidgets[ anItem ] = new AdditionalWidget(myWgStack); myWgStack->addWidget(myAddWidgets[ anItem ]); } - myWgStack->raiseWidget(myWgStack->id(myAddWidgets[ anItem ])); + myWgStack->setCurrentWidget(myAddWidgets[ anItem ]); myWgStack->setEnabled(toEnable); } @@ -1017,13 +1215,13 @@ void SMESHGUI_FilterTable::updateAdditionalWidget() // Purpose : Remove widgets containing additional parameters from widget // stack and internal map //======================================================================= -void SMESHGUI_FilterTable::removeAdditionalWidget (QTable* theTable, const int theRow) +void SMESHGUI_FilterTable::removeAdditionalWidget (QTableWidget* theTable, const int theRow) { - QTableItem* anItem = theTable->item(theRow, 0); + QTableWidgetItem* anItem = theTable->item(theRow, 0); if (myAddWidgets.contains(anItem)) { myWgStack->removeWidget(myAddWidgets[ anItem ]); - myAddWidgets[ anItem ]->reparent(0, QPoint()); + myAddWidgets[ anItem ]->setParent(0); delete myAddWidgets[ anItem ]; myAddWidgets.remove(anItem); } @@ -1036,12 +1234,12 @@ void SMESHGUI_FilterTable::removeAdditionalWidget (QTable* theTable, const int t //======================================================================= void SMESHGUI_FilterTable::onClearBtn() { - QTable* aTable = myTables[ GetType() ]; + Table* aTable = myTables[ GetType() ]; - if (aTable->numRows() == 0) + if (aTable->rowCount() == 0) return; - while (aTable->numRows() > 0) + while (aTable->rowCount() > 0) { removeAdditionalWidget(aTable, 0); aTable->removeRow(0); @@ -1078,8 +1276,8 @@ void SMESHGUI_FilterTable::onCriterionChanged (const int row, const int col, con aType == SMESH::VOLUME && aCriterionType == SMESH::FT_BadOrientedVolume) { if (aCompareItem->count() > 0) - aCompareItem->setStringList(QStringList()); - aTable->SetEditable(false, row, 2); + aCompareItem->clear(); + aTable->setEditable(false, row, 2); } else if (aCriterionType == SMESH::FT_RangeOfIds || aCriterionType == SMESH::FT_BelongToGeom || @@ -1089,25 +1287,24 @@ void SMESHGUI_FilterTable::onCriterionChanged (const int row, const int col, con aCriterionType == SMESH::FT_LyingOnGeom) { QMap aMap; - aMap[ FT_EqualTo ] = tr("EQUAL_TO"); - aCompareItem->setStringList(aMap); - if (!aTable->IsEditable(row, 2)) - aTable->SetEditable(true, row, 2); + aMap[ SMESH::FT_EqualTo ] = tr("EQUAL_TO"); + aCompareItem->setItems(aMap); + if (!aTable->isEditable(row, 2)) + aTable->setEditable(true, row, 2); } else { if (aCompareItem->count() != 3) { - aCompareItem->setStringList(QStringList()); - aCompareItem->setStringList(getCompare()); + aCompareItem->setItems(getCompare()); } QString aText = aTable->text(row, 2); bool isOk = false; aText.toDouble(&isOk); - aTable->setText(row, 2, isOk ? aText : QString("")); - if (!aTable->IsEditable(row, 2)) - aTable->SetEditable(true, row, 2); + aTable->item( row, 2 )->setText(isOk ? aText : QString("")); + if (!aTable->isEditable(row, 2)) + aTable->setEditable(true, row, 2); } updateAdditionalWidget(); @@ -1131,13 +1328,12 @@ void SMESHGUI_FilterTable::onCriterionChanged (int row, int col) //======================================================================= int SMESHGUI_FilterTable::getFirstSelectedRow() const { - QTable* aTable = myTables[ GetType() ]; - for (int i = 0, n = aTable->numRows(); i < n; i++) - if (aTable->isRowSelected(i)) - return i; + Table* aTable = myTables[ GetType() ]; - int aRow = aTable->currentRow(); - return aRow >= 0 && aRow < aTable->numRows() ? aRow : -1; + QList selRows = aTable->selectedRows(); // already sorted + int aRow = selRows.count() > 0 ? selRows[0] : aTable->currentRow(); + + return aRow >= 0 && aRow < aTable->rowCount() ? aRow : -1; } //======================================================================= @@ -1153,8 +1349,8 @@ void SMESHGUI_FilterTable::addRow (Table* theTable, const int theType, const boo myIsLocked = true; if (toTheEnd || aSelectedRow == -1) { - theTable->insertRows(theTable->numRows()); - aCurrRow = theTable->numRows() - 1; + theTable->insertRows(theTable->rowCount()); + aCurrRow = theTable->rowCount() - 1; } else { @@ -1164,39 +1360,39 @@ void SMESHGUI_FilterTable::addRow (Table* theTable, const int theType, const boo myIsLocked = false; // Criteria - theTable->setItem(aCurrRow, 0, getCriterionItem(theTable, theType)); + theTable->setItem(aCurrRow, 0, getCriterionItem(theType)); // Compare - theTable->setItem(aCurrRow, 1, getCompareItem(theTable)); + theTable->setItem(aCurrRow, 1, getCompareItem()); // Threshold - //theTable->setItem(aCurrRow, 2, new QTableItem(theTable)); + //theTable->setItem(aCurrRow, 2, new QTableWidgetItem()); //Logical operation NOT - theTable->setItem(aCurrRow, 3, getUnaryItem(theTable)); + theTable->setItem(aCurrRow, 3, getUnaryItem()); // Logical binary operation for previous value int anAddBinOpStr = -1; - if (aCurrRow == theTable->numRows() - 1) + if (aCurrRow == theTable->rowCount() - 1) anAddBinOpStr = aCurrRow - 1; else if (aCurrRow >= 0 ) anAddBinOpStr = aCurrRow; if (theTable->item(aCurrRow, 4) == 0 || - theTable->item(aCurrRow, 4)->rtti() != 1) + theTable->item(aCurrRow, 4)->type() != ComboItem::Type()) { if (anAddBinOpStr >= 0 && (theTable->item(anAddBinOpStr, 4) == 0 || - theTable->item(anAddBinOpStr, 4)->rtti() != 1)) - theTable->setItem(anAddBinOpStr, 4, getBinaryItem(theTable)); + theTable->item(anAddBinOpStr, 4)->type() != ComboItem::Type())) + theTable->setItem(anAddBinOpStr, 4, getBinaryItem()); } - theTable->SetEditable(false, theTable->numRows() - 1, 4); + theTable->setEditable(false, theTable->rowCount() - 1, 4); - if (aCurrRow >=0 && aCurrRow < theTable->numRows() && - aCurrCol >=0 && aCurrCol < theTable->numRows()) + if (aCurrRow >=0 && aCurrRow < theTable->rowCount() && + aCurrCol >=0 && aCurrCol < theTable->rowCount()) theTable->setCurrentCell(aCurrRow, aCurrCol); onCriterionChanged(aCurrRow, 0); @@ -1208,25 +1404,25 @@ void SMESHGUI_FilterTable::addRow (Table* theTable, const int theType, const boo // name : SMESHGUI_FilterTable::getCriterionItem // Purpose : Get combo table item for criteria of specified type //======================================================================= -QTableItem* SMESHGUI_FilterTable::getCriterionItem (QTable* theParent , const int theType) +QTableWidgetItem* SMESHGUI_FilterTable::getCriterionItem (const int theType) const { - return new ComboItem(theParent, getCriteria(theType)); + return new ComboItem(getCriteria(theType)); } //======================================================================= // name : SMESHGUI_FilterTable::getCompareItem // Purpose : Get combo table item for operation of comparision //======================================================================= -QTableItem* SMESHGUI_FilterTable::getCompareItem (QTable* theParent) +QTableWidgetItem* SMESHGUI_FilterTable::getCompareItem () const { - return new ComboItem(theParent, getCompare()); + return new ComboItem(getCompare()); } //======================================================================= // name : SMESHGUI_FilterTable::getBinaryItem // Purpose : //======================================================================= -QTableItem* SMESHGUI_FilterTable::getBinaryItem (QTable* theParent) +QTableWidgetItem* SMESHGUI_FilterTable::getBinaryItem () const { static QMap aMap; if (aMap.isEmpty()) @@ -1235,16 +1431,16 @@ QTableItem* SMESHGUI_FilterTable::getBinaryItem (QTable* theParent) aMap[ SMESH::FT_LogicalOR ] = tr("OR"); } - return new ComboItem(theParent, aMap); + return new ComboItem(aMap); } //======================================================================= // name : SMESHGUI_FilterTable::getUnaryItem // Purpose : Get check table item //======================================================================= -QTableItem* SMESHGUI_FilterTable::getUnaryItem (QTable* theParent) +QTableWidgetItem* SMESHGUI_FilterTable::getUnaryItem () const { - return new QCheckTableItem(theParent, tr("NOT")); + return new CheckItem(tr("NOT")); } //======================================================================= @@ -1276,12 +1472,12 @@ const QMap& SMESHGUI_FilterTable::getCriteria (const int theType) static QMap aCriteria; if (aCriteria.isEmpty()) { - aCriteria[ SMESH::FT_RangeOfIds ] = tr("RANGE_OF_IDS"); - aCriteria[ SMESH::FT_BelongToGeom ] = tr("BELONG_TO_GEOM"); - aCriteria[ SMESH::FT_BelongToPlane ] = tr("BELONG_TO_PLANE"); - aCriteria[ SMESH::FT_BelongToCylinder ] = tr("BELONG_TO_CYLINDER"); - aCriteria[ SMESH::FT_BelongToGenSurface]= tr("BELONG_TO_GENSURFACE"); - aCriteria[ SMESH::FT_LyingOnGeom ] = tr("LYING_ON_GEOM"); + aCriteria[ SMESH::FT_RangeOfIds ] = tr("RANGE_OF_IDS"); + aCriteria[ SMESH::FT_BelongToGeom ] = tr("BELONG_TO_GEOM"); + aCriteria[ SMESH::FT_BelongToPlane ] = tr("BELONG_TO_PLANE"); + aCriteria[ SMESH::FT_BelongToCylinder ] = tr("BELONG_TO_CYLINDER"); + aCriteria[ SMESH::FT_BelongToGenSurface ] = tr("BELONG_TO_GENSURFACE"); + aCriteria[ SMESH::FT_LyingOnGeom ] = tr("LYING_ON_GEOM"); } return aCriteria; } @@ -1290,15 +1486,15 @@ const QMap& SMESHGUI_FilterTable::getCriteria (const int theType) static QMap aCriteria; if (aCriteria.isEmpty()) { - aCriteria[ SMESH::FT_FreeBorders ] = tr("FREE_BORDERS"); - aCriteria[ SMESH::FT_MultiConnection ] = tr("MULTI_BORDERS"); - aCriteria[ SMESH::FT_Length ] = tr("LENGTH"); - aCriteria[ SMESH::FT_RangeOfIds ] = tr("RANGE_OF_IDS"); - aCriteria[ SMESH::FT_BelongToGeom ] = tr("BELONG_TO_GEOM"); - aCriteria[ SMESH::FT_BelongToPlane ] = tr("BELONG_TO_PLANE"); - aCriteria[ SMESH::FT_BelongToCylinder ] = tr("BELONG_TO_CYLINDER"); - aCriteria[ SMESH::FT_BelongToGenSurface]= tr("BELONG_TO_GENSURFACE"); - aCriteria[ SMESH::FT_LyingOnGeom ] = tr("LYING_ON_GEOM"); + aCriteria[ SMESH::FT_FreeBorders ] = tr("FREE_BORDERS"); + aCriteria[ SMESH::FT_MultiConnection ] = tr("MULTI_BORDERS"); + aCriteria[ SMESH::FT_Length ] = tr("LENGTH"); + aCriteria[ SMESH::FT_RangeOfIds ] = tr("RANGE_OF_IDS"); + aCriteria[ SMESH::FT_BelongToGeom ] = tr("BELONG_TO_GEOM"); + aCriteria[ SMESH::FT_BelongToPlane ] = tr("BELONG_TO_PLANE"); + aCriteria[ SMESH::FT_BelongToCylinder ] = tr("BELONG_TO_CYLINDER"); + aCriteria[ SMESH::FT_BelongToGenSurface ] = tr("BELONG_TO_GENSURFACE"); + aCriteria[ SMESH::FT_LyingOnGeom ] = tr("LYING_ON_GEOM"); } return aCriteria; } @@ -1307,21 +1503,21 @@ const QMap& SMESHGUI_FilterTable::getCriteria (const int theType) static QMap aCriteria; if (aCriteria.isEmpty()) { - aCriteria[ SMESH::FT_AspectRatio ] = tr("ASPECT_RATIO"); - aCriteria[ SMESH::FT_Warping ] = tr("WARPING"); - aCriteria[ SMESH::FT_MinimumAngle ] = tr("MINIMUM_ANGLE"); - aCriteria[ SMESH::FT_Taper ] = tr("TAPER"); - aCriteria[ SMESH::FT_Skew ] = tr("SKEW"); - aCriteria[ SMESH::FT_Area ] = tr("AREA"); - aCriteria[ SMESH::FT_FreeEdges ] = tr("FREE_EDGES"); - aCriteria[ SMESH::FT_RangeOfIds ] = tr("RANGE_OF_IDS"); - aCriteria[ SMESH::FT_BelongToGeom ] = tr("BELONG_TO_GEOM"); - aCriteria[ SMESH::FT_BelongToPlane ] = tr("BELONG_TO_PLANE"); - aCriteria[ SMESH::FT_BelongToCylinder ] = tr("BELONG_TO_CYLINDER"); - aCriteria[ SMESH::FT_BelongToGenSurface]= tr("BELONG_TO_GENSURFACE"); - aCriteria[ SMESH::FT_LyingOnGeom ] = tr("LYING_ON_GEOM"); - aCriteria[ SMESH::FT_Length2D ] = tr("LENGTH2D"); - aCriteria[ SMESH::FT_MultiConnection2D] = tr("MULTI2D_BORDERS"); + aCriteria[ SMESH::FT_AspectRatio ] = tr("ASPECT_RATIO"); + aCriteria[ SMESH::FT_Warping ] = tr("WARPING"); + aCriteria[ SMESH::FT_MinimumAngle ] = tr("MINIMUM_ANGLE"); + aCriteria[ SMESH::FT_Taper ] = tr("TAPER"); + aCriteria[ SMESH::FT_Skew ] = tr("SKEW"); + aCriteria[ SMESH::FT_Area ] = tr("AREA"); + aCriteria[ SMESH::FT_FreeEdges ] = tr("FREE_EDGES"); + aCriteria[ SMESH::FT_RangeOfIds ] = tr("RANGE_OF_IDS"); + aCriteria[ SMESH::FT_BelongToGeom ] = tr("BELONG_TO_GEOM"); + aCriteria[ SMESH::FT_BelongToPlane ] = tr("BELONG_TO_PLANE"); + aCriteria[ SMESH::FT_BelongToCylinder ] = tr("BELONG_TO_CYLINDER"); + aCriteria[ SMESH::FT_BelongToGenSurface ] = tr("BELONG_TO_GENSURFACE"); + aCriteria[ SMESH::FT_LyingOnGeom ] = tr("LYING_ON_GEOM"); + aCriteria[ SMESH::FT_Length2D ] = tr("LENGTH2D"); + aCriteria[ SMESH::FT_MultiConnection2D ] = tr("MULTI2D_BORDERS"); } return aCriteria; } @@ -1330,12 +1526,12 @@ const QMap& SMESHGUI_FilterTable::getCriteria (const int theType) static QMap aCriteria; if (aCriteria.isEmpty()) { - aCriteria[ SMESH::FT_AspectRatio3D] = tr("ASPECT_RATIO_3D"); - aCriteria[ SMESH::FT_RangeOfIds ] = tr("RANGE_OF_IDS"); - aCriteria[ SMESH::FT_BelongToGeom ] = tr("BELONG_TO_GEOM"); - aCriteria[ SMESH::FT_LyingOnGeom ] = tr("LYING_ON_GEOM"); + aCriteria[ SMESH::FT_AspectRatio3D ] = tr("ASPECT_RATIO_3D"); + aCriteria[ SMESH::FT_RangeOfIds ] = tr("RANGE_OF_IDS"); + aCriteria[ SMESH::FT_BelongToGeom ] = tr("BELONG_TO_GEOM"); + aCriteria[ SMESH::FT_LyingOnGeom ] = tr("LYING_ON_GEOM"); aCriteria[ SMESH::FT_BadOrientedVolume ] = tr("BAD_ORIENTED_VOLUME"); - aCriteria[ SMESH::FT_Volume3D ] = tr("VOLUME_3D"); + aCriteria[ SMESH::FT_Volume3D ] = tr("VOLUME_3D"); } return aCriteria; } @@ -1375,7 +1571,7 @@ SMESHGUI_FilterTable::Table* SMESHGUI_FilterTable::createTable (QWidget* thePar // create table Table* aTable= new Table(0, 6, theParent); - QHeader* aHeaders = aTable->horizontalHeader(); + QHeaderView* aHeaders = aTable->horizontalHeader(); QFontMetrics aMetrics(aHeaders->font()); @@ -1388,27 +1584,27 @@ SMESHGUI_FilterTable::Table* SMESHGUI_FilterTable::createTable (QWidget* thePar const QMap& aSupportedTypes = getSupportedTypes(); QMap::const_iterator anIter; for (anIter = aSupportedTypes.begin(); anIter != aSupportedTypes.end(); ++anIter) - aMaxLenCr = Max(maxLength(getCriteria(anIter.key()), aMetrics), aMaxLenCr); + aMaxLenCr = qMax(maxLength(getCriteria(anIter.key()), aMetrics), aMaxLenCr); } - static int aLenCr = abs( aMaxLenCr - - aMetrics.width(tr("CRITERION"))) / aMetrics.width(' ') + 5; + static int aLenCr = qAbs( aMaxLenCr - + aMetrics.width(tr("CRITERION"))) / aMetrics.width(' ') + 5; QString aCrStr; aCrStr.fill(' ', aLenCr); QString aCoStr; aCoStr.fill(' ', 10); - aHeaders->setLabel(0, tr("CRITERION") + aCrStr); - aHeaders->setLabel(1, tr("COMPARE") + aCoStr); - aHeaders->setLabel(2, tr("THRESHOLD_VALUE")); - aHeaders->setLabel(3, tr("UNARY")); - aHeaders->setLabel(4, tr("BINARY") + " "); - aHeaders->setLabel( 5, tr( "ID" ) ); + aTable->horizontalHeaderItem(0)->setText(tr("CRITERION") + aCrStr); + aTable->horizontalHeaderItem(1)->setText(tr("COMPARE") + aCoStr); + aTable->horizontalHeaderItem(2)->setText(tr("THRESHOLD_VALUE")); + aTable->horizontalHeaderItem(3)->setText(tr("UNARY")); + aTable->horizontalHeaderItem(4)->setText(tr("BINARY") + " "); + aTable->horizontalHeaderItem(5)->setText(tr("ID")); // set geometry of the table for (int i = 0; i <= 4; i++) - aTable->adjustColumn(i); + aTable->resizeColumnToContents(i); // set the ID column invisible aTable->hideColumn( 5 ); @@ -1419,12 +1615,12 @@ SMESHGUI_FilterTable::Table* SMESHGUI_FilterTable::createTable (QWidget* thePar aTable->setMinimumSize(QSize(aWidth, aWidth / 2)); aTable->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); - connect(aTable, SIGNAL(valueChanged(int, int)), - this, SLOT(onCriterionChanged(int, int))); - - connect(aTable, SIGNAL(currentChanged(int, int)), - this, SLOT(onCurrentChanged(int, int))); + connect(aTable, SIGNAL(cellChanged(int, int)), + this, SLOT(onCriterionChanged(int, int))); + connect(aTable, SIGNAL(currentCellChanged(int, int, int, int)), + this, SLOT(onCurrentChanged(int, int))); + return aTable; } @@ -1434,8 +1630,8 @@ SMESHGUI_FilterTable::Table* SMESHGUI_FilterTable::createTable (QWidget* thePar //======================================================================= void SMESHGUI_FilterTable::updateBtnState() { - myRemoveBtn->setEnabled(myTables[ GetType() ]->numRows() > 0); - myClearBtn->setEnabled(myTables[ GetType() ]->numRows() > 0); + myRemoveBtn->setEnabled(myTables[ GetType() ]->rowCount() > 0); + myClearBtn->setEnabled(myTables[ GetType() ]->rowCount() > 0); } //======================================================================= @@ -1447,7 +1643,7 @@ void SMESHGUI_FilterTable::SetEditable (const bool isEditable) TableMap::iterator anIter; for (anIter = myTables.begin(); anIter != myTables.end(); ++anIter) { - anIter.data()->setReadOnly(!isEditable); + anIter.value()->setReadOnly(!isEditable); if (isEditable) { @@ -1465,9 +1661,9 @@ void SMESHGUI_FilterTable::SetEditable (const bool isEditable) } } - QMap::iterator anIter2; + QMap::iterator anIter2; for (anIter2 = myAddWidgets.begin(); anIter2 != myAddWidgets.end(); ++anIter2) - anIter2.data()->SetEditable(isEditable); + anIter2.value()->SetEditable(isEditable); } //======================================================================= @@ -1484,9 +1680,9 @@ void SMESHGUI_FilterTable::SetEnabled (const bool isEnabled) if (isEnabled) updateBtnState(); - QMap::iterator anIter2; + QMap::iterator anIter2; for (anIter2 = myAddWidgets.begin(); anIter2 != myAddWidgets.end(); ++anIter2) - anIter2.data()->setEnabled(isEnabled); + anIter2.value()->setEnabled(isEnabled); } //======================================================================= @@ -1592,7 +1788,7 @@ void SMESHGUI_FilterTable::SetThreshold (const int theRow, const int theEntityType) { Table* aTable = myTables[ theEntityType == -1 ? GetType() : theEntityType ]; - aTable->setText(theRow, 2, theText); + aTable->item( theRow, 2 )->setText(theText); } //======================================================================= @@ -1604,7 +1800,7 @@ bool SMESHGUI_FilterTable::GetThreshold (const int theRow, const int theEntityType) { Table* aTable = myTables[ theEntityType == -1 ? GetType() : theEntityType ]; - QTableItem* anItem = aTable->item(theRow, 2); + QTableWidgetItem* anItem = aTable->item(theRow, 2); if (anItem != 0) { theText = anItem->text(); @@ -1623,7 +1819,7 @@ void SMESHGUI_FilterTable::SetID( const int theRow, const int theEntityType ) { Table* aTable = myTables[ theEntityType == -1 ? GetType() : theEntityType ]; - aTable->setText( theRow, 5, theText ); + aTable->item( theRow, 5 )->setText( theText ); } //======================================================================= @@ -1635,7 +1831,7 @@ bool SMESHGUI_FilterTable::GetID( const int theRow, const int theEntityType ) { Table* aTable = myTables[ theEntityType == -1 ? GetType() : theEntityType ]; - QTableItem* anItem = aTable->item( theRow, 5 ); + QTableWidgetItem* anItem = aTable->item( theRow, 5 ); if ( anItem != 0 ) { theText = anItem->text(); @@ -1655,13 +1851,11 @@ bool SMESHGUI_FilterTable::GetID( const int theRow, // name : SMESHGUI_FilterDlg::SMESHGUI_FilterDlg // Purpose : Constructor //======================================================================= -SMESHGUI_FilterDlg::SMESHGUI_FilterDlg( SMESHGUI* theModule, - const QValueList& theTypes, - const char* theName) -: QDialog( SMESH::GetDesktop( theModule ), theName, false, - WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), - mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) +SMESHGUI_FilterDlg::SMESHGUI_FilterDlg( SMESHGUI* theModule, + const QList& theTypes ) +: QDialog( SMESH::GetDesktop( theModule ) ), + mySMESHGUI( theModule ), + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) { if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) mySelector = aViewWindow->GetSelector(); @@ -1674,16 +1868,14 @@ SMESHGUI_FilterDlg::SMESHGUI_FilterDlg( SMESHGUI* theModule, // Purpose : Constructor //======================================================================= SMESHGUI_FilterDlg::SMESHGUI_FilterDlg( SMESHGUI* theModule, - const int theType, - const char* theName) -: QDialog( SMESH::GetDesktop( theModule ), theName, false, - WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), - mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) + const int theType ) +: QDialog( SMESH::GetDesktop( theModule ) ), + mySMESHGUI( theModule ), + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) { if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) mySelector = aViewWindow->GetSelector(); - QValueList aTypes; + QList aTypes; aTypes.append(theType); construct(aTypes); } @@ -1692,16 +1884,20 @@ SMESHGUI_FilterDlg::SMESHGUI_FilterDlg( SMESHGUI* theModule, // name : SMESHGUI_FilterDlg::construct // Purpose : Construct dialog (called by constructor) //======================================================================= -void SMESHGUI_FilterDlg::construct (const QValueList& theTypes) +void SMESHGUI_FilterDlg::construct (const QList& theTypes) { myTypes = theTypes; - setCaption(tr("CAPTION")); + setModal(false); + //setAttribute(Qt::WA_DeleteOnClose, true); // VSR ??? is it required? + setWindowTitle(tr("CAPTION")); - QVBoxLayout* aDlgLay = new QVBoxLayout (this, MARGIN, SPACING); + QVBoxLayout* aDlgLay = new QVBoxLayout (this); + aDlgLay->setMargin(MARGIN); + aDlgLay->setSpacing(SPACING); - myMainFrame = createMainFrame (this); - QFrame* aBtnFrame = createButtonFrame(this); + myMainFrame = createMainFrame (this); + QWidget* aBtnFrame = createButtonFrame(this); aDlgLay->addWidget(myMainFrame); aDlgLay->addWidget(aBtnFrame); @@ -1717,25 +1913,33 @@ void SMESHGUI_FilterDlg::construct (const QValueList& theTypes) // name : SMESHGUI_FilterDlg::createMainFrame // Purpose : Create frame containing dialog's input fields //======================================================================= -QFrame* SMESHGUI_FilterDlg::createMainFrame (QWidget* theParent) +QWidget* SMESHGUI_FilterDlg::createMainFrame (QWidget* theParent) { - QGroupBox* aMainFrame = new QGroupBox(1, Qt::Horizontal, theParent); - aMainFrame->setFrameStyle(QFrame::NoFrame); - aMainFrame->setInsideMargin(0); + QWidget* aMainFrame = new QWidget(theParent); + QVBoxLayout* aMainLay = new QVBoxLayout(aMainFrame); + aMainLay->setMargin(0); + aMainLay->setSpacing(SPACING); // filter frame myTable = new SMESHGUI_FilterTable( mySMESHGUI, aMainFrame, myTypes ); myTable->SetLibsEnabled(true); - QFrame* aLine = new QFrame(myTable->GetTableGrp()); + QGroupBox* aGrp = myTable->GetTableGrp(); + QGridLayout* aLay = qobject_cast( aGrp->layout() ); + int rows = aLay->rowCount(); + int cols = aLay->columnCount(); + + QFrame* aLine = new QFrame(aGrp); aLine->setFrameStyle(QFrame::HLine | QFrame::Sunken); + aLay->addWidget(aLine, rows++, 0, 1, cols); - mySetInViewer = new QCheckBox(tr("SET_IN_VIEWER"), myTable->GetTableGrp()); + mySetInViewer = new QCheckBox(tr("SET_IN_VIEWER"), aGrp); mySetInViewer->setChecked(true); + aLay->addWidget(mySetInViewer, rows++, 0, 1, cols); // other controls - mySourceGrp = createSourceGroup(aMainFrame); + QWidget* aSourceGrp = createSourceGroup(aMainFrame); connect(myTable, SIGNAL(CriterionChanged(const int, const int)), SLOT(onCriterionChanged(const int, const int))); @@ -1743,6 +1947,9 @@ QFrame* SMESHGUI_FilterDlg::createMainFrame (QWidget* theParent) connect(myTable, SIGNAL(CurrentChanged(int, int)), SLOT(onCurrentChanged(int, int))); + aMainLay->addWidget(myTable); + aMainLay->addWidget(aSourceGrp); + return aMainFrame; } @@ -1750,21 +1957,30 @@ QFrame* SMESHGUI_FilterDlg::createMainFrame (QWidget* theParent) // name : SMESHGUI_FilterDlg::createSourceFrame // Purpose : Create frame containing source radio button //======================================================================= -QButtonGroup* SMESHGUI_FilterDlg::createSourceGroup (QWidget* theParent) +QWidget* SMESHGUI_FilterDlg::createSourceGroup (QWidget* theParent) { - QButtonGroup* aGrp = new QButtonGroup(1, Qt::Vertical, tr("SOURCE"), theParent); + QGroupBox* aBox = new QGroupBox(tr("SOURCE"), theParent); + QHBoxLayout* aLay = new QHBoxLayout(aBox); + aLay->setMargin(MARGIN); + aLay->setSpacing(SPACING); - QRadioButton* aMeshBtn = new QRadioButton(tr("MESH"), aGrp); - QRadioButton* aSelBtn = new QRadioButton(tr("SELECTION"), aGrp); - QRadioButton* aGrpBtn = new QRadioButton(tr("CURRENT_GROUP"), aGrp); + mySourceGrp = new QButtonGroup(theParent); - aGrp->insert(aMeshBtn, Mesh); - aGrp->insert(aSelBtn, Selection); - aGrp->insert(aGrpBtn, Dialog); + QRadioButton* aMeshBtn = new QRadioButton(tr("MESH"), aBox); + QRadioButton* aSelBtn = new QRadioButton(tr("SELECTION"), aBox); + QRadioButton* aGrpBtn = new QRadioButton(tr("CURRENT_GROUP"), aBox); - aGrp->setButton(Selection); + aLay->addWidget(aMeshBtn); + aLay->addWidget(aSelBtn); + aLay->addWidget(aGrpBtn); - return aGrp; + mySourceGrp->addButton(aMeshBtn, Mesh); + mySourceGrp->addButton(aSelBtn, Selection); + mySourceGrp->addButton(aGrpBtn, Dialog); + + aSelBtn->setChecked(true); + + return aBox; } //======================================================================= @@ -1793,19 +2009,27 @@ void SMESHGUI_FilterDlg::updateMainButtons() // name : SMESHGUI_FilterDlg::createButtonFrame // Purpose : Create frame containing buttons //======================================================================= -QFrame* SMESHGUI_FilterDlg::createButtonFrame (QWidget* theParent) +QWidget* SMESHGUI_FilterDlg::createButtonFrame (QWidget* theParent) { - QGroupBox* aGrp = new QGroupBox(1, Qt::Vertical, theParent); - - myButtons[ BTN_OK ] = new QPushButton(tr("SMESH_BUT_OK" ), aGrp); - myButtons[ BTN_Apply ] = new QPushButton(tr("SMESH_BUT_APPLY"), aGrp); - - QLabel* aLbl = new QLabel(aGrp); - aLbl->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); + QGroupBox* aGrp = new QGroupBox(theParent); + QHBoxLayout* aLay = new QHBoxLayout(aGrp); + aLay->setMargin(MARGIN); + aLay->setSpacing(SPACING); + myButtons[ BTN_OK ] = new QPushButton(tr("SMESH_BUT_OK" ), aGrp); + myButtons[ BTN_Apply ] = new QPushButton(tr("SMESH_BUT_APPLY"), aGrp); myButtons[ BTN_Cancel ] = new QPushButton(tr("SMESH_BUT_CANCEL"), aGrp); - myButtons[ BTN_Close ] = new QPushButton(tr("SMESH_BUT_CLOSE"), aGrp); - myButtons[ BTN_Help ] = new QPushButton(tr("SMESH_BUT_HELP"), aGrp); + myButtons[ BTN_Close ] = new QPushButton(tr("SMESH_BUT_CLOSE"), aGrp); + myButtons[ BTN_Help ] = new QPushButton(tr("SMESH_BUT_HELP"), aGrp); + + aLay->addWidget(myButtons[ BTN_OK ]); + aLay->addSpacing(10); + aLay->addWidget(myButtons[ BTN_Apply ]); + aLay->addSpacing(10); + aLay->addStretch(); + aLay->addWidget(myButtons[ BTN_Cancel ]); + aLay->addWidget(myButtons[ BTN_Close ]); + aLay->addWidget(myButtons[ BTN_Help ]); connect(myButtons[ BTN_OK ], SIGNAL(clicked()), SLOT(onOk())); connect(myButtons[ BTN_Cancel ], SIGNAL(clicked()), SLOT(onClose())); @@ -1832,7 +2056,7 @@ SMESHGUI_FilterDlg::~SMESHGUI_FilterDlg() //======================================================================= void SMESHGUI_FilterDlg::Init (const int type) { - QValueList aTypes; + QList aTypes; aTypes.append(type); Init(aTypes); } @@ -1841,7 +2065,7 @@ void SMESHGUI_FilterDlg::Init (const int type) // name : SMESHGUI_FilterDlg::Init // Purpose : Init dialog fields, connect signals and slots, show dialog //======================================================================= -void SMESHGUI_FilterDlg::Init (const QValueList& theTypes) +void SMESHGUI_FilterDlg::Init (const QList& theTypes) { mySourceWg = 0; myTypes = theTypes; @@ -1855,13 +2079,13 @@ void SMESHGUI_FilterDlg::Init (const QValueList& theTypes) if (theTypes.count() == 1) { int aType = theTypes.first(); - if (aType == SMESH::NODE ) setCaption(tr("NODES_TLT")); - else if (aType == SMESH::EDGE ) setCaption(tr("EDGES_TLT")); - else if (aType == SMESH::FACE ) setCaption(tr("FACES_TLT")); - else if (aType == SMESH::VOLUME) setCaption(tr("VOLUMES_TLT")); + if (aType == SMESH::NODE ) setWindowTitle(tr("NODES_TLT")); + else if (aType == SMESH::EDGE ) setWindowTitle(tr("EDGES_TLT")); + else if (aType == SMESH::FACE ) setWindowTitle(tr("FACES_TLT")); + else if (aType == SMESH::VOLUME) setWindowTitle(tr("VOLUMES_TLT")); } else - setCaption(tr("TLT")); + setWindowTitle(tr("TLT")); qApp->processEvents(); updateGeometry(); @@ -1877,7 +2101,7 @@ void SMESHGUI_FilterDlg::Init (const QValueList& theTypes) updateSelection(); // Initialise filter table with values of previous filter - QValueList::const_iterator anIter; + QList::const_iterator anIter; for (anIter = theTypes.begin(); anIter != theTypes.end(); ++anIter) { myTable->Clear(*anIter); @@ -1896,10 +2120,10 @@ void SMESHGUI_FilterDlg::Init (const QValueList& theTypes) mySetInViewer->setChecked(myInsertState[ theTypes.first() ]); else mySetInViewer->setChecked(true); - if (myApplyToState.contains(theTypes.first())) - mySourceGrp->setButton(myApplyToState[ theTypes.first() ]); - else - mySourceGrp->setButton(Selection); + + mySourceGrp->button(myApplyToState.contains(theTypes.first()) ? + myApplyToState[ theTypes.first() ] : + Selection)->setChecked(true); } //======================================================================= @@ -1933,7 +2157,7 @@ void SMESHGUI_FilterDlg::onClose() mySelectionMgr->clearFilters(); mySelectionMgr->clearSelected(); SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger anIter (myIObjects); - for (; anIter.More(); anIter.Next()) + for ( ; anIter.More(); anIter.Next()) { aList.Append(anIter.Key()); @@ -1966,16 +2190,17 @@ void SMESHGUI_FilterDlg::onHelp() if (app) app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); else { - QString platform; + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName)); } } @@ -2013,33 +2238,33 @@ void SMESHGUI_FilterDlg::closeEvent (QCloseEvent*) // name : SMESHGUI_FilterDlg::getIdsFromWg // Purpose : Retrieve list of ids from given widget //======================================================================= -void SMESHGUI_FilterDlg::getIdsFromWg (const QWidget* theWg, QValueList& theRes) const +void SMESHGUI_FilterDlg::getIdsFromWg (const QWidget* theWg, QList& theRes) const { theRes.clear(); if (theWg == 0) return; - if (theWg->inherits("QListBox")) + if (theWg->inherits("QListWidget")) { - QListBox* aListBox = (QListBox*)theWg; + const QListWidget* aListBox = qobject_cast( theWg ); bool b; for (int i = 0, n = aListBox->count(); i < n; i++) { - int anId = aListBox->text(i).toInt(&b); + int anId = aListBox->item(i)->text().toInt(&b); if (b) theRes.append(anId); } } else if (theWg->inherits("QLineEdit")) { - QLineEdit* aLineEdit = (QLineEdit*)theWg; + const QLineEdit* aLineEdit = qobject_cast( theWg ); QString aStr = aLineEdit->text(); QRegExp aRegExp("(\\d+)"); bool b; int aPos = 0; while (aPos >= 0) { - aPos = aRegExp.search(aStr, aPos); + aPos = aRegExp.indexIn(aStr, aPos); if (aPos > -1) { int anId = aRegExp.cap(1).toInt(&b); @@ -2072,28 +2297,28 @@ Selection_Mode SMESHGUI_FilterDlg::getSelMode (const int theType) const // name : SMESHGUI_FilterDlg::setIdsToWg // Purpose : Insert identifiers in specified widgets //======================================================================= -void SMESHGUI_FilterDlg::setIdsToWg (QWidget* theWg, const QValueList& theIds) +void SMESHGUI_FilterDlg::setIdsToWg (QWidget* theWg, const QList& theIds) { if (theWg == 0) return; - if (theWg->inherits("QListBox")) + if (theWg->inherits("QListWidget")) { - QListBox* aListBox = (QListBox*)theWg; + QListWidget* aListBox = qobject_cast( theWg ); aListBox->clear(); QStringList aStrList; - QValueList::const_iterator anIter; + QList::const_iterator anIter; for (anIter = theIds.begin(); anIter != theIds.end(); ++anIter) aStrList.append(QString("%1").arg(*anIter)); - aListBox->insertStringList(aStrList); + aListBox->addItems(aStrList); } else if (theWg->inherits("QLineEdit")) { - QLineEdit* aLineEdit = (QLineEdit*)theWg; + QLineEdit* aLineEdit = qobject_cast( theWg ); QString aStr; - QValueList::const_iterator anIter; + QList::const_iterator anIter; for (anIter = theIds.begin(); anIter != theIds.end(); ++ anIter) aStr += QString("%1 ").arg(*anIter); @@ -2117,25 +2342,25 @@ bool SMESHGUI_FilterDlg::isValid() const for (int i = 0, n = myTable->NumRows(); i < n; i++) { int aType = myTable->GetCriterionType(i); - if (aType == FT_BelongToGeom || - aType == FT_BelongToPlane || - aType == FT_BelongToCylinder || - aType == FT_BelongToGenSurface || - aType == FT_LyingOnGeom) { + if (aType == SMESH::FT_BelongToGeom || + aType == SMESH::FT_BelongToPlane || + aType == SMESH::FT_BelongToCylinder || + aType == SMESH::FT_BelongToGenSurface || + aType == SMESH::FT_LyingOnGeom) { QString aName; myTable->GetThreshold(i, aName); std::vector<_PTR(SObject)> aList = - SMESH::GetActiveStudyDocument()->FindObjectByName(aName.latin1(), "GEOM"); + SMESH::GetActiveStudyDocument()->FindObjectByName(aName.toLatin1().data(), "GEOM"); if (aList.size() == 0) { - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), - tr("BAD_SHAPE_NAME").arg(aName), QMessageBox::Ok); + SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), + tr("BAD_SHAPE_NAME").arg(aName)); return false; } - if (aType == FT_BelongToCylinder || - aType == FT_BelongToPlane || - aType == FT_BelongToGenSurface ) { + if (aType == SMESH::FT_BelongToCylinder || + aType == SMESH::FT_BelongToPlane || + aType == SMESH::FT_BelongToGenSurface ) { CORBA::Object_var anObject = SMESH::SObjectToObject(aList[ 0 ]); //GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow(aList[ 0 ]->GetObject()); GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow(anObject); @@ -2144,27 +2369,27 @@ bool SMESHGUI_FilterDlg::isValid() const if (!GEOMBase::GetShape(aGeomObj, aFace) || aFace.IsNull() || aFace.ShapeType() != TopAbs_FACE) { - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), - tr("SHAPE_IS_NOT_A_FACE").arg(aName), QMessageBox::Ok); + SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), + tr("SHAPE_IS_NOT_A_FACE").arg(aName)); return false; } Handle(Geom_Surface) aSurf = BRep_Tool::Surface(TopoDS::Face(aFace)); if (aSurf.IsNull()) { - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), - tr("SHAPE_IS_NOT_A_FACE").arg(aName), QMessageBox::Ok); + SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), + tr("SHAPE_IS_NOT_A_FACE").arg(aName)); return false; } - if (aType == FT_BelongToPlane && !aSurf->IsKind(STANDARD_TYPE(Geom_Plane))) { - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), - tr("SHAPE_IS_NOT_A_PLANE").arg(aName), QMessageBox::Ok); + if (aType == SMESH::FT_BelongToPlane && !aSurf->IsKind(STANDARD_TYPE(Geom_Plane))) { + SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), + tr("SHAPE_IS_NOT_A_PLANE").arg(aName)); return false; } - if (aType == FT_BelongToCylinder && !aSurf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) { - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), - tr("SHAPE_IS_NOT_A_CYLINDER").arg(aName), QMessageBox::Ok); + if (aType == SMESH::FT_BelongToCylinder && !aSurf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) { + SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), + tr("SHAPE_IS_NOT_A_CYLINDER").arg(aName)); return false; } } @@ -2207,7 +2432,7 @@ void SMESHGUI_FilterDlg::SetSelection() myIObjects.Clear(); const SALOME_ListIO& anObjs = mySelector->StoredIObjects(); SALOME_ListIteratorOfListIO anIter (anObjs); - for (; anIter.More(); anIter.Next()) { + for ( ; anIter.More(); anIter.Next()) { TColStd_IndexedMapOfInteger aMap; mySelector->GetIndex(anIter.Value(), aMap); myIObjects.Bind(anIter.Value(), aMap); @@ -2240,13 +2465,13 @@ bool SMESHGUI_FilterDlg::onApply() insertFilterInViewer(); if (!myFilter[ aCurrType ]->GetPredicate()->_is_nil()) { - QValueList aResultIds; + QList aResultIds; filterSource(aCurrType, aResultIds); selectInViewer(aCurrType, aResultIds); } myInsertState[ aCurrType ] = mySetInViewer->isChecked(); - myApplyToState[ aCurrType ] = mySourceGrp->id(mySourceGrp->selected()); + myApplyToState[ aCurrType ] = mySourceGrp->checkedId(); } catch(const SALOME::SALOME_Exception& S_ex) { @@ -2321,13 +2546,13 @@ void SMESHGUI_FilterDlg::insertFilterInViewer() // Purpose : Filter source ids //======================================================================= void SMESHGUI_FilterDlg::filterSource (const int theType, - QValueList& theResIds) + QList& theResIds) { theResIds.clear(); if (myFilter[ theType ]->_is_nil()) return; - int aSourceId = mySourceGrp->id(mySourceGrp->selected()); + int aSourceId = mySourceGrp->checkedId(); if (aSourceId == Mesh) { @@ -2344,7 +2569,7 @@ void SMESHGUI_FilterDlg::filterSource (const int theType, else if (aSourceId == Dialog) { // retrieve ids from dialog - QValueList aDialogIds; + QList aDialogIds; getIdsFromWg(mySourceWg, aDialogIds); if (myMesh->_is_nil()) @@ -2356,7 +2581,7 @@ void SMESHGUI_FilterDlg::filterSource (const int theType, // filter ids SMESH::Predicate_ptr aPred = myFilter[ theType ]->GetPredicate(); aPred->SetMesh(myMesh); - QValueList::const_iterator anIter; + QList::const_iterator anIter; for (anIter = aDialogIds.begin(); anIter != aDialogIds.end(); ++ anIter) if (aPred->IsSatisfy(*anIter)) theResIds.append(*anIter); @@ -2371,7 +2596,7 @@ void SMESHGUI_FilterDlg::filterSource (const int theType, // Purpose : Filter source selection //======================================================================= void SMESHGUI_FilterDlg::filterSelectionSource (const int theType, - QValueList& theResIds) + QList& theResIds) { theResIds.clear(); if (myMesh->_is_nil() || mySelectionMgr == 0) @@ -2381,7 +2606,7 @@ void SMESHGUI_FilterDlg::filterSelectionSource (const int theType, TColStd_MapOfInteger aToBeFiltered; SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger anIter(myIObjects); - for (; anIter.More(); anIter.Next()) + for ( ; anIter.More(); anIter.Next()) { // process sub mesh SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface(anIter.Key()); @@ -2430,7 +2655,7 @@ void SMESHGUI_FilterDlg::filterSelectionSource (const int theType, SMESH::Predicate_ptr aPred = myFilter[ theType ]->GetPredicate(); aPred->SetMesh(myMesh); TColStd_MapIteratorOfMapOfInteger aResIter(aToBeFiltered); - for (; aResIter.More(); aResIter.Next()) + for ( ; aResIter.More(); aResIter.Next()) if (aPred->IsSatisfy(aResIter.Key())) theResIds.append(aResIter.Key()); } @@ -2439,7 +2664,7 @@ void SMESHGUI_FilterDlg::filterSelectionSource (const int theType, // name : SMESHGUI_FilterDlg::selectInViewer // Purpose : Select given entities in viewer //======================================================================= -void SMESHGUI_FilterDlg::selectInViewer (const int theType, const QValueList& theIds) +void SMESHGUI_FilterDlg::selectInViewer (const int theType, const QList& theIds) { if (mySelectionMgr == 0 || myMesh->_is_nil()) return; @@ -2471,16 +2696,16 @@ void SMESHGUI_FilterDlg::selectInViewer (const int theType, const QValueListGetType(); - int aFilterId = SMESHGUI_UnknownFilter; - if (aType == SMESH::EDGE ) aFilterId = SMESHGUI_EdgeFilter; - else if (aType == SMESH::FACE ) aFilterId = SMESHGUI_FaceFilter; - else if (aType == SMESH::VOLUME) aFilterId = SMESHGUI_VolumeFilter; + int aFilterId = SMESH::UnknownFilter; + if (aType == SMESH::EDGE ) aFilterId = SMESH::EdgeFilter; + else if (aType == SMESH::FACE ) aFilterId = SMESH::FaceFilter; + else if (aType == SMESH::VOLUME) aFilterId = SMESH::VolumeFilter; Handle(VTKViewer_Filter) aFilter = SMESH::GetFilter(aFilterId); SMESH::RemoveFilter(aFilterId); // get vtk ids TColStd_MapOfInteger aMap; - QValueList::const_iterator anIter; + QList::const_iterator anIter; for (anIter = theIds.begin(); anIter != theIds.end(); ++anIter) { aMap.Add(*anIter); } @@ -2503,11 +2728,11 @@ SMESH::Filter::Criterion SMESHGUI_FilterDlg::createCriterion() { SMESH::Filter::Criterion aCriterion; - aCriterion.Type = FT_Undefined; - aCriterion.Compare = FT_Undefined; + aCriterion.Type = SMESH::FT_Undefined; + aCriterion.Compare = SMESH::FT_Undefined; aCriterion.Threshold = 0; - aCriterion.UnaryOp = FT_Undefined; - aCriterion.BinaryOp = FT_Undefined; + aCriterion.UnaryOp = SMESH::FT_Undefined; + aCriterion.BinaryOp = SMESH::FT_Undefined; aCriterion.ThresholdStr = ""; aCriterion.ThresholdID = ""; aCriterion.TypeOfElement = SMESH::ALL; @@ -2528,11 +2753,11 @@ void SMESHGUI_FilterDlg::onSelectionDone() if (aList.Extent() != 1 || !myTable->CurrentCell(aRow, aCol) || - myTable->GetCriterionType(aRow) != FT_BelongToGeom && - myTable->GetCriterionType(aRow) != FT_BelongToPlane && - myTable->GetCriterionType(aRow) != FT_BelongToCylinder && - myTable->GetCriterionType(aRow) != FT_BelongToGenSurface && - myTable->GetCriterionType(aRow) != FT_LyingOnGeom) + myTable->GetCriterionType(aRow) != SMESH::FT_BelongToGeom && + myTable->GetCriterionType(aRow) != SMESH::FT_BelongToPlane && + myTable->GetCriterionType(aRow) != SMESH::FT_BelongToCylinder && + myTable->GetCriterionType(aRow) != SMESH::FT_BelongToGenSurface && + myTable->GetCriterionType(aRow) != SMESH::FT_LyingOnGeom) return; Handle(SALOME_InteractiveObject) anIO = aList.First(); @@ -2549,7 +2774,7 @@ void SMESHGUI_FilterDlg::onSelectionDone() // name : SMESHGUI_FilterDlg::onCriterionChanged // Purpose : SLOT called when cretarion of current row changed. Update selection //======================================================================= -void SMESHGUI_FilterDlg::onCriterionChanged (const int , const int) +void SMESHGUI_FilterDlg::onCriterionChanged (const int, const int) { updateSelection(); } @@ -2585,22 +2810,22 @@ void SMESHGUI_FilterDlg::updateSelection() int aRow, aCol; if (myTable->CurrentCell(aRow, aCol) && - (myTable->GetCriterionType(aRow) == FT_BelongToGeom || - myTable->GetCriterionType(aRow) == FT_BelongToPlane || - myTable->GetCriterionType(aRow) == FT_BelongToCylinder || - myTable->GetCriterionType(aRow) == FT_BelongToGenSurface || - myTable->GetCriterionType(aRow) == FT_LyingOnGeom)) { + (myTable->GetCriterionType(aRow) == SMESH::FT_BelongToGeom || + myTable->GetCriterionType(aRow) == SMESH::FT_BelongToPlane || + myTable->GetCriterionType(aRow) == SMESH::FT_BelongToCylinder || + myTable->GetCriterionType(aRow) == SMESH::FT_BelongToGenSurface || + myTable->GetCriterionType(aRow) == SMESH::FT_LyingOnGeom)) { - if (myTable->GetCriterionType(aRow) == FT_BelongToGeom || - myTable->GetCriterionType(aRow) == FT_BelongToGenSurface || - myTable->GetCriterionType(aRow) == FT_LyingOnGeom) { + if (myTable->GetCriterionType(aRow) == SMESH::FT_BelongToGeom || + myTable->GetCriterionType(aRow) == SMESH::FT_BelongToGenSurface || + myTable->GetCriterionType(aRow) == SMESH::FT_LyingOnGeom) { mySelectionMgr->installFilter(new GEOM_SelectionFilter( aStudy, true )); - } else if (myTable->GetCriterionType(aRow) == FT_BelongToPlane) { + } else if (myTable->GetCriterionType(aRow) == SMESH::FT_BelongToPlane) { mySelectionMgr->installFilter(new GEOM_FaceFilter( aStudy, StdSelect_Plane ) ); - } else if (myTable->GetCriterionType(aRow) == FT_BelongToCylinder) { + } else if (myTable->GetCriterionType(aRow) == SMESH::FT_BelongToCylinder) { mySelectionMgr->installFilter(new GEOM_FaceFilter( aStudy, StdSelect_Cylinder ) ); } myIsSelectionChanged = true; @@ -2622,10 +2847,8 @@ void SMESHGUI_FilterDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) - { - e->accept(); - onHelp(); - } + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + onHelp(); + } } - diff --git a/src/SMESHGUI/SMESHGUI_FilterDlg.h b/src/SMESHGUI/SMESHGUI_FilterDlg.h index 2cc71d94a..29f70ece3 100755 --- a/src/SMESHGUI/SMESHGUI_FilterDlg.h +++ b/src/SMESHGUI/SMESHGUI_FilterDlg.h @@ -1,68 +1,61 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_FilterDlg.h +// Author : Sergey LITONIN, Open CASCADE S.A.S. // -// File : SMESHGUI_FilterDlg.h -// Author : Sergey LITONIN -// Module : SMESH - -#ifndef SMESHGUI_FilterDlg_H -#define SMESHGUI_FilterDlg_H +#ifndef SMESHGUI_FILTERDLG_H +#define SMESHGUI_FILTERDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include -#include -#include -#include +// Qt includes +#include +#include +#include +#include -#include "LightApp_SelectionMgr.h" -#include "SALOME_InteractiveObject.hxx" -#include "SALOME_DataMapOfIOMapOfInteger.hxx" -#include "SVTK_Selection.h" - -#include +// SALOME GUI includes +#include +#include +// IDL includes #include #include CORBA_SERVER_HEADER(SMESH_Filter) #include CORBA_SERVER_HEADER(SMESH_Mesh) +class QFrame; class QButtonGroup; class QCheckBox; -class QCloseEvent; -class QComboBox; -class QEvent; class QGroupBox; class QPushButton; -class QStringList; -class QTable; -class QTableItem; -class QWidgetStack; +class QTableWidget; +class QTableWidgetItem; +class QStackedWidget; class LightApp_SelectionMgr; class SMESHGUI; class SMESHGUI_FilterLibraryDlg; class SVTK_Selector; -class SVTK_ViewWindow; /*! * Class : SMESHGUI_FilterTable @@ -72,113 +65,107 @@ class SVTK_ViewWindow; * - Buttons for editing table */ -class SMESHGUI_EXPORT SMESHGUI_FilterTable : public QFrame +class SMESHGUI_EXPORT SMESHGUI_FilterTable : public QWidget { Q_OBJECT class Table; class ComboItem; + class CheckItem; class AdditionalWidget; + class ComboDelegate; typedef QMap TableMap; public: - SMESHGUI_FilterTable( SMESHGUI*, - QWidget* parent, - const int type); - SMESHGUI_FilterTable( SMESHGUI*, - QWidget* parent, - const QValueList& type); - virtual ~SMESHGUI_FilterTable(); + SMESHGUI_FilterTable( SMESHGUI*, QWidget*, const int ); + SMESHGUI_FilterTable( SMESHGUI*, QWidget*, const QList& ); + virtual ~SMESHGUI_FilterTable(); - void Init (const int type); - void Init (const QValueList& types); + void Init( const QList& ); QGroupBox* GetTableGrp(); - bool IsValid (const bool = true, const int theEntityType = -1) const; + bool IsValid( const bool = true, const int = -1 ) const; int GetType() const; - void SetType (const int); + void SetType(const int); void RestorePreviousEntityType(); - int NumRows (const int theEntityType = -1) const; - void Clear (const int theEntityType = -1); - void SetEditable (const bool); - void SetEnabled (const bool); - void SetLibsEnabled (const bool); + int NumRows( const int = -1 ) const; + void Clear( const int = -1 ); + void SetEditable( const bool ); + void SetEnabled( const bool ); + void SetLibsEnabled( const bool ); bool IsEditable() const; - int GetCriterionType (const int theRow, const int theType = -1) const; + int GetCriterionType( const int, const int = -1 ) const; - void GetCriterion (const int theRow, - SMESH::Filter::Criterion& theCriterion, - const int theEntityType = -1) const; + void GetCriterion( const int, + SMESH::Filter::Criterion&, + const int = -1 ) const; - void SetCriterion (const int theRow, - const SMESH::Filter::Criterion& theCriterion, - const int theEntityType = -1); + void SetCriterion( const int, + const SMESH::Filter::Criterion&, + const int = -1 ); - void AddCriterion (const SMESH::Filter::Criterion& theCriterion, - const int theEntityType = -1); + void AddCriterion( const SMESH::Filter::Criterion&, + const int = -1 ); - void Copy (const SMESHGUI_FilterTable*); - void SetValidity (const bool); + void Copy( const SMESHGUI_FilterTable* ); + void SetValidity( const bool ); - bool CurrentCell (int& theRow, int& theCol) const; - void SetThreshold (const int theRow, - const QString& theText, - const int theEntityType = -1); + bool CurrentCell( int&, int& ) const; + void SetThreshold( const int, + const QString&, + const int = -1 ); - bool GetThreshold (const int theRow, - QString& theText, - const int theEntityType = -1); + bool GetThreshold( const int, + QString&, + const int = -1 ); - void SetID( const int theRow, - const QString& theText, - const int theEntityType = -1 ); + void SetID( const int, + const QString&, + const int = -1 ); - bool GetID( const int theRow, - QString& theText, - const int theEntityType = -1 ); + bool GetID( const int, + QString&, + const int = -1 ); void Update(); signals: - void CopyFromClicked(); void AddToClicked(); - void EntityTypeChanged (const int); + void EntityTypeChanged( const int ); void NeedValidation(); - void CriterionChanged (const int theRow, const int theEntityType); - void CurrentChanged (int, int); + void CriterionChanged( const int, const int ); + void CurrentChanged( int, int ); private slots: - void onAddBtn(); void onInsertBtn(); void onRemoveBtn(); void onClearBtn(); void onCopyFromBtn(); void onAddToBtn(); - void onCriterionChanged (int, int); - void onEntityType (int); - void onCurrentChanged (int, int); + void onCriterionChanged( int, int ); + void onEntityType( int ); + void onCurrentChanged( int, int ); private: - - void addRow (Table*, const int, const bool toTheEnd = true); - QTableItem* getCriterionItem (QTable*, const int); - QTableItem* getCompareItem (QTable*); - QTableItem* getUnaryItem (QTable*); - QTableItem* getBinaryItem (QTable*); - const QMap& getCriteria (const int theType) const; + void addRow( Table*, const int, const bool = true ); + QTableWidgetItem* getCriterionItem( const int ) const; + QTableWidgetItem* getCompareItem() const; + QTableWidgetItem* getUnaryItem() const; + QTableWidgetItem* getBinaryItem() const; + const QMap& getCriteria( const int ) const; const QMap& getCompare() const; - Table* createTable (QWidget*, const int); - QWidget* createAdditionalFrame (QWidget* theParent); + Table* createTable( QWidget*, const int ); + QWidget* createAdditionalFrame( QWidget* ); int getFirstSelectedRow() const; - void onCriterionChanged (const int, const int, const int); + void onCriterionChanged( const int, const int, const int ); void updateBtnState(); - void removeAdditionalWidget (QTable* theTable, const int theRow); + void removeAdditionalWidget( QTableWidget*, const int ); void updateAdditionalWidget(); const QMap& getSupportedTypes() const; @@ -187,7 +174,7 @@ private: SMESHGUI* mySMESHGUI; QGroupBox* myTableGrp; - QGroupBox* mySwitchTableGrp; + QWidget* mySwitchTableGrp; TableMap myTables; QPushButton* myAddBtn; @@ -197,6 +184,7 @@ private: QPushButton* myCopyFromBtn; QPushButton* myAddToBtn; + QGroupBox* myEntityTypeBox; QButtonGroup* myEntityTypeGrp; int myEntityType; int myIsValid; @@ -204,9 +192,9 @@ private: SMESHGUI_FilterLibraryDlg* myLibDlg; - QWidgetStack* myWgStack; + QStackedWidget* myWgStack; - QMap myAddWidgets; + QMap myAddWidgets; }; @@ -226,21 +214,16 @@ class SMESHGUI_FilterDlg : public QDialog enum { BTN_OK, BTN_Cancel, BTN_Apply, BTN_Close, BTN_Help }; public: - SMESHGUI_FilterDlg( SMESHGUI*, - const QValueList& types, - const char* name = 0); - - SMESHGUI_FilterDlg( SMESHGUI*, - const int type, - const char* name = 0); - virtual ~SMESHGUI_FilterDlg(); + SMESHGUI_FilterDlg( SMESHGUI*, const QList& ); + SMESHGUI_FilterDlg( SMESHGUI*, const int ); + virtual ~SMESHGUI_FilterDlg(); - void Init (const QValueList& types); - void Init (const int type); + void Init( const QList& ); + void Init( const int ); void SetSelection(); - void SetMesh (SMESH::SMESH_Mesh_ptr); - void SetSourceWg (QWidget*); + void SetMesh( SMESH::SMESH_Mesh_ptr ); + void SetSourceWg( QWidget* ); static SMESH::Filter::Criterion createCriterion(); @@ -256,42 +239,38 @@ private slots: void onHelp(); void onDeactivate(); void onSelectionDone(); - void onCriterionChanged (const int, const int); - void onCurrentChanged (int, int); + void onCriterionChanged( const int, const int ); + void onCurrentChanged( int, int ); private: - void construct (const QValueList& types); + void construct( const QList& ); - void closeEvent (QCloseEvent*); - void enterEvent (QEvent*); - void keyPressEvent(QKeyEvent*); + void closeEvent( QCloseEvent* ); + void enterEvent( QEvent* ); + void keyPressEvent( QKeyEvent* ); // dialog creation - QFrame* createButtonFrame (QWidget*); - QFrame* createMainFrame (QWidget*); - QButtonGroup* createSourceGroup (QWidget*); + QWidget* createButtonFrame( QWidget* ); + QWidget* createMainFrame( QWidget* ); + QWidget* createSourceGroup( QWidget* ); void updateMainButtons(); // execution bool isValid() const; - bool createFilter (const int theType); + bool createFilter( const int ); void insertFilterInViewer(); - void selectInViewer (const int theType, - const QValueList& theIds); - void filterSource (const int theType, - QValueList& theResIds); - void filterSelectionSource (const int theType, - QValueList& theResIds); - void getIdsFromWg (const QWidget*, QValueList&) const; - void setIdsToWg (QWidget*, const QValueList&); - Selection_Mode getSelMode (const int) const; + void selectInViewer( const int, const QList& ); + void filterSource( const int, QList& ); + void filterSelectionSource( const int, QList& ); + void getIdsFromWg( const QWidget*, QList& ) const; + void setIdsToWg( QWidget*, const QList& ); + Selection_Mode getSelMode( const int ) const; void updateSelection(); private: - // widgets - QFrame* myMainFrame; + QWidget* myMainFrame; QButtonGroup* mySourceGrp; QCheckBox* mySetInViewer; @@ -301,7 +280,7 @@ private: SMESHGUI_FilterTable* myTable; // initial fields - QValueList myTypes; + QList myTypes; SMESHGUI* mySMESHGUI; LightApp_SelectionMgr* mySelectionMgr; SVTK_Selector* mySelector; @@ -317,4 +296,4 @@ private: QString myHelpFileName; }; -#endif +#endif // SMESHGUI_FILTERDLG_H diff --git a/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx b/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx index 6fd68f459..e3f08eac5 100644 --- a/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx @@ -1,59 +1,60 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_FilterLibraryDlg.cxx +// Author : Sergey LITONIN, Open CASCADE S.A.S. // -// -// File : SMESHGUI_FilterLibraryDlg.cxx -// Author : Sergey LITONIN -// Module : SMESH +// SMESH includes #include "SMESHGUI_FilterLibraryDlg.h" #include "SMESHGUI.h" -#include "SMESHGUI_Utils.h" #include "SMESHGUI_FilterUtils.h" - -#include "SUIT_Session.h" -#include "SUIT_Desktop.h" -#include "SUIT_FileDlg.h" -#include "SUIT_MessageBox.h" - -#include "LightApp_Application.h" - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define SPACING 5 -#define MARGIN 10 +#include "SMESHGUI_FilterDlg.h" + +// SALOME GUI includes +#include +#include +#include +#include +#include + +#include + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SPACING 6 +#define MARGIN 11 /*! * Class : SMESHGUI_FilterLibraryDlg::Dialog @@ -62,17 +63,17 @@ class SMESHGUI_FilterLibraryDlg::Dialog : public SUIT_FileDlg { - public: +public: Dialog(QWidget* theParent, const bool theToOpen); virtual ~Dialog(); - protected: +protected: virtual bool acceptData(); }; SMESHGUI_FilterLibraryDlg::Dialog::Dialog (QWidget* theParent, const bool theToOpen) - : SUIT_FileDlg(theParent, theToOpen) + : SUIT_FileDlg(theParent, theToOpen) { } @@ -99,13 +100,12 @@ bool SMESHGUI_FilterLibraryDlg::Dialog::acceptData() //======================================================================= SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlg (SMESHGUI* theModule, QWidget* parent, - const QValueList& theTypes, - const int theMode, - const char* theName) - : QDialog( parent, theName, false, WStyle_Customize | - WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ), - mySMESHGUI( theModule ) + const QList& theTypes, + const int theMode) + : QDialog( parent ), + mySMESHGUI( theModule ) { + setModal(false); construct(theTypes, theMode); } @@ -116,13 +116,12 @@ SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlg (SMESHGUI* theModule, SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlg (SMESHGUI* theModule, QWidget* parent, const int theType, - const int theMode, - const char* theName) - : QDialog( parent, theName, true, WStyle_Customize | - WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ), - mySMESHGUI( theModule ) + const int theMode) + : QDialog( parent ), + mySMESHGUI( theModule ) { - QValueList aTypes; + setModal(true); + QList aTypes; aTypes.append(theType); construct(aTypes, theMode); } @@ -131,16 +130,18 @@ SMESHGUI_FilterLibraryDlg::SMESHGUI_FilterLibraryDlg (SMESHGUI* theModule, // name : SMESHGUI_FilterLibraryDlg::construct // Purpose : Construct dialog (called by constructor) //======================================================================= -void SMESHGUI_FilterLibraryDlg::construct (const QValueList& theTypes, +void SMESHGUI_FilterLibraryDlg::construct (const QList& theTypes, const int theMode) { myTypes = theTypes; myMode = theMode; - QVBoxLayout* aDlgLay = new QVBoxLayout(this, MARGIN, SPACING); + QVBoxLayout* aDlgLay = new QVBoxLayout(this); + aDlgLay->setMargin(MARGIN); + aDlgLay->setSpacing(SPACING); myMainFrame = createMainFrame (this); - QFrame* aBtnFrame = createButtonFrame(this); + QWidget* aBtnFrame = createButtonFrame(this); aDlgLay->addWidget(myMainFrame); aDlgLay->addWidget(aBtnFrame); @@ -156,46 +157,47 @@ void SMESHGUI_FilterLibraryDlg::construct (const QValueList& theTypes, // name : SMESHGUI_FilterLibraryDlg::createMainFrame // Purpose : Create frame containing dialog's input fields //======================================================================= -QFrame* SMESHGUI_FilterLibraryDlg::createMainFrame (QWidget* theParent) +QWidget* SMESHGUI_FilterLibraryDlg::createMainFrame (QWidget* theParent) { - QGroupBox* aMainFrame = new QGroupBox(1, Qt::Horizontal, theParent); - aMainFrame->setFrameStyle(QFrame::NoFrame); - aMainFrame->setInsideMargin(0); + QWidget* aMainFrame = new QWidget(theParent); + QGridLayout* aMainLay = new QGridLayout(aMainFrame); + aMainLay->setMargin(0); + aMainLay->setSpacing(SPACING); // library name - QGroupBox* aGrp = new QGroupBox(1, Qt::Vertical, aMainFrame); - aGrp->setFrameStyle(QFrame::NoFrame); - aGrp->setInsideMargin(0); - - new QLabel(tr("LIBRARY_FILE"), aGrp); - myFileName = new QLineEdit(aGrp); - myOpenBtn = new QPushButton(aGrp); - myOpenBtn->setPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap( + QLabel* aFileLab = new QLabel(tr("LIBRARY_FILE"), aMainFrame); + myFileName = new QLineEdit(aMainFrame); + myOpenBtn = new QPushButton(aMainFrame); + myOpenBtn->setIcon(SUIT_Session::session()->resourceMgr()->loadPixmap( "SUIT", tr("ICON_FILE_OPEN"))); // filters list box - aGrp = new QGroupBox(1, Qt::Vertical, tr("FILTER_NAMES"), aMainFrame); - QFrame* aFrame = new QFrame(aGrp); - myListBox = new QListBox(aFrame); - myAddBtn = new QPushButton(tr("ADD"), aFrame); - myDeleteBtn = new QPushButton(tr("DELETE"), aFrame); + QGroupBox* aFiltersGrp = new QGroupBox(tr("FILTER_NAMES"), aMainFrame); + QGridLayout* aLay = new QGridLayout(aFiltersGrp); + aLay->setMargin(MARGIN); + aLay->setSpacing(SPACING); + + myListBox = new QListWidget(aFiltersGrp); + + myAddBtn = new QPushButton(tr("ADD"), aFiltersGrp); + myDeleteBtn = new QPushButton(tr("DELETE"), aFiltersGrp); - QGridLayout* aLay = new QGridLayout(aFrame, 3, 2, 0, 5); - aLay->addMultiCellWidget(myListBox, 0, 2, 0, 0); - aLay->addWidget(myAddBtn, 0, 1); + aLay->addWidget(myListBox, 0, 0, 3, 1); + aLay->addWidget(myAddBtn, 0, 1); aLay->addWidget(myDeleteBtn, 1, 1); - QSpacerItem* aVSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); - aLay->addItem(aVSpacer, 2, 1); + aLay->setRowStretch(2, 5); // filter name - myNameGrp = new QGroupBox(1, Qt::Vertical, aMainFrame); - myNameGrp->setFrameStyle(QFrame::NoFrame); - myNameGrp->setInsideMargin(0); - new QLabel(tr("FILTER_NAME"), myNameGrp); - myName = new QLineEdit(myNameGrp); + myNameGrp = new QWidget(aMainFrame); + QHBoxLayout* myNameGrpLayout = new QHBoxLayout(myNameGrp); + myNameGrpLayout->setMargin(0); + myNameGrpLayout->setSpacing(SPACING); + + myNameGrpLayout->addWidget( new QLabel(tr("FILTER_NAME"), myNameGrp) ); + myNameGrpLayout->addWidget( myName = new QLineEdit(myNameGrp) ); // table @@ -204,20 +206,27 @@ QFrame* SMESHGUI_FilterLibraryDlg::createMainFrame (QWidget* theParent) myTable->SetLibsEnabled(false); myListBox->setMinimumHeight((int)(myTable->sizeHint().height() * 0.5)); - myListBox->setRowMode(QListBox::FitToWidth); - myListBox->setSelectionMode(QListBox::Single); + //myListBox->setRowMode(QListWidget::FitToWidth); //VSR : TODO ??? + myListBox->setSelectionMode(QListWidget::SingleSelection); myOpenBtn->setAutoDefault(false); myAddBtn->setAutoDefault(false); myDeleteBtn->setAutoDefault(false); + aMainLay->addWidget(aFileLab, 0, 0); + aMainLay->addWidget(myFileName, 0, 1); + aMainLay->addWidget(myOpenBtn, 0, 2); + aMainLay->addWidget(aFiltersGrp, 1, 0, 1, 3); + aMainLay->addWidget(myNameGrp, 2, 0, 1, 3); + aMainLay->addWidget(myTable, 3, 0, 1, 3); + // connect signals and slots connect(myFileName, SIGNAL(returnPressed()), this, SLOT(onReturnPressed())); - connect(myOpenBtn , SIGNAL(clicked()), this, SLOT(onBrowse())); + connect(myOpenBtn, SIGNAL(clicked()), this, SLOT(onBrowse())); - connect(myListBox, SIGNAL(highlighted(const QString&)), - this, SLOT(onFilterChanged(const QString&))); + connect(myListBox, SIGNAL(currentTextChanged(const QString&)), + this, SLOT(onFilterChanged(const QString&))); connect(myAddBtn, SIGNAL(clicked()), this, SLOT(onAddBtnPressed())); connect(myDeleteBtn, SIGNAL(clicked()), this, SLOT(onDeleteBtnPressed())); @@ -237,9 +246,12 @@ QFrame* SMESHGUI_FilterLibraryDlg::createMainFrame (QWidget* theParent) // name : SMESHGUI_FilterLibraryDlg::createButtonFrame // Purpose : Create frame containing buttons //======================================================================= -QFrame* SMESHGUI_FilterLibraryDlg::createButtonFrame (QWidget* theParent) +QWidget* SMESHGUI_FilterLibraryDlg::createButtonFrame (QWidget* theParent) { - QGroupBox* aGrp = new QGroupBox(1, Qt::Vertical, theParent); + QGroupBox* aGrp = new QGroupBox(theParent); + QHBoxLayout* aLay = new QHBoxLayout(aGrp); + aLay->setMargin(MARGIN); + aLay->setSpacing(SPACING); myButtons[ BTN_OK ] = new QPushButton(tr("SMESH_BUT_OK" ), aGrp); myButtons[ BTN_Apply ] = new QPushButton(tr("SMESH_BUT_APPLY"), aGrp); @@ -248,8 +260,17 @@ QFrame* SMESHGUI_FilterLibraryDlg::createButtonFrame (QWidget* theParent) aLbl->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); myButtons[ BTN_Cancel ] = new QPushButton(tr("SMESH_BUT_CANCEL"), aGrp); - myButtons[ BTN_Close ] = new QPushButton(tr("SMESH_BUT_CLOSE"), aGrp); - myButtons[ BTN_Help ] = new QPushButton(tr("SMESH_BUT_HELP"), aGrp); + myButtons[ BTN_Close ] = new QPushButton(tr("SMESH_BUT_CLOSE"), aGrp); + myButtons[ BTN_Help ] = new QPushButton(tr("SMESH_BUT_HELP"), aGrp); + + aLay->addWidget(myButtons[ BTN_OK ]); + aLay->addSpacing(10); + aLay->addWidget(myButtons[ BTN_Apply ]); + aLay->addSpacing(10); + aLay->addStretch(); + aLay->addWidget(myButtons[ BTN_Cancel ]); + aLay->addWidget(myButtons[ BTN_Close ]); + aLay->addWidget(myButtons[ BTN_Help ]); connect(myButtons[ BTN_OK ], SIGNAL(clicked()), SLOT(onOk())); connect(myButtons[ BTN_Cancel ], SIGNAL(clicked()), SLOT(onClose())); @@ -259,7 +280,7 @@ QFrame* SMESHGUI_FilterLibraryDlg::createButtonFrame (QWidget* theParent) QMap::iterator anIter; for (anIter = myButtons.begin(); anIter != myButtons.end(); ++anIter) - anIter.data()->setAutoDefault(false); + anIter.value()->setAutoDefault(false); updateMainButtons(); @@ -297,7 +318,7 @@ SMESHGUI_FilterLibraryDlg::~SMESHGUI_FilterLibraryDlg() //======================================================================= void SMESHGUI_FilterLibraryDlg::Init (const int type, const int theMode) { - QValueList aTypes; + QList aTypes; aTypes.append(type); Init(aTypes, theMode); } @@ -306,7 +327,7 @@ void SMESHGUI_FilterLibraryDlg::Init (const int type, const int theMode) // name : SMESHGUI_FilterLibraryDlg::Init // Purpose : Init dialog fields, connect signals and slots, show dialog //======================================================================= -void SMESHGUI_FilterLibraryDlg::Init (const QValueList& theTypes, +void SMESHGUI_FilterLibraryDlg::Init (const QList& theTypes, const int theMode) { myMode = theMode; @@ -326,14 +347,14 @@ void SMESHGUI_FilterLibraryDlg::Init (const QValueList& theTypes, if (myMode == ADD_TO) { - setCaption(tr("ADD_TO_TLT")); + setWindowTitle(tr("ADD_TO_TLT")); if (myFileName->text().isEmpty()) myFileName->setText(getDefaultLibraryName()); processNewLibrary(); } else if (myMode == COPY_FROM) { - setCaption(tr("COPY_FROM_TLT")); + setWindowTitle(tr("COPY_FROM_TLT")); if (myFileName->text().isEmpty()) myFileName->setText(getDefaultLibraryName()); processNewLibrary(); @@ -342,7 +363,7 @@ void SMESHGUI_FilterLibraryDlg::Init (const QValueList& theTypes, } else { - setCaption(tr("EDIT_LIB_TLT")); + setWindowTitle(tr("EDIT_LIB_TLT")); if (myFileName->text().isEmpty()) myFileName->setText(getDefaultLibraryName()); processNewLibrary(); @@ -402,14 +423,13 @@ bool SMESHGUI_FilterLibraryDlg::onApply() return false; if (myLibrary->_is_nil()) { - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_WRN_WARNING"), - tr("LIBRARY_IS_NOT_LOADED"), QMessageBox::Ok); + SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_WRN_WARNING"), + tr("LIBRARY_IS_NOT_LOADED")); return false; } - const char* aName = myFileName->text().latin1(); - if (strcmp(myLibrary->GetFileName(), aName) != 0) - myLibrary->SetFileName(aName); + if (myFileName->text() != myLibrary->GetFileName()) + myLibrary->SetFileName(myFileName->text().toLatin1().data()); bool aResult = false; @@ -417,9 +437,11 @@ bool SMESHGUI_FilterLibraryDlg::onApply() aResult = true; } else if (myMode == EDIT || myMode == ADD_TO) { SMESH::Filter_var aFilter = createFilter(); - if (!myLibrary->Replace(myCurrFilterName, myName->text(), aFilter.in())) { - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"), - tr("ERROR_OF_EDITING"), QMessageBox::Ok); + if (!myLibrary->Replace(myCurrFilterName.toLatin1().data(), + myName->text().toLatin1().data(), + aFilter.in())) { + SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"), + tr("ERROR_OF_EDITING")); aResult = false; } else @@ -434,8 +456,8 @@ bool SMESHGUI_FilterLibraryDlg::onApply() getDefaultLibraryName() = QString(aFileName); delete aFileName; } else if (myMode != COPY_FROM) { - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"), - tr("ERROR_OF_SAVING"), QMessageBox::Ok); + SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"), + tr("ERROR_OF_SAVING")); } else { } @@ -478,16 +500,17 @@ void SMESHGUI_FilterLibraryDlg::onHelp() if (app) app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); else { - QString platform; + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName)); } } @@ -556,15 +579,15 @@ QStringList SMESHGUI_FilterLibraryDlg::filterWildCards(const QString& theFilter) { QStringList res; - int b = theFilter.findRev("("); - int e = theFilter.findRev(")"); + int b = theFilter.lastIndexOf("("); + int e = theFilter.lastIndexOf(")"); if (b != -1 && e != -1) { - QString content = theFilter.mid(b + 1, e - b - 1).stripWhiteSpace(); - QStringList lst = QStringList::split(" ", content); + QString content = theFilter.mid(b + 1, e - b - 1).trimmed(); + QStringList lst = content.split(" ", QString::SkipEmptyParts); for (QStringList::const_iterator it = lst.begin(); it != lst.end(); ++it) - if ((*it).find(".") != -1) - res.append((*it).stripWhiteSpace()); + if ((*it).indexOf(".") != -1) + res.append((*it).trimmed()); } return res; } @@ -592,14 +615,14 @@ QStringList SMESHGUI_FilterLibraryDlg::prepareFilters() const void SMESHGUI_FilterLibraryDlg::onBrowse() { Dialog* aDlg = new Dialog(this, true); - aDlg->setCaption(tr("OPEN_LIBRARY")); + aDlg->setWindowTitle(tr("OPEN_LIBRARY")); //aDlg->setMode(myMode == COPY_FROM ? QFileDialogP::ExistingFile : QFileDialogP::AnyFile); - aDlg->setMode(myMode == COPY_FROM ? QFileDialog::ExistingFile : QFileDialog::AnyFile); + aDlg->setFileMode(myMode == COPY_FROM ? QFileDialog::ExistingFile : QFileDialog::AnyFile); aDlg->setFilters(prepareFilters()); - aDlg->setSelection(getFileName()); + aDlg->selectFile(getFileName()); - QPushButton* anOkBtn = (QPushButton*)aDlg->child("OK", "QPushButton"); + QPushButton* anOkBtn = (QPushButton*)aDlg->findChild("OK"); if (anOkBtn != 0) anOkBtn->setText(tr("SMESH_BUT_OK")); @@ -611,7 +634,7 @@ void SMESHGUI_FilterLibraryDlg::onBrowse() if (fName.isEmpty()) return; - if (QFileInfo(fName).extension().isEmpty()) + if (QFileInfo(fName).suffix().isEmpty()) fName = autoExtension(fName); fName = QDir::convertSeparators(fName); @@ -622,7 +645,7 @@ void SMESHGUI_FilterLibraryDlg::onBrowse() setFileName(fName); - QString aName = myListBox->text(myListBox->count() - 1); + QString aName = myListBox->item(myListBox->count() - 1)->text(); processNewLibrary(); if (myMode == ADD_TO) @@ -646,15 +669,15 @@ void SMESHGUI_FilterLibraryDlg::processNewLibrary() if (aFilterMgr->_is_nil()) return; - myLibrary = aFilterMgr->LoadLibrary(autoExtension(getFileName())); + myLibrary = aFilterMgr->LoadLibrary(autoExtension(getFileName()).toLatin1().data()); if (myLibrary->_is_nil()) { if (myMode == COPY_FROM) { - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"), - tr("ERROR_LOAD"), QMessageBox::Ok); + SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"), + tr("ERROR_LOAD")); return; } else { myLibrary = aFilterMgr->CreateLibrary(); - myLibrary->SetFileName(getFileName().latin1()); + myLibrary->SetFileName(getFileName().toLatin1().data()); } } @@ -672,7 +695,7 @@ void SMESHGUI_FilterLibraryDlg::updateList() for (int i = 0, n = aNames->length(); i < n; i++) aList.append(QString(aNames[ i ])); myListBox->clear(); - myListBox->insertStringList(aList); + myListBox->addItems(aList); if (myListBox->count() == 0) { myTable->Clear(myTable->GetType()); @@ -703,8 +726,8 @@ bool SMESHGUI_FilterLibraryDlg::isNameValid(const bool theMess) const QString aCurrName = myName->text(); if (aCurrName.isEmpty()) { if (theMess) - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), - tr("EMPTY_FILTER_NAME"), QMessageBox::Ok); + SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), + tr("EMPTY_FILTER_NAME")); return false; } @@ -712,8 +735,8 @@ bool SMESHGUI_FilterLibraryDlg::isNameValid(const bool theMess) const for (int f = 0, n = aNames->length(); f < n; f++) { if (aNames[ f ] == aCurrName && aNames[ f ] != myCurrFilterName) { if (theMess) - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), - tr("ERROR_FILTER_NAME"), QMessageBox::Ok); + SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), + tr("ERROR_FILTER_NAME")); return false; } } @@ -735,7 +758,7 @@ bool SMESHGUI_FilterLibraryDlg::isPermissionValid(const bool theIsExistingOnly) bool isWritable = false; QString fName(myFileName->text()); - if (QFileInfo(fName).extension().isEmpty()) + if (QFileInfo(fName).suffix().isEmpty()) fName = autoExtension(fName); fName = QDir::convertSeparators(fName); @@ -743,7 +766,7 @@ bool SMESHGUI_FilterLibraryDlg::isPermissionValid(const bool theIsExistingOnly) if (QFileInfo(fName).exists()) { isWritable = QFileInfo(fName).isWritable(); } else if (!theIsExistingOnly) { - QFileInfo aDirInfo(QFileInfo(fName).dirPath(true)); + QFileInfo aDirInfo(QFileInfo(fName).absolutePath()); isWritable = aDirInfo.isWritable(); /*if (QDir(QFileInfo(fName).dirPath(true)).exists() || QDir().mkdir(QFileInfo(fName).dirPath(true))) @@ -760,8 +783,8 @@ bool SMESHGUI_FilterLibraryDlg::isPermissionValid(const bool theIsExistingOnly) } if (!isWritable) { - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_WRN_WARNING"), - tr("NO_PERMISSION"), QMessageBox::Ok); + SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_WRN_WARNING"), + tr("NO_PERMISSION")); return false; } @@ -797,20 +820,22 @@ void SMESHGUI_FilterLibraryDlg::onFilterChanged(const QString& theName) if (!isValid(true)) { myListBox->blockSignals(true); - myListBox->setCurrentItem(myCurrFilter); + myListBox->setCurrentRow(myCurrFilter); myListBox->blockSignals(false); return; } SMESH::Filter_var aFilter = createFilter(); - myLibrary->Replace(myCurrFilterName.latin1(), myName->text().latin1(), aFilter); + myLibrary->Replace(myCurrFilterName.toLatin1().data(), + myName->text().toLatin1().data(), + aFilter); } // Fill table with filter parameters - SMESH::Filter_var aFilter = myLibrary->Copy(theName); + SMESH::Filter_var aFilter = myLibrary->Copy(theName.toLatin1().data()); myCurrFilterName = theName; - myCurrFilter = myListBox->currentItem(); + myCurrFilter = myListBox->currentRow(); myName->setText(theName); @@ -834,7 +859,7 @@ void SMESHGUI_FilterLibraryDlg::onFilterChanged(const QString& theName) //======================================================================= void SMESHGUI_FilterLibraryDlg::onReturnPressed() { - QString aName = myListBox->text(myListBox->count() - 1); + QString aName = myListBox->item(myListBox->count() - 1)->text(); processNewLibrary(); @@ -906,7 +931,9 @@ void SMESHGUI_FilterLibraryDlg::onAddBtnPressed() return; SMESH::Filter_var aFilter = createFilter(); - myLibrary->Replace(myCurrFilterName.latin1(), myName->text().latin1(), aFilter); + myLibrary->Replace(myCurrFilterName.toLatin1().data(), + myName->text().toLatin1().data(), + aFilter); } addFilterToLib(getDefaultFilterName()); @@ -920,8 +947,8 @@ void SMESHGUI_FilterLibraryDlg::onAddBtnPressed() void SMESHGUI_FilterLibraryDlg::addFilterToLib (const QString& theName) { if (myLibrary->_is_nil()) { - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_WRN_WARNING"), - tr("LIBRARY_IS_NOT_LOADED"), QMessageBox::Ok); + SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_WRN_WARNING"), + tr("LIBRARY_IS_NOT_LOADED")); return; } @@ -940,12 +967,12 @@ void SMESHGUI_FilterLibraryDlg::addFilterToLib (const QString& theName) // add new filter in library bool aResult = !aFilter->GetPredicate()->_is_nil() - ? myLibrary->Add(aName.latin1(), aFilter) - : myLibrary->AddEmpty(aName.latin1(), (SMESH::ElementType)myTable->GetType()); + ? myLibrary->Add(aName.toLatin1().data(), aFilter) + : myLibrary->AddEmpty(aName.toLatin1().data(), (SMESH::ElementType)myTable->GetType()); if (!aResult) { - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"), - tr("ERROR_OF_ADDING"), QMessageBox::Ok); + SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"), + tr("ERROR_OF_ADDING")); } updateList(); @@ -954,8 +981,8 @@ void SMESHGUI_FilterLibraryDlg::addFilterToLib (const QString& theName) setSelected(aName); if (theName != aName) - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_WARNING"), - tr("ASSIGN_NEW_NAME").arg(theName).arg(aName), QMessageBox::Ok); + SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_WARNING"), + tr("ASSIGN_NEW_NAME").arg(theName).arg(aName)); } //======================================================================= @@ -967,7 +994,7 @@ QString& SMESHGUI_FilterLibraryDlg::getDefaultLibraryName() const static QString aName; if (aName.isEmpty()) { - QString aHomeDir = QDir(QDir::home()).absPath(); + QString aHomeDir = QDir(QDir::home()).absolutePath(); aName = aHomeDir + "/" + tr ("LIB_NAME"); } return aName; @@ -1028,7 +1055,7 @@ bool SMESHGUI_FilterLibraryDlg::setSelected(const QString& theName) int anIndex = getIndex(theName); if (anIndex != -1) { - myListBox->setCurrentItem(anIndex); + myListBox->setCurrentRow(anIndex); myCurrFilterName = theName; myCurrFilter = anIndex; } @@ -1042,7 +1069,7 @@ bool SMESHGUI_FilterLibraryDlg::setSelected(const QString& theName) int SMESHGUI_FilterLibraryDlg::getIndex(const QString& theName) const { for (int i = 0, n = myListBox->count(); i < n; i++) - if (myListBox->text(i) == theName) + if (myListBox->item(i)->text() == theName) return i; return -1; } @@ -1054,25 +1081,25 @@ int SMESHGUI_FilterLibraryDlg::getIndex(const QString& theName) const void SMESHGUI_FilterLibraryDlg::onDeleteBtnPressed() { if (myLibrary->_is_nil()) { - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_WRN_WARNING"), - tr("LIBRARY_IS_NOT_LOADED"), QMessageBox::Ok); + SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_WRN_WARNING"), + tr("LIBRARY_IS_NOT_LOADED")); return; } int anIndex = getIndex(myCurrFilterName); - if (anIndex == -1 || !myLibrary->Delete(myCurrFilterName.latin1())) { - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"), - tr("ERROR_OF_DELETING"), QMessageBox::Ok); + if (anIndex == -1 || !myLibrary->Delete(myCurrFilterName.toLatin1().data())) { + SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"), + tr("ERROR_OF_DELETING")); } else { myCurrFilterName = ""; myCurrFilter = -1; - myListBox->removeItem(anIndex); + delete myListBox->item(anIndex); if (anIndex >= 1) - myListBox->setSelected(anIndex - 1, true); + myListBox->item(anIndex - 1)->setSelected(true); else if (anIndex == 0 && myListBox->count() > 0) - myListBox->setSelected(0, true); + myListBox->item(0)->setSelected(true); else myTable->Clear(); } @@ -1091,12 +1118,12 @@ void SMESHGUI_FilterLibraryDlg::onDeleteBtnPressed() //======================================================================= void SMESHGUI_FilterLibraryDlg::onFilterNameChanged (const QString& theName) { - int aCurrItem = myListBox->currentItem(); + int aCurrItem = myListBox->currentRow(); if (aCurrItem == -1) return; myListBox->blockSignals(true); - myListBox->changeItem(theName, aCurrItem); + myListBox->item(aCurrItem)->setText(theName); myListBox->blockSignals(false); } @@ -1153,7 +1180,9 @@ void SMESHGUI_FilterLibraryDlg::onNeedValidation() if (valid) { SMESH::Filter_var aFilter = createFilter(myTable->GetType()); - myLibrary->Replace(myCurrFilterName.latin1(), myName->text().latin1(), aFilter); + myLibrary->Replace(myCurrFilterName.toLatin1().data(), + myName->text().toLatin1().data(), + aFilter); } } } @@ -1168,9 +1197,8 @@ void SMESHGUI_FilterLibraryDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) - { - e->accept(); - onHelp(); - } + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + onHelp(); + } } diff --git a/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.h b/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.h index cbc8111de..f931c454c 100644 --- a/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.h +++ b/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.h @@ -1,49 +1,48 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_FilterLibraryDlg.h +// Author : Sergey LITONIN, Open CASCADE S.A.S. // -// File : SMESHGUI_FilterLibraryDlg.h -// Author : Sergey LITONIN -// Module : SMESH - -#ifndef SMESHGUI_FilterLibraryDlg_H -#define SMESHGUI_FilterLibraryDlg_H +#ifndef SMESHGUI_FILTERLIBRARYDLG_H +#define SMESHGUI_FILTERLIBRARYDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include -#include +// Qt includes +#include +#include +#include +// IDL includes #include #include CORBA_SERVER_HEADER(SMESH_Filter) -class QCloseEvent; -class QListBox; -class QFrame; -class QEvent; +class QListWidget; class QLineEdit; class QPushButton; -class QGroupBox; +class SMESHGUI; +class SMESHGUI_FilterTable; /* Class : SMESHGUI_FilterLibraryDlg @@ -65,35 +64,22 @@ public: enum { ADD_TO, COPY_FROM, EDIT }; public: - - SMESHGUI_FilterLibraryDlg( SMESHGUI*, - QWidget*, - const QValueList& types, - const int mode, - const char* name = 0 ); - - SMESHGUI_FilterLibraryDlg( SMESHGUI*, - QWidget*, - const int type, - const int mode, - const char* name = 0 ); - - virtual ~SMESHGUI_FilterLibraryDlg(); + SMESHGUI_FilterLibraryDlg( SMESHGUI*, QWidget*, const QList&, const int ); + SMESHGUI_FilterLibraryDlg( SMESHGUI*, QWidget*, const int, const int ); + virtual ~SMESHGUI_FilterLibraryDlg(); - void Init( const QValueList& types, const int theMode ); - void Init( const int type, const int theMode ); + void Init( const QList&, const int ); + void Init( const int, const int ); const SMESHGUI_FilterTable* GetTable() const; void SetTable( const SMESHGUI_FilterTable* ); private: - - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; - void keyPressEvent( QKeyEvent* e ); + void closeEvent( QCloseEvent* ); + void enterEvent( QEvent* ); + void keyPressEvent( QKeyEvent* ); private slots: - void onOk(); bool onApply(); void onClose(); @@ -111,13 +97,12 @@ private slots: void onNeedValidation(); private: - - void construct( const QValueList& types, const int mode ); - QFrame* createButtonFrame( QWidget* ); - QFrame* createMainFrame ( QWidget* ); - bool isValid( const bool theMess = true ) const; - bool isNameValid( const bool theMess = true ) const; - SMESH::Filter_ptr createFilter( const int theType = -1 ); + void construct( const QList&, const int ); + QWidget* createButtonFrame( QWidget* ); + QWidget* createMainFrame( QWidget* ); + bool isValid( const bool = true ) const; + bool isNameValid( const bool = true ) const; + SMESH::Filter_ptr createFilter( const int = -1 ); QStringList prepareFilters() const; QString autoExtension( const QString& ) const; bool setSelected( const QString& ); @@ -127,29 +112,29 @@ private: void enableMainButtons(); void processNewLibrary(); QString getFileName() const; - void setFileName( const QString& txt, const bool autoExtension = true ); - QStringList filterWildCards( const QString& theFilter ) const; + void setFileName( const QString&, const bool = true ); + QStringList filterWildCards( const QString& ) const; QString& getDefaultLibraryName() const; QString getDefaultFilterName() const; - void addFilterToLib( const QString& name ); + void addFilterToLib( const QString& ); void updateList(); - bool isPermissionValid( const bool theIsExistingOnly ); + bool isPermissionValid( const bool ); private: - QFrame* myMainFrame; + QWidget* myMainFrame; QMap myButtons; SMESHGUI_FilterTable* myTable; QLineEdit* myFileName; QPushButton* myOpenBtn; - QListBox* myListBox; + QListWidget* myListBox; QPushButton* myAddBtn; QPushButton* myDeleteBtn; - QGroupBox* myNameGrp; + QWidget* myNameGrp; QLineEdit* myName; SMESHGUI* mySMESHGUI; - QValueList myTypes; + QList myTypes; int myMode; SMESH::FilterLibrary_var myLibrary; @@ -159,4 +144,4 @@ private: QString myHelpFileName; }; -#endif +#endif // SMESHGUI_FILTERLIBRARYDLG_H diff --git a/src/SMESHGUI/SMESHGUI_FilterUtils.cxx b/src/SMESHGUI/SMESHGUI_FilterUtils.cxx index c0e08a0cb..b7a6ca769 100644 --- a/src/SMESHGUI/SMESHGUI_FilterUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_FilterUtils.cxx @@ -1,29 +1,33 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// SMESH SMESHGUI : GUI for SMESH component // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_FilterUtils.cxx +// Author : Open CASCADE S.A.S. +// - +// SMESH includes #include "SMESHGUI_FilterUtils.h" #include "SMESHGUI.h" -#include "utilities.h" - namespace SMESH { SMESH::FilterManager_var& GetFilterManager() @@ -34,4 +38,4 @@ namespace SMESH } return aFilterManager; } -} +} // end of namespace SMESH diff --git a/src/SMESHGUI/SMESHGUI_FilterUtils.h b/src/SMESHGUI/SMESHGUI_FilterUtils.h index 22d65870e..00b4bdc38 100644 --- a/src/SMESHGUI/SMESHGUI_FilterUtils.h +++ b/src/SMESHGUI/SMESHGUI_FilterUtils.h @@ -1,36 +1,41 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// +// SMESH SMESHGUI : GUI for SMESH component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_FilterUtils.h +// Author : Open CASCADE S.A.S. +// -#ifndef SMESHGUI_FilterUtils_HeaderFile -#define SMESHGUI_FilterUtils_HeaderFile +#ifndef SMESHGUI_FILTERUTILS_H +#define SMESHGUI_FILTERUTILS_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include "SALOMEconfig.h" +// IDL includes +#include #include CORBA_SERVER_HEADER(SMESH_Filter) - -namespace SMESH{ - +namespace SMESH +{ SMESHGUI_EXPORT SMESH::FilterManager_var& GetFilterManager(); - } - -#endif +#endif // SMESHGUI_FILTERUTILS_H diff --git a/src/SMESHGUI/SMESHGUI_GEOMGenUtils.cxx b/src/SMESHGUI/SMESHGUI_GEOMGenUtils.cxx index 2537452c6..bb7356a7a 100644 --- a/src/SMESHGUI/SMESHGUI_GEOMGenUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_GEOMGenUtils.cxx @@ -1,38 +1,44 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// SMESH SMESHGUI : GUI for SMESH component // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_GEOMGenUtils.cxx +// Author : Open CASCADE S.A.S. +// -#include - +// SMESH includes #include "SMESHGUI_GEOMGenUtils.h" #include "SMESHGUI_Utils.h" +// SALOME GEOM includes #include -#include -#include +// SALOME KERNEL includes #include +// IDL includes +#include #include CORBA_CLIENT_HEADER(SMESH_Mesh) - -namespace SMESH { - +namespace SMESH +{ GEOM::GEOM_Gen_var GetGEOMGen() { static GEOM::GEOM_Gen_var aGEOMGen; @@ -74,7 +80,7 @@ namespace SMESH { return GEOM::GEOM_Object::_nil(); _PTR(ChildIterator) anIter (aStudy->NewChildIterator(theSO)); - for (; anIter->More(); anIter->Next()) { + for ( ; anIter->More(); anIter->Next()) { _PTR(SObject) aSObject = anIter->Value(); _PTR(SObject) aRefSOClient; GEOM::GEOM_Object_var aMeshShape; @@ -106,4 +112,4 @@ namespace SMESH { GEOM::GEOM_Object_var subShape = aShapesOp->GetSubShape (theMainShape,theID); return subShape._retn(); } -} +} // end of namespace SMESH diff --git a/src/SMESHGUI/SMESHGUI_GEOMGenUtils.h b/src/SMESHGUI/SMESHGUI_GEOMGenUtils.h index 32a7526ea..7237af1ab 100644 --- a/src/SMESHGUI/SMESHGUI_GEOMGenUtils.h +++ b/src/SMESHGUI/SMESHGUI_GEOMGenUtils.h @@ -1,44 +1,52 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// SMESH SMESHGUI : GUI for SMESH component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_GEOMGenUtils.h +// Author : Open CASCADE S.A.S. +// -#ifndef SMESHGUI_GEOMGenUtils_HeaderFile -#define SMESHGUI_GEOMGenUtils_HeaderFile +#ifndef SMESHGUI_GEOMGENUTILS_H +#define SMESHGUI_GEOMGENUTILS_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include "SALOMEconfig.h" -#include CORBA_SERVER_HEADER(GEOM_Gen) +// SALOME KERNEL includes +#include -#include "SALOMEDSClient_definitions.hxx" +// IDL includes +#include +#include CORBA_SERVER_HEADER(GEOM_Gen) class SALOMEDSClient_SObject; namespace SMESH { - SMESHGUI_EXPORT GEOM::GEOM_Gen_var GetGEOMGen(); + SMESHGUI_EXPORT GEOM::GEOM_Gen_var GetGEOMGen(); - SMESHGUI_EXPORT GEOM::GEOM_Object_var GetShapeOnMeshOrSubMesh (_PTR(SObject) theSObject); + SMESHGUI_EXPORT GEOM::GEOM_Object_var GetShapeOnMeshOrSubMesh( _PTR(SObject) ); - SMESHGUI_EXPORT GEOM::GEOM_Object_ptr GetGeom (_PTR(SObject) theSO); + SMESHGUI_EXPORT GEOM::GEOM_Object_ptr GetGeom( _PTR(SObject) ); - SMESHGUI_EXPORT GEOM::GEOM_Object_ptr GetSubShape (GEOM::GEOM_Object_ptr theMainShape, - long theID); + SMESHGUI_EXPORT GEOM::GEOM_Object_ptr GetSubShape( GEOM::GEOM_Object_ptr, long ); } -#endif +#endif // SMESHGUI_GEOMGENUTILS_H diff --git a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx index c03ce4fd5..de1f41994 100644 --- a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx @@ -1,114 +1,109 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 CEA // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_GroupDlg.cxx +// Author : Natalia KOPNOVA, Open CASCADE S.A.S. // -// -// File : SMESHGUI_GroupDlg.cxx -// Author : Natalia KOPNOVA -// Module : SMESH -// $Header$ +// SMESH includes #include "SMESHGUI_GroupDlg.h" -#include "SMESHGUI_FilterDlg.h" -#include "SMESHGUI_ShapeByMeshDlg.h" #include "SMESHGUI.h" #include "SMESHGUI_Utils.h" #include "SMESHGUI_VTKUtils.h" -#include "SMESHGUI_MeshUtils.h" #include "SMESHGUI_GroupUtils.h" #include "SMESHGUI_FilterUtils.h" #include "SMESHGUI_GEOMGenUtils.h" +#include "SMESHGUI_FilterDlg.h" +#include "SMESHGUI_ShapeByMeshDlg.h" -#include "SMESH_TypeFilter.hxx" -#include "SMESH_Actor.h" -#include "SMESH_ActorUtils.h" +#include +#include +#include -#include "GEOMBase.h" -#include "GEOM_SelectionFilter.h" +// SALOME GEOM includes +#include +#include -#include "SUIT_Desktop.h" -#include "SUIT_ResourceMgr.h" -#include "SUIT_Session.h" -#include "SUIT_MessageBox.h" +// SALOME GUI includes +#include -#include "SalomeApp_Tools.h" -#include "SalomeApp_Application.h" -#include "SalomeApp_Study.h" -#include "LightApp_Application.h" -#include "SALOMEDSClient_Study.hxx" -#include "SALOME_ListIO.hxx" -#include "SALOME_ListIteratorOfListIO.hxx" +#include +#include +#include +#include -#include "SVTK_ViewWindow.h" -#include "SVTK_Selector.h" +#include +#include +#include +#include -#include "utilities.h" +#include +#include -// OCCT Includes +#include + +// SALOME KERNEL includes +#include + +// OCCT includes #include -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // STL includes #include #include #include -using namespace std; +#define SPACING 6 +#define MARGIN 11 //================================================================================= // function : SMESHGUI_GroupDlg() // purpose : //================================================================================= -SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule, const char* name, - SMESH::SMESH_Mesh_ptr theMesh, bool modal, WFlags fl) - : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | - WStyle_Title | WStyle_SysMenu | WDestructiveClose), - mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), - mySelector(SMESH::GetViewWindow( theModule )->GetSelector()), - myIsBusy( false ), - myActor( 0 ) +SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule, + SMESH::SMESH_Mesh_ptr theMesh ) + : QDialog( SMESH::GetDesktop( theModule ) ), + mySMESHGUI( theModule ), + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), + mySelector(SMESH::GetViewWindow( theModule )->GetSelector()), + myIsBusy( false ), + myActor( 0 ) { - if (!name) setName("SMESHGUI_GroupDlg"); initDialog(true); if (!theMesh->_is_nil()) init(theMesh); @@ -124,17 +119,14 @@ SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule, const char* name, // function : SMESHGUI_GroupDlg() // purpose : //================================================================================= -SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule, const char* name, - SMESH::SMESH_GroupBase_ptr theGroup, bool modal, WFlags fl) - : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | - WStyle_Title | WStyle_SysMenu | WDestructiveClose), - mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), - mySelector(SMESH::GetViewWindow( theModule )->GetSelector()), - myIsBusy( false ) +SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule, + SMESH::SMESH_GroupBase_ptr theGroup ) + : QDialog( SMESH::GetDesktop( theModule ) ), + mySMESHGUI( theModule ), + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), + mySelector(SMESH::GetViewWindow( theModule )->GetSelector()), + myIsBusy( false ) { - if (!name) setName("SMESHGUI_GroupDlg"); - initDialog(false); if (!theGroup->_is_nil()) init(theGroup); @@ -153,6 +145,9 @@ SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule, const char* name, //================================================================================= void SMESHGUI_GroupDlg::initDialog(bool create) { + setModal( false ); + setAttribute( Qt::WA_DeleteOnClose, true ); + myFilterDlg = 0; myCreate = create; myCurrentLineEdit = 0; @@ -164,34 +159,28 @@ void SMESHGUI_GroupDlg::initDialog(bool create) QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT"))); - if (create) { - setCaption(tr("SMESH_CREATE_GROUP_TITLE")); - myHelpFileName = "creating_groups_page.html"; - } - else { - setCaption(tr("SMESH_EDIT_GROUP_TITLE")); - myHelpFileName = "editing_groups_page.html"; - } + setWindowTitle(create ? tr("SMESH_CREATE_GROUP_TITLE") : tr("SMESH_EDIT_GROUP_TITLE")); + myHelpFileName = create ? "creating_groups_page.html" : "editing_groups_page.html"; - setSizeGripEnabled(TRUE); + setSizeGripEnabled(true); - QGridLayout* aMainLayout = new QGridLayout(this, 7, 3, 11, 6); + QGridLayout* aMainLayout = new QGridLayout(this); + aMainLayout->setMargin( MARGIN ); + aMainLayout->setSpacing( SPACING ); /***************************************************************/ - QLabel* meshGroupLab = new QLabel(this, "mesh/group label"); - if (create) - meshGroupLab->setText(tr("SMESH_MESH")); - else - meshGroupLab->setText(tr("SMESH_GROUP")); - myMeshGroupBtn = new QPushButton(this, "mesh/group button"); - myMeshGroupBtn->setPixmap(image0); - myMeshGroupLine = new QLineEdit(this, "mesh/group line"); + QLabel* meshGroupLab = new QLabel(create ? tr("SMESH_MESH") : tr("SMESH_GROUP"), this); + myMeshGroupBtn = new QPushButton(this); + myMeshGroupBtn->setIcon(image0); + myMeshGroupLine = new QLineEdit(this); myMeshGroupLine->setReadOnly(true); /***************************************************************/ - myTypeGroup = new QButtonGroup(1, Qt::Vertical, this, "Group types"); - myTypeGroup->setTitle(tr("SMESH_ELEMENTS_TYPE")); - myTypeGroup->setExclusive(true); + QGroupBox* aTypeBox = new QGroupBox(tr("SMESH_ELEMENTS_TYPE"), this); + myTypeGroup = new QButtonGroup(this); + QHBoxLayout* aTypeBoxLayout = new QHBoxLayout( aTypeBox ); + aTypeBoxLayout->setMargin( MARGIN ); + aTypeBoxLayout->setSpacing( SPACING ); QStringList types; types.append(tr("MESH_NODE")); @@ -200,200 +189,198 @@ void SMESHGUI_GroupDlg::initDialog(bool create) types.append(tr("SMESH_VOLUME")); QRadioButton* rb; for (int i = 0; i < types.count(); i++) { - rb = new QRadioButton(types[i], myTypeGroup); + rb = new QRadioButton(types[i], aTypeBox); + myTypeGroup->addButton(rb, i); + aTypeBoxLayout->addWidget( rb ); } - myTypeGroup->setEnabled(create); + aTypeBox->setEnabled(create); myTypeId = -1; /***************************************************************/ - QLabel* aName = new QLabel(this, "name label"); - aName->setText(tr("SMESH_NAME")); - aName->setMinimumSize(50,0); - myName = new QLineEdit(this, "name"); + QLabel* aName = new QLabel(tr("SMESH_NAME"), this); + aName->setMinimumWidth(50); + myName = new QLineEdit(this); /***************************************************************/ - myGrpTypeGroup = new QButtonGroup(1, Qt::Vertical, this, "Type of group"); - myGrpTypeGroup->setTitle(tr("SMESH_GROUP_TYPE")); - myGrpTypeGroup->setExclusive(true); - QRadioButton* rb1 = new QRadioButton( tr("SMESH_GROUP_STANDALONE"), myGrpTypeGroup); - QRadioButton* rb2 = new QRadioButton( tr("SMESH_GROUP_GEOMETRY"), myGrpTypeGroup); - myGrpTypeGroup->setEnabled(create); + QGroupBox* aGrpTypeBox = new QGroupBox(tr("SMESH_GROUP_TYPE"), this); + myGrpTypeGroup = new QButtonGroup(this); + QHBoxLayout* aGrpTypeBoxLayout = new QHBoxLayout( aGrpTypeBox ); + aGrpTypeBoxLayout->setMargin( MARGIN ); + aGrpTypeBoxLayout->setSpacing( SPACING ); + + QRadioButton* rb1 = new QRadioButton( tr("SMESH_GROUP_STANDALONE"), aGrpTypeBox); + QRadioButton* rb2 = new QRadioButton( tr("SMESH_GROUP_GEOMETRY"), aGrpTypeBox); + myGrpTypeGroup->addButton(rb1, 0); + myGrpTypeGroup->addButton(rb2, 1); + aGrpTypeBoxLayout->addWidget(rb1); + aGrpTypeBoxLayout->addWidget(rb2); + aGrpTypeBox->setEnabled(create); myGrpTypeId = -1; /***************************************************************/ - myWGStack = new QWidgetStack( this, "widget stack"); - QWidget* wg1 = new QFrame( myWGStack, "first widget" ); - QWidget* wg2 = new QFrame( myWGStack, "second widget" ); + myWGStack = new QStackedWidget(this); + QWidget* wg1 = new QWidget( myWGStack ); + QWidget* wg2 = new QWidget( myWGStack ); /***************************************************************/ - QGroupBox* aContentBox = new QGroupBox(1, Qt::Horizontal, wg1, "content box"); - aContentBox->setTitle(tr("SMESH_CONTENT")); - QFrame* aContent = new QFrame(aContentBox, "content"); - QGridLayout* aLayout = new QGridLayout(aContent, 7, 4); - aLayout->setSpacing(6); - aLayout->setAutoAdd(false); - - QLabel* aLabel = new QLabel(aContent, "elements label"); - aLabel->setText(tr("SMESH_ID_ELEMENTS")); - myElements = new QListBox(aContent, "elements list"); - myElements->setSelectionMode(QListBox::Extended); - - myFilter = new QPushButton(aContent, "filter"); - myFilter->setText(tr("SMESH_BUT_FILTER")); - QPushButton* aAddBtn = new QPushButton(aContent, "add"); - aAddBtn->setText(tr("SMESH_BUT_ADD")); - QPushButton* aRemoveBtn = new QPushButton(aContent, "remove"); - aRemoveBtn->setText(tr("SMESH_BUT_REMOVE")); - QPushButton* aSortBtn = new QPushButton(aContent, "sort"); - aSortBtn->setText(tr("SMESH_BUT_SORT")); - - aLayout->addWidget(aLabel, 0, 0); - aLayout->addMultiCellWidget(myElements, 1, 6, 0, 0); - aLayout->addWidget(myFilter, 1, 2); - aLayout->addWidget(aAddBtn, 3, 2); - aLayout->addWidget(aRemoveBtn, 4, 2); - aLayout->addWidget(aSortBtn, 6, 2); - - aLayout->setColStretch(0, 1); - aLayout->addColSpacing(1, 20); - aLayout->addColSpacing(3, 20); - aLayout->setRowStretch(2, 1); - aLayout->setRowStretch(5, 1); + QGroupBox* aContentBox = new QGroupBox(tr("SMESH_CONTENT"), wg1); + QGridLayout* aContentBoxLayout = new QGridLayout(aContentBox); + aContentBoxLayout->setMargin(MARGIN); + aContentBoxLayout->setSpacing(SPACING); + + QLabel* aLabel = new QLabel(tr("SMESH_ID_ELEMENTS"), aContentBox); + myElements = new QListWidget(aContentBox); + myElements->setSelectionMode(QListWidget::ExtendedSelection); + + myFilter = new QPushButton(tr("SMESH_BUT_FILTER"), aContentBox); + QPushButton* aAddBtn = new QPushButton(tr("SMESH_BUT_ADD"), aContentBox); + QPushButton* aRemoveBtn = new QPushButton(tr("SMESH_BUT_REMOVE"), aContentBox); + QPushButton* aSortBtn = new QPushButton(tr("SMESH_BUT_SORT"), aContentBox); + + aContentBoxLayout->addWidget(aLabel, 0, 0); + aContentBoxLayout->addWidget(myElements, 1, 0, 6, 1); + aContentBoxLayout->addWidget(myFilter, 1, 1); + aContentBoxLayout->addWidget(aAddBtn, 3, 1); + aContentBoxLayout->addWidget(aRemoveBtn, 4, 1); + aContentBoxLayout->addWidget(aSortBtn, 6, 1); + + aContentBoxLayout->setColumnStretch(0, 1); + aContentBoxLayout->setRowStretch(2, 1); + aContentBoxLayout->setRowStretch(5, 1); /***************************************************************/ - QGroupBox* aSelectBox = new QGroupBox(3, Qt::Horizontal, wg1, "select box"); - aSelectBox->setTitle(tr("SMESH_SELECT_FROM")); - - mySelectSubMesh = new QCheckBox(aSelectBox, "submesh checkbox"); - mySelectSubMesh->setText(tr("SMESH_SUBMESH")); - mySelectSubMesh->setMinimumSize(50, 0); - mySubMeshBtn = new QPushButton(aSelectBox, "submesh button"); - mySubMeshBtn->setText(""); - mySubMeshBtn->setPixmap(image0); - mySubMeshLine = new QLineEdit(aSelectBox, "submesh line"); + QGroupBox* aSelectBox = new QGroupBox(tr("SMESH_SELECT_FROM"), wg1); + QGridLayout* aSelectBoxLayout = new QGridLayout(aSelectBox); + aSelectBoxLayout->setMargin(MARGIN); + aSelectBoxLayout->setSpacing(SPACING); + + mySelectSubMesh = new QCheckBox(tr("SMESH_SUBMESH"), aSelectBox); + mySubMeshBtn = new QPushButton(aSelectBox); + mySubMeshBtn->setIcon(image0); + mySubMeshLine = new QLineEdit(aSelectBox); mySubMeshLine->setReadOnly(true); onSelectSubMesh(false); - mySelectGroup = new QCheckBox(aSelectBox, "group checkbox"); - mySelectGroup->setText(tr("SMESH_GROUP")); - mySelectGroup->setMinimumSize(50, 0); - myGroupBtn = new QPushButton(aSelectBox, "group button"); - myGroupBtn->setText(""); - myGroupBtn->setPixmap(image0); - myGroupLine = new QLineEdit(aSelectBox, "group line"); + mySelectGroup = new QCheckBox(tr("SMESH_GROUP"), aSelectBox); + myGroupBtn = new QPushButton(aSelectBox); + myGroupBtn->setIcon(image0); + myGroupLine = new QLineEdit(aSelectBox); myGroupLine->setReadOnly(true); onSelectGroup(false); - + + aSelectBoxLayout->addWidget(mySelectSubMesh, 0, 0); + aSelectBoxLayout->addWidget(mySubMeshBtn, 0, 1); + aSelectBoxLayout->addWidget(mySubMeshLine, 0, 2); + aSelectBoxLayout->addWidget(mySelectGroup, 1, 0); + aSelectBoxLayout->addWidget(myGroupBtn, 1, 1); + aSelectBoxLayout->addWidget(myGroupLine, 1, 2); + /***************************************************************/ - QGridLayout* wg1Layout = new QGridLayout( wg1, 3, 1, 0, 6 ); - wg1Layout->addWidget(aContentBox, 0, 0); - wg1Layout->addWidget(aSelectBox, 1, 0); - wg1Layout->setRowStretch(2, 5); + QVBoxLayout* wg1Layout = new QVBoxLayout(wg1); + wg1Layout->setMargin(0); + wg1Layout->setSpacing(SPACING); + wg1Layout->addWidget(aContentBox); + wg1Layout->addWidget(aSelectBox); + wg1Layout->setStretchFactor(aContentBox, 10); /***************************************************************/ - QLabel* geomObject = new QLabel(wg2, "geometry object label"); - geomObject->setText(tr("SMESH_OBJECT_GEOM")); - myGeomGroupBtn = new QToolButton(wg2, "geometry group button"); - myGeomGroupBtn->setIconSet( QIconSet(image0) ); - myGeomGroupBtn->setToggleButton(true); - myGeomGroupLine = new QLineEdit(wg2, "geometry group line"); + QLabel* geomObject = new QLabel(tr("SMESH_OBJECT_GEOM"), wg2); + myGeomGroupBtn = new QToolButton(wg2); + myGeomGroupBtn->setIcon(image0); + myGeomGroupBtn->setCheckable(true); + myGeomGroupLine = new QLineEdit(wg2); myGeomGroupLine->setReadOnly(true); //VSR ??? onSelectGeomGroup(false); - - if (!create) - { - myGeomGroupBtn->setEnabled(false); - myGeomGroupLine->setEnabled(false); - } - + + myGeomGroupBtn->setEnabled(create); + myGeomGroupLine->setEnabled(create); + /***************************************************************/ - QGridLayout* wg2Layout = new QGridLayout( wg2, 2, 3, 0, 6 ); + QGridLayout* wg2Layout = new QGridLayout( wg2 ); + wg2Layout->setMargin(0); + wg1Layout->setSpacing(SPACING); wg2Layout->addWidget(geomObject, 0, 0); wg2Layout->addWidget(myGeomGroupBtn, 0, 1); wg2Layout->addWidget(myGeomGroupLine,0, 2); wg2Layout->setRowStretch(1, 5); /***************************************************************/ - QVBoxLayout* dumb = new QVBoxLayout(myWGStack); - dumb->addWidget(wg1); - dumb->addWidget(wg2); - myWGStack->addWidget( wg1, myGrpTypeGroup->id(rb1) ); - myWGStack->addWidget( wg2, myGrpTypeGroup->id(rb2) ); + myWGStack->insertWidget( 0, wg1 ); + myWGStack->insertWidget( 1, wg2 ); /***************************************************************/ - QGroupBox* aColorBox = new QGroupBox(2, Qt::Horizontal, this, "color box"); - aColorBox->setTitle(tr("SMESH_SET_COLOR")); + QGroupBox* aColorBox = new QGroupBox(tr("SMESH_SET_COLOR"), this); + QHBoxLayout* aColorBoxLayout = new QHBoxLayout(aColorBox); + aColorBoxLayout->setMargin(MARGIN); + aColorBoxLayout->setSpacing(SPACING); + + QLabel* aColorLab = new QLabel(tr("SMESH_CHECK_COLOR"), aColorBox ); + myColorBtn = new QtxColorButton(aColorBox); - new QLabel( tr("SMESH_CHECK_COLOR"), aColorBox, "color label" ); - myColorBtn = new QPushButton(aColorBox, "color button"); - myColorBtn->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); + aColorBoxLayout->addWidget(aColorLab); + aColorBoxLayout->addWidget(myColorBtn); /***************************************************************/ - - QFrame* aButtons = new QFrame(this, "button box"); - aButtons->setFrameStyle(QFrame::Box | QFrame::Sunken); - QHBoxLayout* aBtnLayout = new QHBoxLayout(aButtons, 11, 6); - aBtnLayout->setAutoAdd(false); - - QPushButton* aOKBtn = new QPushButton(aButtons, "ok"); - aOKBtn->setText(tr("SMESH_BUT_OK")); - aOKBtn->setAutoDefault(true); - aOKBtn->setDefault(true); - QPushButton* aApplyBtn = new QPushButton(aButtons, "apply"); - aApplyBtn->setText(tr("SMESH_BUT_APPLY")); - aApplyBtn->setAutoDefault(true); - QPushButton* aCloseBtn = new QPushButton(aButtons, "close"); - aCloseBtn->setText(tr("SMESH_BUT_CLOSE")); - aCloseBtn->setAutoDefault(true); - QPushButton* aHelpBtn = new QPushButton(aButtons, "help"); - aHelpBtn->setText(tr("SMESH_BUT_HELP")); - aHelpBtn->setAutoDefault(true); - - aBtnLayout->addWidget(aOKBtn); - aBtnLayout->addWidget(aApplyBtn); + + QFrame* aButtons = new QFrame(this); + aButtons->setFrameStyle( QFrame::Box | QFrame::Sunken ); + QHBoxLayout* aBtnLayout = new QHBoxLayout(aButtons); + aBtnLayout->setMargin(MARGIN); + aBtnLayout->setSpacing(SPACING); + + myOKBtn = new QPushButton(tr("SMESH_BUT_OK"), aButtons); + myOKBtn->setAutoDefault(true); + myOKBtn->setDefault(true); + myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aButtons); + myApplyBtn->setAutoDefault(true); + myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aButtons); + myCloseBtn->setAutoDefault(true); + myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aButtons); + myHelpBtn->setAutoDefault(true); + + aBtnLayout->addWidget(myOKBtn); + aBtnLayout->addSpacing(10); + aBtnLayout->addWidget(myApplyBtn); + aBtnLayout->addSpacing(10); aBtnLayout->addStretch(); - aBtnLayout->addWidget(aCloseBtn); - aBtnLayout->addWidget(aHelpBtn); + aBtnLayout->addWidget(myCloseBtn); + aBtnLayout->addWidget(myHelpBtn); /***************************************************************/ aMainLayout->addWidget(meshGroupLab, 0, 0); aMainLayout->addWidget(myMeshGroupBtn, 0, 1); aMainLayout->addWidget(myMeshGroupLine, 0, 2); - aMainLayout->addMultiCellWidget(myTypeGroup, 1, 1, 0, 2); - aMainLayout->addWidget(aName, 2, 0); - aMainLayout->addWidget(myName, 2, 2); - aMainLayout->addMultiCellWidget(myGrpTypeGroup, 3, 3, 0, 2); - aMainLayout->addMultiCellWidget(myWGStack, 4, 4, 0, 2); - aMainLayout->setRowStretch( 5, 5 ); - aMainLayout->addMultiCellWidget(aColorBox, 6, 6, 0, 2); - aMainLayout->addMultiCellWidget(aButtons, 7, 7, 0, 2); + aMainLayout->addWidget(aTypeBox, 1, 0, 1, 3); + aMainLayout->addWidget(aName, 2, 0); + aMainLayout->addWidget(myName, 2, 2); + aMainLayout->addWidget(aGrpTypeBox, 3, 0, 1, 3); + aMainLayout->addWidget(myWGStack, 4, 0, 1, 3); + aMainLayout->addWidget(aColorBox, 5, 0, 1, 3); + aMainLayout->addWidget(aButtons, 6, 0, 1, 3); /* signals and slots connections */ - connect(myMeshGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection())); - - connect(myGrpTypeGroup, SIGNAL(clicked(int)), this, SLOT(onGrpTypeChanged(int))); + connect(myMeshGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection())); + connect(myGrpTypeGroup, SIGNAL(buttonClicked(int)), this, SLOT(onGrpTypeChanged(int))); + connect(myTypeGroup, SIGNAL(buttonClicked(int)), this, SLOT(onTypeChanged(int))); - connect(myTypeGroup, SIGNAL(clicked(int)), this, SLOT(onTypeChanged(int))); + connect(myName, SIGNAL(textChanged(const QString&)), this, SLOT(onNameChanged(const QString&))); + connect(myElements, SIGNAL(itemSelectionChanged()), this, SLOT(onListSelectionChanged())); - connect(myName, SIGNAL(textChanged(const QString&)), this, SLOT(onNameChanged(const QString&))); - connect(myElements, SIGNAL(selectionChanged()), this, SLOT(onListSelectionChanged())); - - connect(myFilter, SIGNAL(clicked()), this, SLOT(setFilters())); - connect(aAddBtn, SIGNAL(clicked()), this, SLOT(onAdd())); + connect(myFilter, SIGNAL(clicked()), this, SLOT(setFilters())); + connect(aAddBtn, SIGNAL(clicked()), this, SLOT(onAdd())); connect(aRemoveBtn, SIGNAL(clicked()), this, SLOT(onRemove())); - connect(aSortBtn, SIGNAL(clicked()), this, SLOT(onSort())); + connect(aSortBtn, SIGNAL(clicked()), this, SLOT(onSort())); connect(mySelectSubMesh, SIGNAL(toggled(bool)), this, SLOT(onSelectSubMesh(bool))); - connect(mySelectGroup, SIGNAL(toggled(bool)), this, SLOT(onSelectGroup(bool))); - connect(mySubMeshBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection())); - connect(myGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection())); - connect(myGeomGroupBtn, SIGNAL(toggled(bool)), this, SLOT(onGeomSelectionButton(bool))); - connect(myColorBtn, SIGNAL(clicked()), this, SLOT(onSelectColor())); - - connect(aOKBtn, SIGNAL(clicked()), this, SLOT(onOK())); - connect(aApplyBtn, SIGNAL(clicked()), this, SLOT(onApply())); - connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(onClose())); - connect(aHelpBtn, SIGNAL(clicked()), this, SLOT(onHelp())); + connect(mySelectGroup, SIGNAL(toggled(bool)), this, SLOT(onSelectGroup(bool))); + connect(mySubMeshBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection())); + connect(myGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection())); + connect(myGeomGroupBtn, SIGNAL(toggled(bool)), this, SLOT(onGeomSelectionButton(bool))); + + connect(myOKBtn, SIGNAL(clicked()), this, SLOT(onOK())); + connect(myApplyBtn, SIGNAL(clicked()), this, SLOT(onApply())); + connect(myCloseBtn, SIGNAL(clicked()), this, SLOT(onClose())); + connect(myHelpBtn, SIGNAL(clicked()), this, SLOT(onHelp())); /* Init selection */ mySMESHGUI->SetActiveDialogBox(this); @@ -405,16 +392,16 @@ void SMESHGUI_GroupDlg::initDialog(bool create) myGroupFilter = new SMESH_TypeFilter(GROUP); SalomeApp_Study* aStudy = dynamic_cast( mySMESHGUI->application()->activeStudy() ); myGeomFilter = new GEOM_SelectionFilter( aStudy, true ); - + connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(onDeactivate())); - connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(onClose())); - connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onObjectSelectionChanged())); + connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(onClose())); + connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onObjectSelectionChanged())); - myGrpTypeGroup->setButton(myGrpTypeGroup->id(rb1)); // VSR !!! - onGrpTypeChanged(myGrpTypeGroup->id(rb1)); // VSR!!! + rb1->setChecked(true); // VSR !!! + onGrpTypeChanged(0); // VSR!!! if (myMesh->_is_nil() ) - myTypeGroup->setButton(0); + myTypeGroup->button(0)->setChecked(true); updateButtons(); //myName->setText(GetDefaultName(tr("SMESH_GROUP"))); @@ -427,9 +414,8 @@ void SMESHGUI_GroupDlg::initDialog(bool create) SMESHGUI_GroupDlg::~SMESHGUI_GroupDlg() { // no need to delete child widgets, Qt does it all for us - if ( myFilterDlg != 0 ) - { - myFilterDlg->reparent( 0, QPoint() ); + if ( myFilterDlg != 0 ) { + myFilterDlg->setParent( 0 ); delete myFilterDlg; } } @@ -440,34 +426,34 @@ SMESHGUI_GroupDlg::~SMESHGUI_GroupDlg() //================================================================================= QString SMESHGUI_GroupDlg::GetDefaultName(const QString& theOperation) { - QString aName = ""; - - // collect all object names of SMESH component - SalomeApp_Study* appStudy = - dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - if ( !appStudy ) return aName; - _PTR(Study) aStudy = appStudy->studyDS(); - - std::set aSet; - _PTR(SComponent) aMeshCompo (aStudy->FindComponent("SMESH")); - if (aMeshCompo) { - _PTR(ChildIterator) it (aStudy->NewChildIterator(aMeshCompo)); - _PTR(SObject) obj; - for (it->InitEx(true); it->More(); it->Next()) { - obj = it->Value(); - aSet.insert(obj->GetName()); - } + QString aName = ""; + + // collect all object names of SMESH component + SalomeApp_Study* appStudy = + dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( !appStudy ) return aName; + _PTR(Study) aStudy = appStudy->studyDS(); + + std::set aSet; + _PTR(SComponent) aMeshCompo (aStudy->FindComponent("SMESH")); + if (aMeshCompo) { + _PTR(ChildIterator) it (aStudy->NewChildIterator(aMeshCompo)); + _PTR(SObject) obj; + for (it->InitEx(true); it->More(); it->Next()) { + obj = it->Value(); + aSet.insert(obj->GetName()); } + } - // build a unique name - int aNumber = 0; - bool isUnique = false; - while (!isUnique) { - aName = theOperation + "_" + QString::number(++aNumber); - isUnique = (aSet.count(aName.latin1()) == 0); - } + // build a unique name + int aNumber = 0; + bool isUnique = false; + while (!isUnique) { + aName = theOperation + "_" + QString::number(++aNumber); + isUnique = (aSet.count(aName.toLatin1().data()) == 0); + } - return aName; + return aName; } //================================================================================= @@ -493,13 +479,13 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_Mesh_ptr theMesh) if( !aList.IsEmpty() ) { QString aName = aList.First()->getName(); - myMeshGroupLine->setText(aName) ; + myMeshGroupLine->setText(aName); myMeshGroupLine->home( false ); } myCurrentLineEdit = 0; - myTypeGroup->setButton(0); + myTypeGroup->button(0)->setChecked(true); onTypeChanged(0); } @@ -510,14 +496,14 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_Mesh_ptr theMesh) void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup) { myMesh = theGroup->GetMesh(); - + myName->setText(theGroup->GetName()); myName->home(false); myOldName = myName->text(); SALOMEDS::Color aColor = theGroup->GetColor(); setGroupColor( aColor ); - + myMeshGroupLine->setText(theGroup->GetName()); int aType = 0; @@ -527,8 +513,8 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup) case SMESH::FACE: aType = 2; break; case SMESH::VOLUME: aType = 3; break; } - myTypeGroup->setButton(aType); - + myTypeGroup->button(aType)->setChecked(true); + myGroup = SMESH::SMESH_Group::_narrow( theGroup ); if ( !myGroup->_is_nil() ) @@ -538,29 +524,29 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup) myActor = SMESH::FindActorByObject(myGroup); SMESH::SetPickable(myActor); - myGrpTypeGroup->setButton(0); + myGrpTypeGroup->button(0)->setChecked(true); onGrpTypeChanged(0); - + myCurrentLineEdit = 0; myElements->clear(); setSelectionMode(aType); myTypeId = aType; - + myIdList.clear(); if (!myGroup->IsEmpty()) { SMESH::long_array_var anElements = myGroup->GetListOfID(); int k = anElements->length(); for (int i = 0; i < k; i++) { myIdList.append(anElements[i]); - myElements->insertItem(QString::number(anElements[i])); + myElements->addItem(QString::number(anElements[i])); } - myElements->selectAll(true); + myElements->selectAll(); } } else { myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow( theGroup ); - + if ( !myGroupOnGeom->_is_nil() ) { myActor = SMESH::FindActorByObject(myMesh); @@ -568,9 +554,9 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup) myActor = SMESH::FindActorByObject(myGroup); SMESH::SetPickable(myActor); - myGrpTypeGroup->setButton(1); + myGrpTypeGroup->button(1)->setChecked(true); onGrpTypeChanged(1); - + QString aShapeName(""); _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); GEOM::GEOM_Object_var aGroupShape = myGroupOnGeom->GetShape(); @@ -591,7 +577,7 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup) //================================================================================= void SMESHGUI_GroupDlg::updateButtons() { - bool enable = !myName->text().stripWhiteSpace().isEmpty(); + bool enable = !myName->text().trimmed().isEmpty(); if (myGrpTypeId == 0) { enable = enable && myElements->count() > 0; @@ -603,11 +589,8 @@ void SMESHGUI_GroupDlg::updateButtons() } } - QPushButton* aBtn; - aBtn = (QPushButton*) child("ok", "QPushButton"); - if (aBtn) aBtn->setEnabled(enable); - aBtn = (QPushButton*) child("apply", "QPushButton"); - if (aBtn) aBtn->setEnabled(enable); + myOKBtn->setEnabled(enable); + myApplyBtn->setEnabled(enable); } //================================================================================= @@ -640,7 +623,7 @@ void SMESHGUI_GroupDlg::onTypeChanged (int id) void SMESHGUI_GroupDlg::onGrpTypeChanged (int id) { if (myGrpTypeId != id) { - myWGStack->raiseWidget( id ); + myWGStack->setCurrentIndex( id ); if (id == 0) myName->setText(myOldName); onSelectGeomGroup(id == 1); @@ -648,19 +631,6 @@ void SMESHGUI_GroupDlg::onGrpTypeChanged (int id) myGrpTypeId = id; } -//================================================================================= -// function : onSelectColor() -// purpose : -//================================================================================= -void SMESHGUI_GroupDlg::onSelectColor() -{ - QColor color = getGroupQColor(); - color = QColorDialog::getColor( color ); - setGroupQColor( color ); - - updateButtons(); -} - //================================================================================= // function : setSelectionMode() // purpose : Radio button management @@ -708,12 +678,12 @@ void SMESHGUI_GroupDlg::setSelectionMode (int theMode) mySelectionMgr->installFilter(myMeshFilter); else if (theMode == 7) mySelectionMgr->installFilter(myGeomFilter); - + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->SetSelectionMode(ActorSelection); } mySelectionMode = theMode; - } + } } //================================================================================= @@ -725,7 +695,7 @@ bool SMESHGUI_GroupDlg::onApply() if (mySMESHGUI->isActiveStudyLocked()) return false; - if (myName->text().stripWhiteSpace().isEmpty()) + if (myName->text().trimmed().isEmpty()) return false; if (myGrpTypeId == 0) { // on mesh elements @@ -749,9 +719,8 @@ bool SMESHGUI_GroupDlg::onApply() SMESH::long_array_var anIdList = new SMESH::long_array; int i, k = myElements->count(); anIdList->length(k); - QListBoxItem* anItem; - for (i = 0, anItem = myElements->firstItem(); anItem != 0; i++, anItem = anItem->next()) { - anIdList[i] = anItem->text().toInt(); + for (i = 0; i < k; i++) { + anIdList[i] = myElements->item(i)->text().toInt(); } myGroup = SMESH::AddGroup(myMesh, aType, myName->text()); @@ -771,8 +740,8 @@ bool SMESHGUI_GroupDlg::onApply() myGroup = SMESH::SMESH_Group::_nil(); } else { // edition - myGroup->SetName(myName->text()); - + myGroup->SetName(myName->text().toLatin1().data()); + SALOMEDS::Color aColor = getGroupColor(); myGroup->SetColor(aColor); @@ -780,37 +749,38 @@ bool SMESHGUI_GroupDlg::onApply() if(SMESH_Actor *anActor = SMESH::FindActorByEntry(aMeshGroupSO->GetID().c_str())) anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B ); - QValueList aAddList; - QValueList::iterator anIt; - QListBoxItem* anItem; + QList aAddList; - for (anItem = myElements->firstItem(); anItem != 0; anItem = anItem->next()) { - int anId = anItem->text().toInt(); - if ((anIt = myIdList.find(anId)) == myIdList.end()) + int i, total = myElements->count(); + for (i = 0; i < total; i++) { + int anId = myElements->item(i)->text().toInt(); + int idx = myIdList.indexOf(anId); + if ( idx == -1 ) aAddList.append(anId); else - myIdList.remove(anIt); + myIdList.removeAt(idx); } if (!aAddList.empty()) { SMESH::long_array_var anIdList = new SMESH::long_array; - anIdList->length(aAddList.count()); - int i; - for (i = 0, anIt = aAddList.begin(); anIt != aAddList.end(); anIt++, i++) - anIdList[i] = *anIt; + int added = aAddList.count(); + anIdList->length(added); + for (i = 0; i < added; i++) + anIdList[i] = aAddList[i]; myGroup->Add(anIdList.inout()); } if (!myIdList.empty()) { SMESH::long_array_var anIdList = new SMESH::long_array; - anIdList->length(myIdList.count()); - int i; - for (i = 0, anIt = myIdList.begin(); anIt != myIdList.end(); anIt++, i++) - anIdList[i] = *anIt; + int removed = myIdList.count(); + anIdList->length(removed); + for (i = 0; i < removed; i++) + anIdList[i] = myIdList[i]; myGroup->Remove(anIdList.inout()); } /* init for next operation */ myIdList.clear(); - for (anItem = myElements->firstItem(); anItem != 0; anItem = anItem->next()) - myIdList.append(anItem->text().toInt()); + for (i = 0; i < total; i++) { + myIdList.append(myElements->item(i)->text().toInt()); + } } mySMESHGUI->updateObjBrowser(true); @@ -836,7 +806,9 @@ bool SMESHGUI_GroupDlg::onApply() SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId()); if (myGeomObjects->length() == 1) { - myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType, myName->text(),myGeomObjects[0]); + myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType, + myName->text().toLatin1().data(), + myGeomObjects[0]); } else { SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen(); @@ -877,10 +849,13 @@ bool SMESHGUI_GroupDlg::onApply() QString aNewGeomGroupName ("Auto_group_for_"); aNewGeomGroupName += myName->text(); SALOMEDS::SObject_var aNewGroupSO = - geomGen->AddInStudy(aSMESHGen->GetCurrentStudy(), aGroupVar, aNewGeomGroupName, aMeshShape); + geomGen->AddInStudy(aSMESHGen->GetCurrentStudy(), aGroupVar, + aNewGeomGroupName.toLatin1().data(), aMeshShape); } - myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType, myName->text(), aGroupVar); + myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType, + myName->text().toLatin1().data(), + aGroupVar); } SALOMEDS::Color aColor = getGroupColor(); @@ -896,7 +871,7 @@ bool SMESHGUI_GroupDlg::onApply() myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil(); } else { // edition - myGroupOnGeom->SetName(myName->text()); + myGroupOnGeom->SetName(myName->text().toLatin1().data()); SALOMEDS::Color aColor = getGroupColor(); myGroupOnGeom->SetColor(aColor); @@ -937,13 +912,9 @@ void SMESHGUI_GroupDlg::onListSelectionChanged() if (myCurrentLineEdit == 0) { mySelectionMgr->clearSelected(); TColStd_MapOfInteger aIndexes; - QListBoxItem* anItem; - for (anItem = myElements->firstItem(); anItem != 0; anItem = anItem->next()) { - if (anItem->isSelected()) { - int anId = anItem->text().toInt(); - aIndexes.Add(anId); - } - } + QList selItems = myElements->selectedItems(); + QListWidgetItem* anItem; + foreach(anItem, selItems) aIndexes.Add(anItem->text().toInt()); mySelector->AddOrRemoveIndex(myActor->getIO(), aIndexes, false); SALOME_ListIO aList; aList.Append(myActor->getIO()); @@ -959,13 +930,13 @@ void SMESHGUI_GroupDlg::onListSelectionChanged() void SMESHGUI_GroupDlg::onObjectSelectionChanged() { if ( myIsBusy || !isEnabled()) return; - if (myCurrentLineEdit == myGeomGroupLine && !myGeomGroupBtn->isOn()) return; + if (myCurrentLineEdit == myGeomGroupLine && !myGeomGroupBtn->isDown()) return; myIsBusy = true; SALOME_ListIO aList; mySelectionMgr->selectedObjects( aList ); - + int aNbSel = aList.Extent(); myElements->clearSelection(); @@ -985,8 +956,8 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() myGeomObjects = new GEOM::ListOfGO(); myGeomObjects->length(0); - if (myGeomGroupBtn->isOn()) - myGeomGroupBtn->setOn(false); + if (myGeomGroupBtn->isDown()) + myGeomGroupBtn->setDown(false); if (!myCreate) myName->setText(""); @@ -994,7 +965,7 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() if (aNbSel != 1 ) { myGroup = SMESH::SMESH_Group::_nil(); - myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil(); + myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil(); myMesh = SMESH::SMESH_Mesh::_nil(); updateGeomPopup(); updateButtons(); @@ -1018,7 +989,7 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() SMESH::SetPickable(myActor); aString = aList.First()->getName(); - myMeshGroupLine->setText(aString) ; + myMeshGroupLine->setText(aString); myMeshGroupLine->home( false ); mySelectSubMesh->setEnabled(true); @@ -1038,7 +1009,7 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() myGroup = SMESH::SMESH_Group::_nil(); myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil(); - + init(aGroup); myIsBusy = true; mySelectSubMesh->setEnabled(true); @@ -1083,17 +1054,17 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() GEOM::GEOM_Object_var aGeomGroup; Standard_Boolean testResult; int i = 0; - + SALOME_ListIteratorOfListIO anIt (aList); - for (; anIt.More(); anIt.Next()) { - + for ( ; anIt.More(); anIt.Next()) { + testResult = Standard_False; aGeomGroup = GEOMBase::ConvertIOinGEOMObject(anIt.Value(), testResult); // Check if the object is a geometry group if (!testResult || CORBA::is_nil(aGeomGroup)) continue; - + // Check if group constructed on the same shape as a mesh or on its child _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); @@ -1109,7 +1080,7 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() _PTR(SObject) aGroupMainShapeSO = //aStudy->FindObjectIOR(aStudy->ConvertObjectToIOR(aGroupMainShape)); aStudy->FindObjectID(aGroupMainShape->GetStudyEntry()); - + _PTR(SObject) anObj, aRef; bool isRefOrSubShape = false; if (aMeshSO->FindSubObject(1, anObj) && anObj->ReferencedObject(aRef)) { @@ -1132,14 +1103,14 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() if (isRefOrSubShape) myGeomObjects[i++] = aGeomGroup; } - + myGeomObjects->length(i); if ( i == 0 ) { myIsBusy = false; return; } - + aNbSel = i; } @@ -1173,11 +1144,11 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged() aNbItems = SMESH::GetNameOfSelectedElements(mySelector, myActor->getIO(), aListStr); } if (aNbItems > 0) { - QStringList anElements = QStringList::split(" ", aListStr); - QListBoxItem* anItem = 0; + QStringList anElements = aListStr.split(" ", QString::SkipEmptyParts); for (QStringList::iterator it = anElements.begin(); it != anElements.end(); ++it) { - anItem = myElements->findItem(*it, Qt::ExactMatch); - if (anItem) myElements->setSelected(anItem, true); + QList found = myElements->findItems(*it, Qt::MatchExactly); + QListWidgetItem* anItem; + foreach(anItem, found) anItem->setSelected(true); } } } @@ -1264,7 +1235,7 @@ void SMESHGUI_GroupDlg::onSelectGeomGroup(bool on) setSelectionMode(8); } else { - myGeomGroupBtn->setOn(false); + myGeomGroupBtn->setDown(false); myGeomObjects->length(0); myGeomGroupLine->setText(""); myCurrentLineEdit = 0; @@ -1364,20 +1335,20 @@ void SMESHGUI_GroupDlg::onAdd() SMESH::ElementType aType = SMESH::ALL; switch(myTypeId) { - case 0: - aType = SMESH::NODE; + case 0: + aType = SMESH::NODE; mySelector->SetSelectionMode(NodeSelection); break; - case 1: - aType = SMESH::EDGE; + case 1: + aType = SMESH::EDGE; mySelector->SetSelectionMode(EdgeSelection); break; - case 2: - aType = SMESH::FACE; + case 2: + aType = SMESH::FACE; mySelector->SetSelectionMode(FaceSelection); break; - case 3: - aType = SMESH::VOLUME; + case 3: + aType = SMESH::VOLUME; mySelector->SetSelectionMode(VolumeSelection); break; default: @@ -1396,25 +1367,28 @@ void SMESHGUI_GroupDlg::onAdd() aNbItems = SMESH::GetNameOfSelectedElements(mySelector, myActor->getIO(), aListStr); } if (aNbItems > 0) { - QStringList anElements = QStringList::split(" ", aListStr); - QListBoxItem* anItem = 0; + QStringList anElements = aListStr.split(" ", QString::SkipEmptyParts); for (QStringList::iterator it = anElements.begin(); it != anElements.end(); ++it) { - anItem = myElements->findItem(*it, Qt::ExactMatch); - if (!anItem) { - anItem = new QListBoxText(*it); - myElements->insertItem(anItem); + QList found = myElements->findItems(*it, Qt::MatchExactly); + QListWidgetItem* anItem; + if (found.count() == 0) { + anItem = new QListWidgetItem(*it); + myElements->addItem(anItem); + anItem->setSelected(true); + } + else { + foreach(anItem, found) anItem->setSelected(true); } - myElements->setSelected(anItem, true); } } } else if (myCurrentLineEdit == mySubMeshLine) { //SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects()); - + SALOME_ListIO aList; mySelectionMgr->selectedObjects( aList ); SALOME_ListIteratorOfListIO anIt (aList); - for (; anIt.More(); anIt.Next()) { + for ( ; anIt.More(); anIt.Next()) { SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface(anIt.Value()); if (!aSubMesh->_is_nil()) { @@ -1423,15 +1397,18 @@ void SMESHGUI_GroupDlg::onAdd() try { SMESH::long_array_var anElements = aSubMesh->GetElementsByType(aType); int k = anElements->length(); - QListBoxItem* anItem = 0; for (int i = 0; i < k; i++) { QString aText = QString::number(anElements[i]); - anItem = myElements->findItem(aText, Qt::ExactMatch); - if (!anItem) { - anItem = new QListBoxText(aText); - myElements->insertItem(anItem); + QList found = myElements->findItems(aText, Qt::MatchExactly); + QListWidgetItem* anItem = 0; + if (found.count() == 0) { + anItem = new QListWidgetItem(aText); + myElements->addItem(anItem); + anItem->setSelected(true); } - myElements->setSelected(anItem, true); + else { + foreach(anItem, found) anItem->setSelected(true); + } } } catch (const SALOME::SALOME_Exception& ex) { @@ -1448,9 +1425,9 @@ void SMESHGUI_GroupDlg::onAdd() //SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects()); SALOME_ListIO aList; mySelectionMgr->selectedObjects( aList ); - + SALOME_ListIteratorOfListIO anIt (aList); - for (; anIt.More(); anIt.Next()) { + for ( ; anIt.More(); anIt.Next()) { SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface(anIt.Value()); if (!aGroup->_is_nil()) { @@ -1458,15 +1435,18 @@ void SMESHGUI_GroupDlg::onAdd() if (aGroup->GetType() == aType && aGroup->GetMesh()->GetId() == myMesh->GetId()) { SMESH::long_array_var anElements = aGroup->GetListOfID(); int k = anElements->length(); - QListBoxItem* anItem = 0; for (int i = 0; i < k; i++) { QString aText = QString::number(anElements[i]); - anItem = myElements->findItem(aText, Qt::ExactMatch); - if (!anItem) { - anItem = new QListBoxText(aText); - myElements->insertItem(anItem); + QList found = myElements->findItems(aText, Qt::MatchExactly); + QListWidgetItem* anItem = 0; + if (found.count() == 0) { + anItem = new QListWidgetItem(aText); + myElements->addItem(anItem); + anItem->setSelected(true); + } + else { + foreach(anItem, found) anItem->setSelected(true); } - myElements->setSelected(anItem, true); } } } @@ -1505,15 +1485,18 @@ void SMESHGUI_GroupDlg::onAdd() SMESH::long_array_var anElements = aFilter->GetElementsId(myMesh); int k = anElements->length(); - QListBoxItem* anItem = 0; for (int i = 0; i < k; i++) { QString aText = QString::number(anElements[i]); - anItem = myElements->findItem(aText, Qt::ExactMatch); - if (!anItem) { - anItem = new QListBoxText(aText); - myElements->insertItem(anItem); + QList found = myElements->findItems(aText, Qt::MatchExactly); + QListWidgetItem* anItem = 0; + if (found.count() == 0) { + anItem = new QListWidgetItem(aText); + myElements->addItem(anItem); + anItem->setSelected(true); + } + else { + foreach(anItem, found) anItem->setSelected(true); } - myElements->setSelected(anItem, true); } } @@ -1534,11 +1517,9 @@ void SMESHGUI_GroupDlg::onRemove() { myIsBusy = true; if (myCurrentLineEdit == 0) { - for (int i = myElements->count(); i > 0; i--) { - if (myElements->isSelected(i-1)) { - myElements->removeItem(i-1); - } - } + QList selItems = myElements->selectedItems(); + QListWidgetItem* item; + foreach(item, selItems) delete item; } else { SALOME_ListIO aList; mySelectionMgr->selectedObjects( aList ); @@ -1561,7 +1542,7 @@ void SMESHGUI_GroupDlg::onRemove() mySelectionMgr->selectedObjects( aList ); SALOME_ListIteratorOfListIO anIt (aList); - for (; anIt.More(); anIt.Next()) { + for ( ; anIt.More(); anIt.Next()) { SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface(anIt.Value()); if (!aSubMesh->_is_nil()) { // check if mesh is the same @@ -1570,10 +1551,11 @@ void SMESHGUI_GroupDlg::onRemove() try { SMESH::long_array_var anElements = aSubMesh->GetNodesId(); int k = anElements->length(); - QListBoxItem* anItem = 0; for (int i = 0; i < k; i++) { - anItem = myElements->findItem(QString::number(anElements[i]), Qt::ExactMatch); - if (anItem) delete anItem; + QList found = + myElements->findItems(QString::number(anElements[i]), Qt::MatchExactly); + QListWidgetItem* anItem; + foreach(anItem, found) delete anItem; } } catch (const SALOME::SALOME_Exception& ex) { @@ -1584,10 +1566,11 @@ void SMESHGUI_GroupDlg::onRemove() try { SMESH::long_array_var anElements = aSubMesh->GetElementsId(); int k = anElements->length(); - QListBoxItem* anItem = 0; for (int i = 0; i < k; i++) { - anItem = myElements->findItem(QString::number(anElements[i]), Qt::ExactMatch); - if (anItem) delete anItem; + QList found = + myElements->findItems(QString::number(anElements[i]), Qt::MatchExactly); + QListWidgetItem* anItem; + foreach(anItem, found) delete anItem; } } catch (const SALOME::SALOME_Exception& ex) { @@ -1605,17 +1588,18 @@ void SMESHGUI_GroupDlg::onRemove() mySelectionMgr->selectedObjects( aList ); SALOME_ListIteratorOfListIO anIt (aList); - for (; anIt.More(); anIt.Next()) { + for ( ; anIt.More(); anIt.Next()) { SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface(anIt.Value()); if (aRes && !aGroup->_is_nil()) { // check if mesh is the same if (aGroup->GetType() == aType && aGroup->GetMesh()->GetId() == myMesh->GetId()) { SMESH::long_array_var anElements = aGroup->GetListOfID(); int k = anElements->length(); - QListBoxItem* anItem = 0; for (int i = 0; i < k; i++) { - anItem = myElements->findItem(QString::number(anElements[i]), Qt::ExactMatch); - if (anItem) delete anItem; + QList found = + myElements->findItems(QString::number(anElements[i]), Qt::MatchExactly); + QListWidgetItem* anItem; + foreach(anItem, found) delete anItem; } } } @@ -1638,26 +1622,24 @@ void SMESHGUI_GroupDlg::onSort() int i, k = myElements->count(); if (k > 0) { myIsBusy = true; - QStringList aSelected; + QList aSelected; std::vector anArray(k); // QMemArray anArray(k); - QListBoxItem* anItem; // fill the array - for (anItem = myElements->firstItem(), i = 0; anItem != 0; anItem = anItem->next(), i++) { - anArray[i] = anItem->text().toInt(); - if (anItem->isSelected()) - aSelected.append(anItem->text()); + for (i = 0; i < k; i++) { + int id = myElements->item(i)->text().toInt(); + anArray[i] = id; + if (myElements->item(i)->isSelected()) + aSelected.append(id); } // sort & update list std::sort(anArray.begin(), anArray.end()); // anArray.sort(); myElements->clear(); for (i = 0; i < k; i++) { - myElements->insertItem(QString::number(anArray[i])); - } - for (QStringList::iterator it = aSelected.begin(); it != aSelected.end(); ++it) { - anItem = myElements->findItem(*it, Qt::ExactMatch); - if (anItem) myElements->setSelected(anItem, true); + QListWidgetItem* anItem = new QListWidgetItem(QString::number(anArray[i])); + myElements->addItem(anItem); + anItem->setSelected(aSelected.contains(anArray[i])); } myIsBusy = false; } @@ -1700,19 +1682,20 @@ void SMESHGUI_GroupDlg::onClose() void SMESHGUI_GroupDlg::onHelp() { LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); - if (app) + if (app) app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); else { - QString platform; + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName)); } } @@ -1763,7 +1746,7 @@ void SMESHGUI_GroupDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) + if ( e->key() == Qt::Key_F1 ) { e->accept(); onHelp(); @@ -1791,10 +1774,10 @@ void SMESHGUI_GroupDlg::updateGeomPopup() disconnect( myGeomGroupBtn, SIGNAL( toggled(bool) ), this, SLOT( onGeomSelectionButton(bool) )); if ( enable ) { if ( !myGeomPopup ) { - myGeomPopup = new QPopupMenu(); - myGeomPopup->insertItem( tr("DIRECT_GEOM_SELECTION"), DIRECT_GEOM_INDEX ); - myGeomPopup->insertItem( tr("GEOM_BY_MESH_ELEM_SELECTION"), GEOM_BY_MESH_INDEX ); - connect( myGeomPopup, SIGNAL( activated( int ) ), SLOT( onGeomPopup( int ) ) ); + myGeomPopup = new QMenu(this); + myActions[myGeomPopup->addAction( tr("DIRECT_GEOM_SELECTION") )] = DIRECT_GEOM_INDEX; + myActions[myGeomPopup->addAction( tr("GEOM_BY_MESH_ELEM_SELECTION") )] = GEOM_BY_MESH_INDEX; + connect( myGeomPopup, SIGNAL( triggered( QAction* ) ), SLOT( onGeomPopup( QAction* ) ) ); } connect( myGeomGroupBtn, SIGNAL( toggled(bool) ), this, SLOT( onGeomSelectionButton(bool) )); } @@ -1811,8 +1794,8 @@ void SMESHGUI_GroupDlg::onGeomSelectionButton(bool isBtnOn) if ( myGeomPopup && isBtnOn ) { myCurrentLineEdit = myGeomGroupLine; - int id = myGeomPopup->exec( QCursor::pos() ); - if (id == DIRECT_GEOM_INDEX || id == -1) + QAction* a = myGeomPopup->exec( QCursor::pos() ); + if (!a || myActions[a] == DIRECT_GEOM_INDEX) setSelectionMode(7); } else if (!isBtnOn) @@ -1826,8 +1809,9 @@ void SMESHGUI_GroupDlg::onGeomSelectionButton(bool isBtnOn) // function : onGeomPopup() // purpose : //================================================================================= -void SMESHGUI_GroupDlg::onGeomPopup( int index ) +void SMESHGUI_GroupDlg::onGeomPopup( QAction* a ) { + int index = myActions[a]; if ( index == GEOM_BY_MESH_INDEX ) { mySelectionMode = -1; @@ -1868,7 +1852,7 @@ void SMESHGUI_GroupDlg::onPublishShapeByMeshDlg(SUIT_Operation* op) { QString ID = aGeomVar->GetStudyEntry(); _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); - if ( _PTR(SObject) aGeomSO = aStudy->FindObjectID( ID.latin1() )) { + if ( _PTR(SObject) aGeomSO = aStudy->FindObjectID( ID.toLatin1().data() )) { SALOME_ListIO anIOList; Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject ( aGeomSO->GetID().c_str(), "SMESH", aGeomSO->GetName().c_str() ); @@ -1930,11 +1914,7 @@ SALOMEDS::Color SMESHGUI_GroupDlg::getGroupColor() const void SMESHGUI_GroupDlg::setGroupQColor( const QColor& theColor ) { if( theColor.isValid() ) - { - QPalette pal = myColorBtn->palette(); - pal.setColor(QColorGroup::Button, theColor); - myColorBtn->setPalette(pal); - } + myColorBtn->setColor( theColor ); } //================================================================================= @@ -1943,8 +1923,7 @@ void SMESHGUI_GroupDlg::setGroupQColor( const QColor& theColor ) //================================================================================= QColor SMESHGUI_GroupDlg::getGroupQColor() const { - QColor aColor = myColorBtn->palette().active().button(); - return aColor; + return myColorBtn->color(); } //================================================================================= @@ -1969,7 +1948,7 @@ void SMESHGUI_GroupDlg::setDefaultGroupColor() { SMESH::ListOfGroups aListOfGroups = *myMesh->GetGroups(); - QValueList aReservedColors; + QList aReservedColors; for( int i = 0, n = aListOfGroups.length(); i < n; i++ ) { SMESH::SMESH_GroupBase_var aGroupObject = aListOfGroups[i]; diff --git a/src/SMESHGUI/SMESHGUI_GroupDlg.h b/src/SMESHGUI/SMESHGUI_GroupDlg.h index f5d9430b5..18607e2aa 100644 --- a/src/SMESHGUI/SMESHGUI_GroupDlg.h +++ b/src/SMESHGUI/SMESHGUI_GroupDlg.h @@ -1,65 +1,61 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 CEA +// Copyright (C) 2003 CEA // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_GroupDlg.h +// Author : Natalia KOPNOVA, Open CASCADE S.A.S. // -// -// File : SMESHGUI_GroupDlg.h -// Author : Natalia KOPNOVA -// Module : SMESH -// $Header$ -#ifndef DIALOGBOX_GROUP_H -#define DIALOGBOX_GROUP_H +#ifndef SMESHGUI_GROUPDLG_H +#define SMESHGUI_GROUPDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include "LightApp_SelectionMgr.h" -//#include "SMESH_TypeFilter.hxx" -#include "SUIT_SelectionFilter.h" - -// QT Includes -#include -#include +// Qt includes +#include +#include +#include -// IDL Headers +// IDL includes #include #include CORBA_SERVER_HEADER(SMESH_Mesh) #include CORBA_SERVER_HEADER(SMESH_Group) class QLineEdit; class QButtonGroup; -class QGroupBox; -class QListBox; -class QPopupMenu; +class QListWidget; +class QMenu; class QPushButton; class QToolButton; class QCheckBox; -class QWidgetStack; -class QtxIntSpinBox; +class QStackedWidget; +class QAction; class SMESHGUI; class SMESH_Actor; class SMESHGUI_FilterDlg; class SMESHGUI_ShapeByMeshOp; +class QtxColorButton; class SUIT_Operation; class SVTK_Selector; -class SVTK_ViewWindow; +class SUIT_SelectionFilter; +class LightApp_SelectionMgr; //================================================================================= // class : SMESHGUI_GroupDlg @@ -67,138 +63,136 @@ class SVTK_ViewWindow; //================================================================================= class SMESHGUI_EXPORT SMESHGUI_GroupDlg : public QDialog { - Q_OBJECT + Q_OBJECT public: - SMESHGUI_GroupDlg( SMESHGUI*, - const char* name = 0, - SMESH::SMESH_Mesh_ptr theMesh = SMESH::SMESH_Mesh::_nil(), - bool modal = FALSE, WFlags fl = 0 ); - SMESHGUI_GroupDlg( SMESHGUI*, - const char* name, - SMESH::SMESH_GroupBase_ptr theGroup, - bool modal = FALSE, WFlags fl = 0 ); - ~SMESHGUI_GroupDlg(); - - static QString GetDefaultName(const QString& theOperation); - + SMESHGUI_GroupDlg( SMESHGUI*, + SMESH::SMESH_Mesh_ptr = SMESH::SMESH_Mesh::_nil() ); + SMESHGUI_GroupDlg( SMESHGUI*, + SMESH::SMESH_GroupBase_ptr ); + ~SMESHGUI_GroupDlg(); + + static QString GetDefaultName( const QString& ); + public slots: - - void onAdd(); - void onRemove(); - + void onAdd(); + void onRemove(); private slots: - - void onTypeChanged(int id); - void onGrpTypeChanged(int id); - - void onOK(); - void onClose(); - bool onApply(); - void onHelp(); - void onDeactivate(); - - void onListSelectionChanged(); - void onObjectSelectionChanged(); - - void onSelectSubMesh(bool on); - void onSelectGroup(bool on); - void onSelectGeomGroup(bool on); - void setCurrentSelection(); - - void setFilters(); - void onSort(); - - void onNameChanged(const QString& text); - void onFilterAccepted(); - - void onSelectColor(); - - void onGeomPopup( int ); - void onGeomSelectionButton( bool ); - - void onPublishShapeByMeshDlg(SUIT_Operation*); - void onCloseShapeByMeshDlg(SUIT_Operation*); + void onTypeChanged( int ); + void onGrpTypeChanged( int ); + + void onOK(); + void onClose(); + bool onApply(); + void onHelp(); + void onDeactivate(); + + void onListSelectionChanged(); + void onObjectSelectionChanged(); + + void onSelectSubMesh( bool ); + void onSelectGroup( bool ); + void onSelectGeomGroup( bool ); + void setCurrentSelection(); + + void setFilters(); + void onSort(); + + void onNameChanged( const QString& ); + void onFilterAccepted(); + + void onGeomPopup( QAction* ); + void onGeomSelectionButton( bool ); + + void onPublishShapeByMeshDlg( SUIT_Operation* ); + void onCloseShapeByMeshDlg( SUIT_Operation* ); private: - void initDialog(bool create); - void init(SMESH::SMESH_Mesh_ptr theMesh); - void init(SMESH::SMESH_GroupBase_ptr theGroup); - void closeEvent(QCloseEvent* e); - void enterEvent (QEvent*); - void hideEvent (QHideEvent*); /* ESC key */ - void keyPressEvent(QKeyEvent*); - void setSelectionMode(int theMode); - void updateButtons(); - void updateGeomPopup(); - - void setGroupColor( const SALOMEDS::Color& ); - SALOMEDS::Color getGroupColor() const; - - void setGroupQColor( const QColor& ); - QColor getGroupQColor() const; - - void setDefaultGroupColor(); - - SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ - LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ - SMESH_Actor* myActor; /* Current mesh actor */ - int myGrpTypeId; /* Current group type id : standalone or group on geometry */ - int myTypeId; /* Current type id = radio button id */ - QLineEdit* myCurrentLineEdit; /* Current LineEdit */ - SVTK_Selector* mySelector; - - QPushButton* myMeshGroupBtn; - QLineEdit* myMeshGroupLine; - - QButtonGroup* myTypeGroup; - QLineEdit* myName; - QString myOldName; - - QButtonGroup* myGrpTypeGroup; - - QWidgetStack* myWGStack; - QListBox* myElements; - QPushButton* myFilter; - - QCheckBox* mySelectSubMesh; - QPushButton* mySubMeshBtn; - QLineEdit* mySubMeshLine; - - QCheckBox* mySelectGroup; - QPushButton* myGroupBtn; - QLineEdit* myGroupLine; - - QPushButton* myColorBtn; - - QCheckBox* mySelectGeomGroup; - QToolButton* myGeomGroupBtn; - QLineEdit* myGeomGroupLine; - QPopupMenu* myGeomPopup; - - SMESHGUI_ShapeByMeshOp* myShapeByMeshOp; - - SMESH::SMESH_Mesh_var myMesh; - SMESH::SMESH_Group_var myGroup; - SMESH::SMESH_GroupOnGeom_var myGroupOnGeom; - QValueList myIdList; - GEOM::ListOfGO_var myGeomObjects; - - int mySelectionMode; - //Handle(SMESH_TypeFilter) myMeshFilter; - //Handle(SMESH_TypeFilter) mySubMeshFilter; - //Handle(SMESH_TypeFilter) myGroupFilter; - SUIT_SelectionFilter* myMeshFilter; - SUIT_SelectionFilter* mySubMeshFilter; - SUIT_SelectionFilter* myGroupFilter; - SUIT_SelectionFilter* myGeomFilter; - - SMESHGUI_FilterDlg* myFilterDlg; - - bool myCreate, myIsBusy; - - QString myHelpFileName; + void initDialog( bool ); + void init( SMESH::SMESH_Mesh_ptr ); + void init( SMESH::SMESH_GroupBase_ptr ); + void closeEvent( QCloseEvent* ); + void enterEvent( QEvent* ); + void hideEvent( QHideEvent* ); /* ESC key */ + void keyPressEvent( QKeyEvent* ); + void setSelectionMode( int ); + void updateButtons(); + void updateGeomPopup(); + + void setGroupColor( const SALOMEDS::Color& ); + SALOMEDS::Color getGroupColor() const; + + void setGroupQColor( const QColor& ); + QColor getGroupQColor() const; + + void setDefaultGroupColor(); + + SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ + LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ + SMESH_Actor* myActor; /* Current mesh actor */ + int myGrpTypeId; /* Current group type id : standalone or group on geometry */ + int myTypeId; /* Current type id = radio button id */ + QLineEdit* myCurrentLineEdit; /* Current LineEdit */ + SVTK_Selector* mySelector; + + QPushButton* myMeshGroupBtn; + QLineEdit* myMeshGroupLine; + + QButtonGroup* myTypeGroup; + QLineEdit* myName; + QString myOldName; + + QButtonGroup* myGrpTypeGroup; + + QStackedWidget* myWGStack; + QListWidget* myElements; + QPushButton* myFilter; + + QCheckBox* mySelectSubMesh; + QPushButton* mySubMeshBtn; + QLineEdit* mySubMeshLine; + + QCheckBox* mySelectGroup; + QPushButton* myGroupBtn; + QLineEdit* myGroupLine; + + QtxColorButton* myColorBtn; + + QCheckBox* mySelectGeomGroup; + QToolButton* myGeomGroupBtn; + QLineEdit* myGeomGroupLine; + QMenu* myGeomPopup; + + QPushButton* myOKBtn; + QPushButton* myApplyBtn; + QPushButton* myCloseBtn; + QPushButton* myHelpBtn; + + SMESHGUI_ShapeByMeshOp* myShapeByMeshOp; + + SMESH::SMESH_Mesh_var myMesh; + SMESH::SMESH_Group_var myGroup; + SMESH::SMESH_GroupOnGeom_var myGroupOnGeom; + QList myIdList; + GEOM::ListOfGO_var myGeomObjects; + + int mySelectionMode; + //Handle(SMESH_TypeFilter) myMeshFilter; + //Handle(SMESH_TypeFilter) mySubMeshFilter; + //Handle(SMESH_TypeFilter) myGroupFilter; + SUIT_SelectionFilter* myMeshFilter; + SUIT_SelectionFilter* mySubMeshFilter; + SUIT_SelectionFilter* myGroupFilter; + SUIT_SelectionFilter* myGeomFilter; + + SMESHGUI_FilterDlg* myFilterDlg; + + bool myCreate, myIsBusy; + + QString myHelpFileName; + + QMap myActions; }; -#endif // DIALOGBOX_GROUP_H +#endif // SMESHGUI_GROUPDLG_H diff --git a/src/SMESHGUI/SMESHGUI_GroupOpDlg.cxx b/src/SMESHGUI/SMESHGUI_GroupOpDlg.cxx index 4d9f9f6e4..70ef48671 100644 --- a/src/SMESHGUI/SMESHGUI_GroupOpDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_GroupOpDlg.cxx @@ -1,63 +1,61 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_GroupOpDlg.cxx +// Author : Sergey LITONIN, Open CASCADE S.A.S. // -// -// File : SMESHGUI_GroupOpDlg.cxx -// Author : Sergey LITONIN -// Module : SMESH +// SMESH includes #include "SMESHGUI_GroupOpDlg.h" #include "SMESHGUI.h" #include "SMESHGUI_Utils.h" #include "SMESHGUI_VTKUtils.h" -#include "SMESH_TypeFilter.hxx" - -#include "SUIT_ResourceMgr.h" -#include "SUIT_Desktop.h" -#include "SUIT_Session.h" -#include "SUIT_MessageBox.h" - -#include "LightApp_Application.h" - -#include "LightApp_SelectionMgr.h" -#include "SVTK_Selection.h" -#include "SVTK_ViewWindow.h" -#include "SVTK_Selector.h" -#include "SALOME_ListIO.hxx" - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include - -#define SPACING 5 -#define MARGIN 10 +#include + +// SALOME GUI includes +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include + +#define SPACING 6 +#define MARGIN 11 /*! * Class : SMESHGUI_GroupOpDlg @@ -69,38 +67,39 @@ // Purpose : Constructor //======================================================================= SMESHGUI_GroupOpDlg::SMESHGUI_GroupOpDlg( SMESHGUI* theModule, const int theMode ) - : QDialog( SMESH::GetDesktop( theModule ), "SMESHGUI_GroupOpDlg", false, - WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ), - mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) + : QDialog( SMESH::GetDesktop( theModule ) ), + mySMESHGUI( theModule ), + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) { + setModal(false); + myMode = theMode; if (myMode == UNION) { - setCaption(tr("UNION_OF_TWO_GROUPS")); + setWindowTitle(tr("UNION_OF_TWO_GROUPS")); myHelpFileName = "using_operations_on_groups_page.html#union_anchor"; } else if (myMode == INTERSECT) { - setCaption(tr("INTERSECTION_OF_TWO_GROUPS")); + setWindowTitle(tr("INTERSECTION_OF_TWO_GROUPS")); myHelpFileName = "using_operations_on_groups_page.html#intersection_anchor"; } else { - setCaption(tr("CUT_OF_TWO_GROUPS")); + setWindowTitle(tr("CUT_OF_TWO_GROUPS")); myHelpFileName = "using_operations_on_groups_page.html#cut_anchor"; } mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); - QVBoxLayout* aDlgLay = new QVBoxLayout (this, MARGIN, SPACING); + QVBoxLayout* aDlgLay = new QVBoxLayout (this); + aDlgLay->setMargin(MARGIN); + aDlgLay->setSpacing(SPACING); - QFrame* aMainFrame = createMainFrame (this); - QFrame* aBtnFrame = createButtonFrame(this); + QWidget* aMainFrame = createMainFrame (this); + QWidget* aBtnFrame = createButtonFrame(this); aDlgLay->addWidget(aMainFrame); aDlgLay->addWidget(aBtnFrame); - aDlgLay->setStretchFactor(aMainFrame, 1); - Init(); } @@ -108,24 +107,37 @@ SMESHGUI_GroupOpDlg::SMESHGUI_GroupOpDlg( SMESHGUI* theModule, const int theMode // name : SMESHGUI_GroupOpDlg::createMainFrame // Purpose : Create frame containing dialog's input fields //======================================================================= -QFrame* SMESHGUI_GroupOpDlg::createMainFrame (QWidget* theParent) +QWidget* SMESHGUI_GroupOpDlg::createMainFrame (QWidget* theParent) { - QGroupBox* aMainGrp = new QGroupBox(1, Qt::Horizontal, theParent); - aMainGrp->setFrameStyle(QFrame::NoFrame); - aMainGrp->setInsideMargin(0); - - QGroupBox* aNameGrp = new QGroupBox(1, Qt::Vertical, tr("NAME"), aMainGrp); - new QLabel(tr("RESULT_NAME"), aNameGrp); + QWidget* aMainGrp = new QWidget(theParent); + QVBoxLayout* aLay = new QVBoxLayout(aMainGrp); + aLay->setMargin(0); + aLay->setSpacing(SPACING); + + // ------------------------------------------------------ + QGroupBox* aNameGrp = new QGroupBox(tr("NAME"), aMainGrp); + QHBoxLayout* aNameGrpLayout = new QHBoxLayout(aNameGrp); + aNameGrpLayout->setMargin(MARGIN); + aNameGrpLayout->setSpacing(SPACING); + + QLabel* aNameLab = new QLabel(tr("RESULT_NAME"), aNameGrp); myNameEdit = new QLineEdit(aNameGrp); - QGroupBox* anArgGrp = new QGroupBox(3, Qt::Horizontal, tr("ARGUMENTS"), aMainGrp); + aNameGrpLayout->addWidget(aNameLab); + aNameGrpLayout->addWidget(aNameGrp); - new QLabel(myMode == CUT ? tr("MAIN_OBJECT") :tr("OBJECT_1"), anArgGrp); + // ------------------------------------------------------ + QGroupBox* anArgGrp = new QGroupBox(tr("ARGUMENTS"), aMainGrp); + QGridLayout* anArgGrpLayout = new QGridLayout(anArgGrp); + anArgGrpLayout->setMargin(MARGIN); + anArgGrpLayout->setSpacing(SPACING); + + QLabel* aObj1Lab = new QLabel(myMode == CUT ? tr("MAIN_OBJECT") :tr("OBJECT_1"), anArgGrp); myBtn1 = new QPushButton(anArgGrp); myEdit1 = new QLineEdit(anArgGrp); myEdit1->setAlignment( Qt::AlignLeft ); - new QLabel(myMode == CUT ? tr("TOOL_OBJECT") :tr("OBJECT_2"), anArgGrp); + QLabel* aObj2Lab = new QLabel(myMode == CUT ? tr("TOOL_OBJECT") :tr("OBJECT_2"), anArgGrp); myBtn2 = new QPushButton(anArgGrp); myEdit2 = new QLineEdit(anArgGrp); myEdit2->setAlignment( Qt::AlignLeft ); @@ -134,8 +146,19 @@ QFrame* SMESHGUI_GroupOpDlg::createMainFrame (QWidget* theParent) myEdit2->setReadOnly(true); QPixmap aPix (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT"))); - myBtn1->setPixmap(aPix); - myBtn2->setPixmap(aPix); + myBtn1->setIcon(aPix); + myBtn2->setIcon(aPix); + + anArgGrpLayout->addWidget(aObj1Lab); + anArgGrpLayout->addWidget(myBtn1); + anArgGrpLayout->addWidget(myEdit1); + anArgGrpLayout->addWidget(aObj2Lab); + anArgGrpLayout->addWidget(myBtn2); + anArgGrpLayout->addWidget(myEdit2); + + // ------------------------------------------------------ + aLay->addWidget(aNameGrp); + aLay->addWidget(anArgGrp); return aMainGrp; } @@ -144,23 +167,24 @@ QFrame* SMESHGUI_GroupOpDlg::createMainFrame (QWidget* theParent) // name : SMESHGUI_GroupOpDlg::createButtonFrame // Purpose : Create frame containing buttons //======================================================================= -QFrame* SMESHGUI_GroupOpDlg::createButtonFrame (QWidget* theParent) +QWidget* SMESHGUI_GroupOpDlg::createButtonFrame (QWidget* theParent) { - QFrame* aFrame = new QFrame(theParent); - aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken); + QGroupBox* aFrame = new QGroupBox(theParent); - myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), aFrame); - myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame); - myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame); - myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aFrame); + myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), aFrame); + myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame); + myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame); + myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aFrame); - QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); - - QHBoxLayout* aLay = new QHBoxLayout(aFrame, MARGIN, SPACING); + QHBoxLayout* aLay = new QHBoxLayout(aFrame); + aLay->setMargin(MARGIN); + aLay->setSpacing(SPACING); aLay->addWidget(myOkBtn); + aLay->addSpacing(10); aLay->addWidget(myApplyBtn); - aLay->addItem(aSpacer); + aLay->addSpacing(10); + aLay->addStretch(); aLay->addWidget(myCloseBtn); aLay->addWidget(myHelpBtn); @@ -168,7 +192,7 @@ QFrame* SMESHGUI_GroupOpDlg::createButtonFrame (QWidget* theParent) connect(myOkBtn, SIGNAL(clicked()), SLOT(onOk())); connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose())); connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply())); - connect(myHelpBtn, SIGNAL(clicked()), SLOT(onHelp())); + connect(myHelpBtn, SIGNAL(clicked()), SLOT(onHelp())); return aFrame; } @@ -201,14 +225,10 @@ void SMESHGUI_GroupOpDlg::Init() connect(myBtn1, SIGNAL(clicked()), this, SLOT(onFocusChanged())); connect(myBtn2, SIGNAL(clicked()), this, SLOT(onFocusChanged())); - this->show(); - // set selection mode if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->SetSelectionMode(ActorSelection); mySelectionMgr->installFilter(new SMESH_TypeFilter (GROUP)); - - return; } //======================================================================= @@ -219,15 +239,15 @@ bool SMESHGUI_GroupOpDlg::isValid() { // Verify validity of group name if (myNameEdit->text() == "") { - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), - tr("EMPTY_NAME"), QMessageBox::Ok); + SUIT_MessageBox::information(this, tr("SMESH_INSUFFICIENT_DATA"), + tr("EMPTY_NAME")); return false; } // Verufy wheter arguments speciffiyed if (myGroup1->_is_nil() || myGroup2->_is_nil()) { - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), - tr("INCORRECT_ARGUMENTS"), QMessageBox::Ok); + SUIT_MessageBox::information(this, tr("SMESH_INSUFFICIENT_DATA"), + tr("INCORRECT_ARGUMENTS")); return false; } @@ -239,15 +259,15 @@ bool SMESHGUI_GroupOpDlg::isValid() int aMeshId2 = !aMesh2->_is_nil() ? aMesh2->GetId() : -1; if (aMeshId1 != aMeshId2 || aMeshId1 == -1) { - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), - tr("DIFF_MESHES"), QMessageBox::Ok); + SUIT_MessageBox::information(this, tr("SMESH_INSUFFICIENT_DATA"), + tr("DIFF_MESHES")); return false; } // Verify whether groups have same types of entities if (myGroup1->GetType() != myGroup2->GetType()) { - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), - tr("DIFF_TYPES"), QMessageBox::Ok); + SUIT_MessageBox::information(this, tr("SMESH_INSUFFICIENT_DATA"), + tr("DIFF_TYPES")); return false; } @@ -267,17 +287,17 @@ bool SMESHGUI_GroupOpDlg::onApply() QString aName = myNameEdit->text(); SMESH::SMESH_Group_ptr aNewGrp = SMESH::SMESH_Group::_nil(); - if (myMode == UNION) aNewGrp = aMesh->UnionGroups(myGroup1, myGroup2, aName.latin1()); - else if (myMode == INTERSECT) aNewGrp = aMesh->IntersectGroups(myGroup1, myGroup2, aName.latin1()); - else aNewGrp = aMesh->CutGroups(myGroup1, myGroup2, aName.latin1()); + if (myMode == UNION) aNewGrp = aMesh->UnionGroups(myGroup1, myGroup2, aName.toLatin1().data()); + else if (myMode == INTERSECT) aNewGrp = aMesh->IntersectGroups(myGroup1, myGroup2, aName.toLatin1().data()); + else aNewGrp = aMesh->CutGroups(myGroup1, myGroup2, aName.toLatin1().data()); if (!aNewGrp->_is_nil()) { mySMESHGUI->updateObjBrowser(true); reset(); return true; } else { - QMessageBox::critical(SMESHGUI::desktop(), tr("SMESH_ERROR"), - tr("SMESH_OPERATION_FAILED"), "OK"); + SUIT_MessageBox::critical(this, tr("SMESH_ERROR"), + tr("SMESH_OPERATION_FAILED")); return false; } } @@ -317,16 +337,17 @@ void SMESHGUI_GroupOpDlg::onHelp() if (app) app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); else { - QString platform; + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName)); } } @@ -429,9 +450,8 @@ void SMESHGUI_GroupOpDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) - { - e->accept(); - onHelp(); - } + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + onHelp(); + } } diff --git a/src/SMESHGUI/SMESHGUI_GroupOpDlg.h b/src/SMESHGUI/SMESHGUI_GroupOpDlg.h index 2dfce3bb5..3c37a2602 100644 --- a/src/SMESHGUI/SMESHGUI_GroupOpDlg.h +++ b/src/SMESHGUI/SMESHGUI_GroupOpDlg.h @@ -1,47 +1,45 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// SMESH SMESHGUI : GUI for SMESH component // +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_GroupOpDlg.h +// Author : Sergey LITONIN, Open CASCADE S.A.S. // -// File : SMESHGUI_GroupOpDlg.h -// Author : Sergey LITONIN -// Module : SMESH - -#ifndef SMESHGUI_GroupOpDlg_H -#define SMESHGUI_GroupOpDlg_H +#ifndef SMESHGUI_GROUPOPDLG_H +#define SMESHGUI_GROUPOPDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include +// Qt includes +#include +// IDL includes #include #include CORBA_SERVER_HEADER(SMESH_Group) -class QCloseEvent; -class QLabel; -class QFrame; class QPushButton; -class LightApp_SelectionMgr; class QLineEdit; class SMESHGUI; -class SVTK_ViewWindow; +class LightApp_SelectionMgr; class SVTK_Selector; /* @@ -57,19 +55,17 @@ public: enum { UNION, INTERSECT, CUT }; public: - SMESHGUI_GroupOpDlg( SMESHGUI*, const int ); - virtual ~SMESHGUI_GroupOpDlg(); + SMESHGUI_GroupOpDlg( SMESHGUI*, const int ); + virtual ~SMESHGUI_GroupOpDlg(); void Init(); private: - - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; - void keyPressEvent(QKeyEvent*); + void closeEvent( QCloseEvent* ); + void enterEvent( QEvent* ); + void keyPressEvent( QKeyEvent* ); private slots: - void onOk(); bool onApply(); void onClose(); @@ -80,14 +76,12 @@ private slots: void onFocusChanged(); private: - - QFrame* createButtonFrame( QWidget* ); - QFrame* createMainFrame ( QWidget* ); + QWidget* createButtonFrame( QWidget* ); + QWidget* createMainFrame ( QWidget* ); bool isValid(); void reset(); private: - QPushButton* myOkBtn; QPushButton* myApplyBtn; QPushButton* myCloseBtn; @@ -110,7 +104,6 @@ private: SMESH::SMESH_GroupBase_var myGroup2; QString myHelpFileName; - }; -#endif +#endif // SMESHGUI_GROUPOPDLG_H diff --git a/src/SMESHGUI/SMESHGUI_GroupUtils.cxx b/src/SMESHGUI/SMESHGUI_GroupUtils.cxx index 86063b09c..c766102e8 100644 --- a/src/SMESHGUI/SMESHGUI_GroupUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_GroupUtils.cxx @@ -1,53 +1,52 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// SMESH SMESHGUI : GUI for SMESH component // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_GroupUtils.cxx +// Author : Open CASCADE S.A.S. +// - +// SMESH includes #include "SMESHGUI_GroupUtils.h" #include "SMESHGUI.h" #include "SMESHGUI_Utils.h" -#include "SUIT_Session.h" -#include "SalomeApp_Application.h" -#include "SalomeApp_Tools.h" - -#include "OB_Browser.h" +// SALOME GUI includes +#include namespace SMESH { - SMESH::SMESH_Group_var AddGroup( SMESH::SMESH_Mesh_ptr theMesh, SMESH::ElementType theType, - const char* theGroupName ) + const QString& theGroupName ) { SMESH::SMESH_Group_var aGroup; try { if ( !theMesh->_is_nil() ) - aGroup = theMesh->CreateGroup( theType, theGroupName ); + aGroup = theMesh->CreateGroup( theType, theGroupName.toLatin1().data() ); } catch( const SALOME::SALOME_Exception& S_ex ) { SalomeApp_Tools::QtCatchCorbaException( S_ex ); } - //SalomeApp_Application* app = - // dynamic_cast(SUIT_Session::session()->activeApplication()); - //if (app) app->objectBrowser()->updateTree(); SMESHGUI::GetSMESHGUI()->updateObjBrowser(); return aGroup._retn(); } -} +} // end of namespace SMESH diff --git a/src/SMESHGUI/SMESHGUI_GroupUtils.h b/src/SMESHGUI/SMESHGUI_GroupUtils.h index f6ceabef6..7428223f2 100644 --- a/src/SMESHGUI/SMESHGUI_GroupUtils.h +++ b/src/SMESHGUI/SMESHGUI_GroupUtils.h @@ -1,39 +1,47 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// +// SMESH SMESHGUI : GUI for SMESH component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_GroupUtils.h +// Author : Open CASCADE S.A.S. +// -#ifndef SMESHGUI_GroupUtils_HeaderFile -#define SMESHGUI_GroupUtils_HeaderFile +#ifndef SMESHGUI_GROUPUTILS_H +#define SMESHGUI_GROUPUTILS_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include "SALOMEconfig.h" +// IDL includes +#include #include CORBA_SERVER_HEADER(SMESH_Mesh) #include CORBA_SERVER_HEADER(SMESH_Group) +class QString; -namespace SMESH{ - -SMESHGUI_EXPORT - SMESH::SMESH_Group_var AddGroup(SMESH::SMESH_Mesh_ptr theMesh, - SMESH::ElementType theType, - const char* theGroupName); +namespace SMESH +{ + SMESHGUI_EXPORT + SMESH::SMESH_Group_var AddGroup( SMESH::SMESH_Mesh_ptr, + SMESH::ElementType, + const QString& ); } - -#endif +#endif // SMESHGUI_GROUPUTILS_H diff --git a/src/SMESHGUI/SMESHGUI_Hypotheses.cxx b/src/SMESHGUI/SMESHGUI_Hypotheses.cxx index 2078b02c7..a790cf126 100644 --- a/src/SMESHGUI/SMESHGUI_Hypotheses.cxx +++ b/src/SMESHGUI/SMESHGUI_Hypotheses.cxx @@ -1,52 +1,59 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// SMESH SMESHGUI : GUI for SMESH component // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// Copyright (C) 2003 CEA // -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_Hypotheses.cxx +// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. +// +// SMESH includes #include "SMESHGUI_Hypotheses.h" + #include "SMESHGUI.h" #include "SMESHGUI_HypothesesUtils.h" #include "SMESHGUI_Utils.h" #include "SMESHGUI_SpinBox.h" +// SALOME KERNEL includes #include #include -#include - +// SALOME GUI includes #include - #include #include - +#include #include -#include -#include -#include -#include -#include -#include +// Qt includes +#include +#include +#include +#include +#include +#include -#include +#define SPACING 6 +#define MARGIN 11 SMESHGUI_GenericHypothesisCreator::SMESHGUI_GenericHypothesisCreator( const QString& theHypType ) - : myHypType( theHypType ), myIsCreate( false ), myDlg( 0 ) + : myHypType( theHypType ), myIsCreate( false ), myDlg( 0 ), myEventLoop( 0 ) { } @@ -135,18 +142,21 @@ bool SMESHGUI_GenericHypothesisCreator::editHypothesis( SMESH::SMESH_Hypothesis_ myHypo = SMESH::SMESH_Hypothesis::_duplicate( h ); SMESHGUI_HypothesisDlg* Dlg = new SMESHGUI_HypothesisDlg( this, theParent ); + connect( Dlg, SIGNAL( finished( int ) ), this, SLOT( onDialogFinished( int ) ) ); myDlg = Dlg; QFrame* fr = buildFrame(); if( fr ) { Dlg->setCustomFrame( fr ); - Dlg->setCaption( caption() ); - Dlg->setName( theHypName ); + Dlg->setWindowTitle( caption() ); + Dlg->setObjectName( theHypName ); Dlg->setHIcon( icon() ); Dlg->setType( type() ); retrieveParams(); Dlg->show(); - qApp->enter_loop(); // make myDlg not modal + if ( !myEventLoop ) + myEventLoop = new QEventLoop( this ); + myEventLoop->exec(); // make myDlg not modal res = myDlg->result(); if( res ) { QString paramValues = storeParams(); @@ -172,20 +182,17 @@ QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame() if( !stdParams( params ) || params.isEmpty() ) return 0; - QFrame* fr = new QFrame( 0, "myframe" ); - QVBoxLayout* lay = new QVBoxLayout( fr, 5, 0 ); + QFrame* fr = new QFrame( 0 ); + QVBoxLayout* lay = new QVBoxLayout( fr ); + lay->setMargin( 5 ); + lay->setSpacing( 0 ); - QGroupBox* GroupC1 = new QGroupBox( fr, "GroupC1" ); + QGroupBox* GroupC1 = new QGroupBox( tr( "SMESH_ARGUMENTS" ), fr ); lay->addWidget( GroupC1 ); - GroupC1->setTitle( tr( "SMESH_ARGUMENTS" ) ); - GroupC1->setColumnLayout(0, Qt::Vertical ); - GroupC1->layout()->setSpacing( 0 ); - GroupC1->layout()->setMargin( 0 ); - QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() ); - GroupC1Layout->setAlignment( Qt::AlignTop ); - GroupC1Layout->setSpacing( 6 ); - GroupC1Layout->setMargin( 11 ); + QGridLayout* GroupC1Layout = new QGridLayout( GroupC1 ); + GroupC1Layout->setSpacing( SPACING ); + GroupC1Layout->setMargin( MARGIN ); ListOfStdParams::const_iterator anIt = params.begin(), aLast = params.end(); for( int i=0; anIt!=aLast; anIt++, i++ ) @@ -199,7 +206,8 @@ QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame() { case QVariant::Int: { - QtxIntSpinBox* sb = new QtxIntSpinBox( GroupC1, (*anIt).myName.latin1() ); + QtxIntSpinBox* sb = new QtxIntSpinBox( GroupC1 ); + sb->setObjectName( (*anIt).myName ); attuneStdWidget( sb, i ); sb->setValue( (*anIt).myValue.toInt() ); connect( sb, SIGNAL( valueChanged( int ) ), this, SLOT( onValueChanged() ) ); @@ -208,7 +216,8 @@ QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame() break; case QVariant::Double: { - QtxDblSpinBox* sb = new SMESHGUI_SpinBox( GroupC1, (*anIt).myName.latin1() ); + QtxDoubleSpinBox* sb = new SMESHGUI_SpinBox( GroupC1 ); + sb->setObjectName( (*anIt).myName ); attuneStdWidget( sb, i ); sb->setValue( (*anIt).myValue.toDouble() ); connect( sb, SIGNAL( valueChanged( double ) ), this, SLOT( onValueChanged() ) ); @@ -217,7 +226,8 @@ QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame() break; case QVariant::String: { - QLineEdit* le = new QLineEdit( GroupC1, (*anIt).myName.latin1() ); + QLineEdit* le = new QLineEdit( GroupC1 ); + le->setObjectName( (*anIt).myName ); attuneStdWidget( le, i ); le->setText( (*anIt).myValue.toString() ); connect( le, SIGNAL( textChanged( const QString& ) ), this, SLOT( onValueChanged() ) ); @@ -240,6 +250,12 @@ void SMESHGUI_GenericHypothesisCreator::onValueChanged() { } +void SMESHGUI_GenericHypothesisCreator::onDialogFinished( int /*result*/ ) +{ + if ( myEventLoop ) + myEventLoop->exit(); +} + bool SMESHGUI_GenericHypothesisCreator::stdParams( ListOfStdParams& ) const { return false; @@ -252,7 +268,7 @@ bool SMESHGUI_GenericHypothesisCreator::getStdParamFromDlg( ListOfStdParams& par ListOfWidgets::const_iterator anIt = widgets().begin(), aLast = widgets().end(); for( ; anIt!=aLast; anIt++ ) { - item.myName = (*anIt)->name(); + item.myName = (*anIt)->objectName(); if( (*anIt)->inherits( "QtxIntSpinBox" ) ) { QtxIntSpinBox* sb = ( QtxIntSpinBox* )( *anIt ); @@ -260,9 +276,9 @@ bool SMESHGUI_GenericHypothesisCreator::getStdParamFromDlg( ListOfStdParams& par params.append( item ); } - else if( (*anIt)->inherits( "QtxDblSpinBox" ) ) + else if( (*anIt)->inherits( "QtxDoubleSpinBox" ) ) { - QtxDblSpinBox* sb = ( QtxDblSpinBox* )( *anIt ); + QtxDoubleSpinBox* sb = ( QtxDoubleSpinBox* )( *anIt ); item.myValue = sb->value(); params.append( item ); } @@ -309,7 +325,7 @@ QString SMESHGUI_GenericHypothesisCreator::stdParamValues( const ListOfStdParams break; default: QVariant valCopy = (*param).myValue; - valueStr += valCopy.asString(); + valueStr += valCopy.toString(); } } return valueStr; @@ -347,6 +363,11 @@ SMESHGUI_GenericHypothesisCreator::ListOfWidgets& SMESHGUI_GenericHypothesisCrea return myParamWidgets; } +QtxDialog* SMESHGUI_GenericHypothesisCreator:: dlg() const +{ + return myDlg; +} + bool SMESHGUI_GenericHypothesisCreator::isCreation() const { return myIsCreate; @@ -376,7 +397,7 @@ QWidget* SMESHGUI_GenericHypothesisCreator::getCustomWidget( const StdParam & /* { return 0; } -bool SMESHGUI_GenericHypothesisCreator::getParamFromCustomWidget( StdParam& , QWidget* ) const +bool SMESHGUI_GenericHypothesisCreator::getParamFromCustomWidget( StdParam&, QWidget* ) const { return false; } @@ -389,15 +410,19 @@ void SMESHGUI_GenericHypothesisCreator::onReject() SMESHGUI_HypothesisDlg::SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreator* creator, QWidget* parent ) -: QtxDialog( parent, "", false, true ), +: QtxDialog( parent, false, true ), myCreator( creator ) { setMinimumSize( 300, height() ); // setFixedSize( 300, height() ); - myLayout = new QVBoxLayout( mainFrame(), 0, 0 ); + QVBoxLayout* topLayout = new QVBoxLayout( mainFrame() ); + topLayout->setMargin( 0 ); + topLayout->setSpacing( 0 ); QFrame* titFrame = new QFrame( mainFrame() ); - QHBoxLayout* titLay = new QHBoxLayout( titFrame, 0, 5 ); + QHBoxLayout* titLay = new QHBoxLayout( titFrame ); + titLay->setMargin( 0 ); + titLay->setSpacing( SPACING ); myIconLabel = new QLabel( titFrame ); myIconLabel->setScaledContents( false ); @@ -410,7 +435,7 @@ SMESHGUI_HypothesisDlg::SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreato titLay->addWidget( myTypeLabel, 0 ); titLay->addStretch( 1 ); - myLayout->addWidget( titFrame, 0 ); + topLayout->addWidget( titFrame, 0 ); QString aHypType = creator->hypType(); if ( aHypType == "LocalLength" ) @@ -443,8 +468,8 @@ void SMESHGUI_HypothesisDlg::setCustomFrame( QFrame* f ) { if( f ) { - f->reparent( mainFrame(), QPoint( 0, 0 ) ); - myLayout->insertWidget( 1, f, 1 ); + f->setParent( mainFrame() ); + qobject_cast( layout() )->insertWidget( 1, f, 1 ); } } @@ -453,14 +478,12 @@ void SMESHGUI_HypothesisDlg::accept() if ( myCreator && !myCreator->checkParams() ) return; QtxDialog::accept(); - qApp->exit_loop(); } void SMESHGUI_HypothesisDlg::reject() { if ( myCreator ) myCreator->onReject(); QtxDialog::reject(); - qApp->exit_loop(); } void SMESHGUI_HypothesisDlg::onHelp() @@ -471,16 +494,17 @@ void SMESHGUI_HypothesisDlg::onHelp() app->onHelpContextModule(aSMESHGUI ? app->moduleName(aSMESHGUI->moduleName()) : QString(""), myHelpFileName); } else { - QString platform; + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName)); } } @@ -493,3 +517,46 @@ void SMESHGUI_HypothesisDlg::setType( const QString& t ) { myTypeLabel->setText( t ); } + +HypothesisData::HypothesisData( const QString& theTypeName, + const QString& thePluginName, + const QString& theServerLibName, + const QString& theClientLibName, + const QString& theLabel, + const QString& theIconId, + const QList& theDim, + const bool theIsAux, + const QStringList& theNeededHypos, + const QStringList& theOptionalHypos, + const QStringList& theInputTypes, + const QStringList& theOutputTypes, + const bool theIsNeedGeometry ) + : TypeName( theTypeName ), + PluginName( thePluginName ), + ServerLibName( theServerLibName ), + ClientLibName( theClientLibName ), + Label( theLabel ), + IconId( theIconId ), + Dim( theDim ), + IsAux( theIsAux ), + NeededHypos( theNeededHypos ), + OptionalHypos( theOptionalHypos ), + InputTypes( theInputTypes ), + OutputTypes( theOutputTypes ), + IsNeedGeometry( theIsNeedGeometry ) +{ +} + +HypothesesSet::HypothesesSet( const QString& theSetName ) + : HypoSetName( theSetName ) +{ +} + +HypothesesSet::HypothesesSet( const QString& theSetName, + const QStringList& theHypoList, + const QStringList& theAlgoList ) + : HypoSetName( theSetName ), + HypoList( theHypoList ), + AlgoList( theAlgoList ) +{ +} diff --git a/src/SMESHGUI/SMESHGUI_Hypotheses.h b/src/SMESHGUI/SMESHGUI_Hypotheses.h index fba15ebd1..6b88c0c3c 100644 --- a/src/SMESHGUI/SMESHGUI_Hypotheses.h +++ b/src/SMESHGUI/SMESHGUI_Hypotheses.h @@ -1,43 +1,42 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 CEA -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 CEA +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_Hypotheses.h +// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. // -// File : SMESHGUI_Hypotheses.h -// Author : Julia DOROVSKIKH -// Module : SMESH -// $Header$ -#ifndef SMESHGUI_Hypotheses_HeaderFile -#define SMESHGUI_Hypotheses_HeaderFile +#ifndef SMESHGUI_HYPOTHESES_H +#define SMESHGUI_HYPOTHESES_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" +// Qt includes +#include +#include + +// IDL includes #include #include CORBA_SERVER_HEADER(SMESH_Hypothesis) -#include -#include - -class QVBoxLayout; -class QPixmap; +class QEventLoop; /*! * \brief Auxiliary class for creation of hypotheses @@ -47,19 +46,21 @@ class SMESHGUI_EXPORT SMESHGUI_GenericHypothesisCreator : public QObject Q_OBJECT public: - SMESHGUI_GenericHypothesisCreator( const QString& theHypType ); + SMESHGUI_GenericHypothesisCreator( const QString& ); virtual ~SMESHGUI_GenericHypothesisCreator(); - void create( SMESH::SMESH_Hypothesis_ptr, const QString&, QWidget*); - void create( bool isAlgo, const QString&, QWidget*); - void edit( SMESH::SMESH_Hypothesis_ptr, const QString&, QWidget*); + void create( SMESH::SMESH_Hypothesis_ptr, + const QString&, QWidget* ); + void create( bool, const QString&, QWidget* ); + void edit( SMESH::SMESH_Hypothesis_ptr, + const QString&, QWidget* ); - virtual bool checkParams() const = 0; - virtual void onReject(); + virtual bool checkParams() const = 0; + virtual void onReject(); - QString hypType() const; - QString hypName() const; - bool isCreation() const; + QString hypType() const; + QString hypName() const; + bool isCreation() const; protected: typedef struct @@ -69,34 +70,39 @@ protected: } StdParam; - typedef QValueList ListOfStdParams; - typedef QPtrList ListOfWidgets; - - SMESH::SMESH_Hypothesis_var hypothesis() const; - SMESH::SMESH_Hypothesis_var initParamsHypothesis() const; - const ListOfWidgets& widgets() const; - ListOfWidgets& changeWidgets(); - QtxDialog* dlg() const { return myDlg; } - - virtual QFrame* buildFrame () = 0; - QFrame* buildStdFrame (); - virtual void retrieveParams() const = 0; - virtual QString storeParams () const = 0; - virtual bool stdParams ( ListOfStdParams& ) const; - bool getStdParamFromDlg( ListOfStdParams& ) const; - static QString stdParamValues( const ListOfStdParams& ); - virtual void attuneStdWidget( QWidget*, const int ) const; - virtual QWidget* getCustomWidget( const StdParam &, QWidget*, const int ) const; - virtual bool getParamFromCustomWidget( StdParam& , QWidget* ) const; - virtual QString caption() const; - virtual QPixmap icon() const; - virtual QString type() const; + typedef QList ListOfStdParams; + typedef QList ListOfWidgets; + + SMESH::SMESH_Hypothesis_var hypothesis() const; + SMESH::SMESH_Hypothesis_var initParamsHypothesis() const; + const ListOfWidgets& widgets() const; + ListOfWidgets& changeWidgets(); + QtxDialog* dlg() const; + + virtual QFrame* buildFrame() = 0; + QFrame* buildStdFrame(); + virtual void retrieveParams() const = 0; + virtual QString storeParams() const = 0; + virtual bool stdParams( ListOfStdParams& ) const; + bool getStdParamFromDlg( ListOfStdParams& ) const; + static QString stdParamValues( const ListOfStdParams& ); + virtual void attuneStdWidget( QWidget*, const int ) const; + virtual QWidget* getCustomWidget( const StdParam&, + QWidget*, const int ) const; + virtual bool getParamFromCustomWidget( StdParam&, QWidget* ) const; + virtual QString caption() const; + virtual QPixmap icon() const; + virtual QString type() const; protected slots: - virtual void onValueChanged(); + virtual void onValueChanged(); + +private slots: + virtual void onDialogFinished( int ); private: - bool editHypothesis( SMESH::SMESH_Hypothesis_ptr, const QString&, QWidget* ); + bool editHypothesis( SMESH::SMESH_Hypothesis_ptr, + const QString&, QWidget* ); private: SMESH::SMESH_Hypothesis_var myHypo, myInitParamsHypo; @@ -105,6 +111,7 @@ private: ListOfWidgets myParamWidgets; bool myIsCreate; QtxDialog* myDlg; + QEventLoop* myEventLoop; }; class SMESHGUI_HypothesisDlg : public QtxDialog @@ -115,18 +122,17 @@ public: SMESHGUI_HypothesisDlg( SMESHGUI_GenericHypothesisCreator*, QWidget* ); virtual ~SMESHGUI_HypothesisDlg(); - void setHIcon( const QPixmap& ); - void setCustomFrame( QFrame* ); - void setType( const QString& ); + void setHIcon( const QPixmap& ); + void setCustomFrame( QFrame* ); + void setType( const QString& ); protected slots: - virtual void accept(); - virtual void reject(); - void onHelp(); + virtual void accept(); + virtual void reject(); + void onHelp(); private: SMESHGUI_GenericHypothesisCreator* myCreator; - QVBoxLayout* myLayout; QLabel* myIconLabel; QLabel* myTypeLabel; QString myHelpFileName; @@ -137,48 +143,29 @@ private: */ class HypothesisData { - public: - HypothesisData( const QString& theTypeName, - const QString& thePluginName, - const QString& theServerLibName, - const QString& theClientLibName, - const QString& theLabel, - const QString& theIconId, - const QValueList& theDim, - const bool theIsAux, - const QStringList& theNeededHypos, - const QStringList& theOptionalHypos, - const QStringList& theInputTypes, - const QStringList& theOutputTypes, - const bool theIsNeedGeometry = true) - : TypeName( theTypeName ), - PluginName( thePluginName ), - ServerLibName( theServerLibName ), - ClientLibName( theClientLibName ), - Label( theLabel ), - IconId( theIconId ), - Dim( theDim ), - IsAux( theIsAux ), - NeededHypos( theNeededHypos ), OptionalHypos( theOptionalHypos ), - InputTypes( theInputTypes ), OutputTypes( theOutputTypes ), - IsNeedGeometry( theIsNeedGeometry ) - {}; - - QString TypeName; //!< hypothesis type name - QString PluginName; //!< plugin name - QString ServerLibName; //!< server library name - QString ClientLibName; //!< client library name - QString Label; //!< label - QString IconId; //!< icon identifier - QValueList Dim; //!< list of supported dimensions (see SMESH::Dimension enumeration) - bool IsAux; //!< TRUE if given hypothesis is auxiliary one, FALSE otherwise - bool IsNeedGeometry; //!< TRUE if for given hypothesis need shape, FALSE otherwise - - // for algorithm only: dependencies algo <-> algo and algo -> hypos - QStringList NeededHypos; //!< list of obligatory hypotheses - QStringList OptionalHypos;//!< list of optional hypotheses - QStringList InputTypes; //!< list of element types required as a prerequisite - QStringList OutputTypes; //!< list of types of generated elements +public: + HypothesisData( const QString&, const QString&, const QString&, + const QString&, const QString&, const QString&, + const QList&, const bool, + const QStringList&, const QStringList&, + const QStringList&, const QStringList&, + const bool = true ); + + QString TypeName; //!< hypothesis type name + QString PluginName; //!< plugin name + QString ServerLibName; //!< server library name + QString ClientLibName; //!< client library name + QString Label; //!< label + QString IconId; //!< icon identifier + QList Dim; //!< list of supported dimensions (see SMESH::Dimension enumeration) + bool IsAux; //!< TRUE if given hypothesis is auxiliary one, FALSE otherwise + bool IsNeedGeometry; //!< TRUE if for given hypothesis need shape, FALSE otherwise + + // for algorithm only: dependencies algo <-> algo and algo -> hypos + QStringList NeededHypos; //!< list of obligatory hypotheses + QStringList OptionalHypos;//!< list of optional hypotheses + QStringList InputTypes; //!< list of element types required as a prerequisite + QStringList OutputTypes; //!< list of types of generated elements }; /*! @@ -188,14 +175,12 @@ class HypothesisData */ class HypothesesSet { - public: - HypothesesSet( const QString& theSetName ) - : HypoSetName( theSetName ) {}; - HypothesesSet( const QString& theSetName, - const QStringList& theHypoList, - const QStringList& theAlgoList ) - : HypoSetName( theSetName ), HypoList(theHypoList), AlgoList(theAlgoList) {}; +public: + HypothesesSet( const QString& ); + HypothesesSet( const QString&, const QStringList&, const QStringList& ); + QString HypoSetName; QStringList HypoList, AlgoList; }; -#endif + +#endif // SMESHGUI_HYPOTHESES_H diff --git a/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx b/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx index 6a393a254..14a12754e 100644 --- a/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx @@ -1,22 +1,28 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// SMESH SMESHGUI : GUI for SMESH component // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// Copyright (C) 2003 CEA // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_HypothesesUtils.cxx +// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. +// +// SMESH includes #include "SMESHGUI_HypothesesUtils.h" #include "SMESHGUI.h" @@ -25,44 +31,39 @@ #include "SMESHGUI_Utils.h" #include "SMESHGUI_GEOMGenUtils.h" -#include "SUIT_Tools.h" -#include "SUIT_Desktop.h" -#include "SUIT_MessageBox.h" -#include "SUIT_OverrideCursor.h" -#include "SUIT_ResourceMgr.h" -#include "SUIT_Session.h" - -#include "OB_Browser.h" - -#include "SalomeApp_Study.h" -#include "SalomeApp_Tools.h" -#include "SalomeApp_Application.h" +// SALOME GUI includes +#include +#include +#include +#include -#include -#include +#include +#include -#include "SALOMEconfig.h" -#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) +// SALOME KERNEL includes +#include +// STL includes #include #include +// Other includes #ifdef WNT - #include +#include #else - #include +#include #endif #ifdef WNT - #define LibHandle HMODULE - #define LoadLib( name ) LoadLibrary( name ) - #define GetProc GetProcAddress - #define UnLoadLib( handle ) FreeLibrary( handle ); +#define LibHandle HMODULE +#define LoadLib( name ) LoadLibrary( name ) +#define GetProc GetProcAddress +#define UnLoadLib( handle ) FreeLibrary( handle ); #else - #define LibHandle void* - #define LoadLib( name ) dlopen( name, RTLD_LAZY ) - #define GetProc dlsym - #define UnLoadLib( handle ) dlclose( handle ); +#define LibHandle void* +#define LoadLib( name ) dlopen( name, RTLD_LAZY ) +#define GetProc dlsym +#define UnLoadLib( handle ) dlclose( handle ); #endif #ifdef _DEBUG_ @@ -71,18 +72,16 @@ static int MYDEBUG = 0; static int MYDEBUG = 0; #endif -namespace SMESH{ - - using namespace std; - - typedef map THypothesisDataMap; +namespace SMESH +{ + typedef std::map THypothesisDataMap; THypothesisDataMap myHypothesesMap; THypothesisDataMap myAlgorithmsMap; - typedef map THypCreatorMap; + typedef std::map THypCreatorMap; THypCreatorMap myHypCreatorMap; - list myListOfHypothesesSets; + std::list myListOfHypothesesSets; void processHypothesisStatus(const int theHypStatus, SMESH::SMESH_Hypothesis_ptr theHyp, @@ -110,16 +109,15 @@ namespace SMESH{ else aMsg = (isFatal ? "SMESH_CANT_RM_HYP" : "SMESH_RM_HYP_WRN"); - aMsg = QObject::tr(aMsg).arg(aHypName) + - QObject::tr(QString("SMESH_HYP_%1").arg(theHypStatus)); + aMsg = QObject::tr(aMsg.toLatin1().data()).arg(aHypName) + + QObject::tr(QString("SMESH_HYP_%1").arg(theHypStatus).toLatin1().data()); if ( theHypStatus == SMESH::HYP_HIDDEN_ALGO ) // PAL18501 aMsg = aMsg.arg( GetHypothesisData(theHyp->GetName())->Dim[0] ); - SUIT_MessageBox::warn1(SMESHGUI::desktop(), - QObject::tr("SMESH_WRN_WARNING"), - aMsg, - QObject::tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(SMESHGUI::desktop(), + QObject::tr("SMESH_WRN_WARNING"), + aMsg); } } @@ -138,13 +136,12 @@ namespace SMESH{ if (cenv) HypsXml.sprintf("%s", cenv); - QStringList HypsXmlList = QStringList::split(":", HypsXml, false); + QStringList HypsXmlList = HypsXml.split(":", QString::SkipEmptyParts); if (HypsXmlList.count() == 0) { - SUIT_MessageBox::error1(SMESHGUI::desktop(), - QObject::tr("SMESH_WRN_WARNING"), - QObject::tr("MESHERS_FILE_NO_VARIABLE"), - QObject::tr("SMESH_BUT_OK")); + SUIT_MessageBox::critical(SMESHGUI::desktop(), + QObject::tr("SMESH_WRN_WARNING"), + QObject::tr("MESHERS_FILE_NO_VARIABLE")); return; } @@ -159,13 +156,13 @@ namespace SMESH{ xmlFile = resMgr->path("resources", HypsXml, HypsXml + ".xml"); QFile file (xmlFile); - if (file.exists() && file.open(IO_ReadOnly)) { + if (file.exists() && file.open(QIODevice::ReadOnly)) { file.close(); SMESHGUI_XmlHandler* aXmlHandler = new SMESHGUI_XmlHandler(); ASSERT(aXmlHandler); - QXmlInputSource source (file); + QXmlInputSource source (&file); QXmlSimpleReader reader; reader.setContentHandler(aXmlHandler); reader.setErrorHandler(aXmlHandler); @@ -180,10 +177,9 @@ namespace SMESH{ aXmlHandler->myListOfHypothesesSets ); } else { - SUIT_MessageBox::error1(SMESHGUI::desktop(), - QObject::tr("INF_PARSE_ERROR"), - QObject::tr(aXmlHandler->errorProtocol()), - QObject::tr("SMESH_BUT_OK")); + SUIT_MessageBox::critical(SMESHGUI::desktop(), + QObject::tr("INF_PARSE_ERROR"), + QObject::tr(aXmlHandler->errorProtocol().toLatin1().data())); } } else { @@ -199,10 +195,9 @@ namespace SMESH{ QString aMess = QObject::tr("MESHERS_FILE_CANT_OPEN") + " " + aNoAccessFiles + "\n"; aMess += QObject::tr("MESHERS_FILE_CHECK_VARIABLE"); wc.suspend(); - SUIT_MessageBox::warn1(SMESHGUI::desktop(), - QObject::tr("SMESH_WRN_WARNING"), - aMess, - QObject::tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(SMESHGUI::desktop(), + QObject::tr("SMESH_WRN_WARNING"), + aMess); wc.resume(); } } @@ -223,16 +218,16 @@ namespace SMESH{ THypothesisDataMap* pMap = isAlgo ? &myAlgorithmsMap : &myHypothesesMap; THypothesisDataMap::iterator anIter; for ( anIter = pMap->begin(); anIter != pMap->end(); anIter++ ) - { - HypothesisData* aData = (*anIter).second; - if ( ( theDim < 0 || aData->Dim.contains( theDim ) ) && aData->IsAux == isAux) - if (checkGeometry){ - if (aData->IsNeedGeometry == isNeedGeometry) - aHypList.append(((*anIter).first).c_str()); - } - else - aHypList.append(((*anIter).first).c_str()); - } + { + HypothesisData* aData = (*anIter).second; + if ( ( theDim < 0 || aData->Dim.contains( theDim ) ) && aData->IsAux == isAux) + if (checkGeometry){ + if (aData->IsNeedGeometry == isNeedGeometry) + aHypList.append(((*anIter).first).c_str()); + } + else + aHypList.append(((*anIter).first).c_str()); + } return aHypList; } @@ -246,41 +241,41 @@ namespace SMESH{ list::iterator hypoSet = myListOfHypothesesSets.begin(); for ( ; hypoSet != myListOfHypothesesSets.end(); ++hypoSet ) - { - HypothesesSet* aSet = *hypoSet; - if ( aSet && aSet->AlgoList.count() ) { - aSetNameList.append( aSet->HypoSetName ); + { + HypothesesSet* aSet = *hypoSet; + if ( aSet && aSet->AlgoList.count() ) { + aSetNameList.append( aSet->HypoSetName ); + } } - } return aSetNameList; } - HypothesesSet* GetHypothesesSet(const QString theSetName) + HypothesesSet* GetHypothesesSet(const QString& theSetName) { list::iterator hypoSet = myListOfHypothesesSets.begin(); for ( ; hypoSet != myListOfHypothesesSets.end(); ++hypoSet ) - { - HypothesesSet* aSet = *hypoSet; - if ( aSet && aSet->HypoSetName == theSetName ) - return aSet; - } + { + HypothesesSet* aSet = *hypoSet; + if ( aSet && aSet->HypoSetName == theSetName ) + return aSet; + } return 0; } - HypothesisData* GetHypothesisData (const char* aHypType) + HypothesisData* GetHypothesisData (const QString& aHypType) { HypothesisData* aHypData = 0; // Init list of available hypotheses, if needed InitAvailableHypotheses(); - THypothesisDataMap::iterator type_data = myHypothesesMap.find(aHypType); + THypothesisDataMap::iterator type_data = myHypothesesMap.find(aHypType.toLatin1().data()); if (type_data != myHypothesesMap.end()) { aHypData = type_data->second; } else { - type_data = myAlgorithmsMap.find(aHypType); + type_data = myAlgorithmsMap.find(aHypType.toLatin1().data()); if (type_data != myAlgorithmsMap.end()) aHypData = type_data->second; } @@ -320,15 +315,15 @@ namespace SMESH{ return false; } - SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator(const char* aHypType) + SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator(const QString& aHypType) { - if(MYDEBUG) MESSAGE("Get HypothesisCreator for " << aHypType); + if(MYDEBUG) MESSAGE("Get HypothesisCreator for " << aHypType.toLatin1().data()); SMESHGUI_GenericHypothesisCreator* aCreator = 0; // check, if creator for this hypothesis type already exists - if (myHypCreatorMap.find(aHypType) != myHypCreatorMap.end()) { - aCreator = myHypCreatorMap[aHypType]; + if (myHypCreatorMap.find(aHypType.toLatin1().data()) != myHypCreatorMap.end()) { + aCreator = myHypCreatorMap[aHypType.toLatin1().data()]; } else { // 1. Init list of available hypotheses, if needed @@ -345,18 +340,18 @@ namespace SMESH{ try { // load plugin library if(MYDEBUG) MESSAGE("Loading client meshers plugin library ..."); - LibHandle libHandle = LoadLib( aClientLibName ); + LibHandle libHandle = LoadLib( aClientLibName.toLatin1().data() ); if (!libHandle) { // report any error, if occured - if ( MYDEBUG ) - { + if ( MYDEBUG ) + { #ifdef WIN32 - const char* anError = "Can't load client meshers plugin library"; + const char* anError = "Can't load client meshers plugin library"; #else - const char* anError = dlerror(); + const char* anError = dlerror(); #endif - MESSAGE(anError); - } + MESSAGE(anError); + } } else { // get method, returning hypothesis creator @@ -371,14 +366,14 @@ namespace SMESH{ } else { // get hypothesis creator - if(MYDEBUG) MESSAGE("Get Hypothesis Creator for " << aHypType); + if(MYDEBUG) MESSAGE("Get Hypothesis Creator for " << aHypType.toLatin1().data()); aCreator = procHandle( aHypType ); if (!aCreator) { if(MYDEBUG) MESSAGE("no such a hypothesis in this plugin"); } else { // map hypothesis creator to a hypothesis name - myHypCreatorMap[aHypType] = aCreator; + myHypCreatorMap[aHypType.toLatin1().data()] = aCreator; } } } @@ -392,20 +387,22 @@ namespace SMESH{ } - SMESH::SMESH_Hypothesis_ptr CreateHypothesis(const char* aHypType, - const char* aHypName, + SMESH::SMESH_Hypothesis_ptr CreateHypothesis(const QString& aHypType, + const QString& aHypName, const bool isAlgo) { - if(MYDEBUG) MESSAGE("Create " << aHypType << " with name " << aHypName); + if(MYDEBUG) MESSAGE("Create " << aHypType.toLatin1().data() << + " with name " << aHypName.toLatin1().data()); HypothesisData* aHypData = GetHypothesisData(aHypType); QString aServLib = aHypData->ServerLibName; try { SMESH::SMESH_Hypothesis_var aHypothesis; - aHypothesis = SMESHGUI::GetSMESHGen()->CreateHypothesis(aHypType, aServLib); + aHypothesis = SMESHGUI::GetSMESHGen()->CreateHypothesis(aHypType.toLatin1().data(), + aServLib.toLatin1().data()); if (!aHypothesis->_is_nil()) { _PTR(SObject) aHypSObject = SMESH::FindSObject(aHypothesis.in()); if (aHypSObject) { - if (strlen(aHypName) > 0) + if (!aHypName.isEmpty()) SMESH::SetName(aHypSObject, aHypName); SMESHGUI::GetSMESHGUI()->updateObjBrowser(); return aHypothesis._retn(); @@ -505,29 +502,29 @@ namespace SMESH{ _PTR(Study) aStudy = GetActiveStudyDocument(); _PTR(SObject) aHypObj = aStudy->FindObjectID( IObject->getEntry() ); if( aHypObj ) - { - _PTR(SObject) MorSM = SMESH::GetMeshOrSubmesh( aHypObj ); - _PTR(SObject) aRealHypo; - if( aHypObj->ReferencedObject( aRealHypo ) ) - { - SMESH_Hypothesis_var hypo = SMESH_Hypothesis::_narrow( SObjectToObject( aRealHypo ) ); - RemoveHypothesisOrAlgorithmOnMesh( MorSM, hypo ); - } - else { - SMESH_Hypothesis_var hypo = SMESH_Hypothesis::_narrow( SObjectToObject( aHypObj ) ); - SObjectList meshList = GetMeshesUsingAlgoOrHypothesis( hypo ); - for( int i = 0; i < meshList.size(); i++ ) - RemoveHypothesisOrAlgorithmOnMesh( meshList[ i ], hypo ); + _PTR(SObject) MorSM = SMESH::GetMeshOrSubmesh( aHypObj ); + _PTR(SObject) aRealHypo; + if( aHypObj->ReferencedObject( aRealHypo ) ) + { + SMESH_Hypothesis_var hypo = SMESH_Hypothesis::_narrow( SObjectToObject( aRealHypo ) ); + RemoveHypothesisOrAlgorithmOnMesh( MorSM, hypo ); + } + else + { + SMESH_Hypothesis_var hypo = SMESH_Hypothesis::_narrow( SObjectToObject( aHypObj ) ); + SObjectList meshList = GetMeshesUsingAlgoOrHypothesis( hypo ); + for( int i = 0; i < meshList.size(); i++ ) + RemoveHypothesisOrAlgorithmOnMesh( meshList[ i ], hypo ); + } } - } } catch(const SALOME::SALOME_Exception& S_ex) - { - wc.suspend(); - SalomeApp_Tools::QtCatchCorbaException(S_ex); - res = SMESH::HYP_UNKNOWN_FATAL; - } + { + wc.suspend(); + SalomeApp_Tools::QtCatchCorbaException(S_ex); + res = SMESH::HYP_UNKNOWN_FATAL; + } return res < SMESH::HYP_UNKNOWN_FATAL; } @@ -649,5 +646,4 @@ namespace SMESH{ } return resMsg; } - -} +} // end of namespace SMESH diff --git a/src/SMESHGUI/SMESHGUI_HypothesesUtils.h b/src/SMESHGUI/SMESHGUI_HypothesesUtils.h index 42172d76b..ae27696a2 100644 --- a/src/SMESHGUI/SMESHGUI_HypothesesUtils.h +++ b/src/SMESHGUI/SMESHGUI_HypothesesUtils.h @@ -1,46 +1,49 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 CEA -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 CEA +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_HypothesesUtils.h +// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. // -// File : SMESHGUI_HypothesesUtils.h -// Author : Julia DOROVSKIKH -// Module : SMESH -// $Header$ -#ifndef SMESHGUI_HypothesesUtils_HeaderFile -#define SMESHGUI_HypothesesUtils_HeaderFile +#ifndef SMESHGUI_HYPOTHESESUTILS_H +#define SMESHGUI_HYPOTHESESUTILS_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include -#include +// Qt includes +#include +#include + +// SALOME GUI includes +#include -#include "SALOME_InteractiveObject.hxx" -#include "SALOMEDSClient_definitions.hxx" +// SALOME KERNEL includes +#include -#include "SALOMEconfig.h" -#include CORBA_CLIENT_HEADER(SALOMEDS) +// IDL includes +#include #include CORBA_SERVER_HEADER(SMESH_Mesh) #include CORBA_SERVER_HEADER(SMESH_Hypothesis) +// STL includes #include class HypothesisData; @@ -49,60 +52,60 @@ class SMESHGUI_GenericHypothesisCreator; class SALOMEDSClient_SObject; class algo_error_array; -namespace SMESH{ - +namespace SMESH +{ SMESHGUI_EXPORT void InitAvailableHypotheses(); SMESHGUI_EXPORT - QStringList GetAvailableHypotheses( const bool isAlgo, - const int theDim = -1, - const bool isAux = false, - const bool isNeedGeometry = true); + QStringList GetAvailableHypotheses( const bool, + const int = -1, + const bool = false, + const bool = true); SMESHGUI_EXPORT QStringList GetHypothesesSets(); SMESHGUI_EXPORT - HypothesesSet* GetHypothesesSet(const QString theSetName); + HypothesesSet* GetHypothesesSet( const QString& ); SMESHGUI_EXPORT - HypothesisData* GetHypothesisData(const char* aHypType); + HypothesisData* GetHypothesisData( const QString& ); SMESHGUI_EXPORT - bool IsAvailableHypothesis(const HypothesisData* algoData, - const QString& hypType, - bool& isOptional); + bool IsAvailableHypothesis( const HypothesisData*, + const QString&, + bool& ); SMESHGUI_EXPORT - bool IsCompatibleAlgorithm(const HypothesisData* algo1Data, - const HypothesisData* algo2Data); + bool IsCompatibleAlgorithm( const HypothesisData*, + const HypothesisData* ); SMESHGUI_EXPORT - SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator(const char* aHypType); + SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator( const QString& ); SMESHGUI_EXPORT - SMESH::SMESH_Hypothesis_ptr CreateHypothesis(const char* aHypType, - const char* aHypName, - const bool isAlgo = false); + SMESH::SMESH_Hypothesis_ptr CreateHypothesis( const QString&, + const QString&, + const bool = false); SMESHGUI_EXPORT - bool AddHypothesisOnMesh(SMESH::SMESH_Mesh_ptr aMesh, SMESH::SMESH_Hypothesis_ptr aHyp); + bool AddHypothesisOnMesh( SMESH::SMESH_Mesh_ptr, SMESH::SMESH_Hypothesis_ptr ); SMESHGUI_EXPORT - bool AddHypothesisOnSubMesh(SMESH::SMESH_subMesh_ptr aSubMesh, SMESH::SMESH_Hypothesis_ptr aHyp); + bool AddHypothesisOnSubMesh( SMESH::SMESH_subMesh_ptr, SMESH::SMESH_Hypothesis_ptr ); SMESHGUI_EXPORT - bool RemoveHypothesisOrAlgorithmOnMesh(const Handle(SALOME_InteractiveObject)& IObject); + bool RemoveHypothesisOrAlgorithmOnMesh( const Handle(SALOME_InteractiveObject)& ); SMESHGUI_EXPORT - bool RemoveHypothesisOrAlgorithmOnMesh(_PTR(SObject) MorSM, - SMESH::SMESH_Hypothesis_ptr anHyp); + bool RemoveHypothesisOrAlgorithmOnMesh( _PTR(SObject), + SMESH::SMESH_Hypothesis_ptr ); typedef std::vector<_PTR(SObject)> SObjectList; - SObjectList GetMeshesUsingAlgoOrHypothesis(SMESH::SMESH_Hypothesis_ptr AlgoOrHyp ) ; + SObjectList GetMeshesUsingAlgoOrHypothesis( SMESH::SMESH_Hypothesis_ptr ); SMESHGUI_EXPORT - QString GetMessageOnAlgoStateErrors(const algo_error_array& errors); + QString GetMessageOnAlgoStateErrors( const algo_error_array& ); } -#endif +#endif // SMESHGUI_HYPOTHESESUTILS_H diff --git a/src/SMESHGUI/SMESHGUI_IdValidator.h b/src/SMESHGUI/SMESHGUI_IdValidator.h index d5c5c8060..f7ec15aa0 100644 --- a/src/SMESHGUI/SMESHGUI_IdValidator.h +++ b/src/SMESHGUI/SMESHGUI_IdValidator.h @@ -1,70 +1,69 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 CEA -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 CEA +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_IdValidator.h +// Author : Edward AGAPOV, Open CASCADE S.A.S. // -// File : SMESHGUI_IdValidator.h -// Author : Edward AGAPOV -// Module : SMESH -// $Header: /dn05/salome/PAL/SMESH/SMESH_SRC/src/SMESHGUI/SMESHGUI_IdValidator.h -#ifndef SMESHGUI_IdValidator_HeaderFile -#define SMESHGUI_IdValidator_HeaderFile +#ifndef SMESHGUI_IDVALIDATOR_H +#define SMESHGUI_IDVALIDATOR_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include +// Qt includes +#include // validator for manual input of Ids -class SMESHGUI_EXPORT SMESHGUI_IdValidator: public QValidator +class SMESHGUI_EXPORT SMESHGUI_IdValidator : public QValidator { - public: - - SMESHGUI_IdValidator(QWidget * parent, const char * name = 0, const int maxNbId = 0): - QValidator(parent,name), myMaxNbId(maxNbId) {} +public: + SMESHGUI_IdValidator( QWidget* parent, const int maxNbId = 0 ) : + QValidator( parent ), myMaxNbId( maxNbId ) {} - State validate ( QString & text, int & pos) const + State validate( QString& input, int& pos ) const { - text.replace( QRegExp(" *[^0-9]+ *"), " " ); - if ( myMaxNbId && text.length() > myMaxNbId) { // truncate extra ids + input.replace( QRegExp(" *[^0-9]+ *"), " " ); + if ( myMaxNbId && input.length() > myMaxNbId ) { + // truncate extra ids int ind = 0, nbId = 0; - while ( ind < text.length() ) { - if ( text.at( ind ) != ' ' ) { + while ( ind < input.length() ) { + if ( input.at( ind ) != ' ' ) { if ( ++nbId > myMaxNbId ) { - text.truncate( ind ); + input.truncate( ind ); break; } - ind = text.find( ' ', ind ); + ind = input.indexOf( ' ', ind ); if ( ind < 0 ) break; } ind++; } } - if ( pos > text.length() ) - pos = text.length(); + if ( pos > input.length() ) + pos = input.length(); return Acceptable; } - private: +private: int myMaxNbId; }; -#endif +#endif // SMESHGUI_IDVALIDATOR_H diff --git a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx index c31fc078a..ddc62504c 100644 --- a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx @@ -1,92 +1,83 @@ -// SMESH SMESHGUI : GUI for SMESH component +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_MakeNodeAtPointDlg.cxx +// Author : Edward AGAPOV, Open CASCADE S.A.S. // -// -// File : SMESHGUI_MakeNodeAtPointDlg.cxx -// Author : Edward AGAPOV -// Module : SMESH +// SMESH includes #include "SMESHGUI_MakeNodeAtPointDlg.h" #include "SMESHGUI.h" -#include "SMESHGUI_GEOMGenUtils.h" #include "SMESHGUI_IdValidator.h" #include "SMESHGUI_MeshUtils.h" -#include "SMESHGUI_Utils.h" #include "SMESHGUI_VTKUtils.h" #include "SMESHGUI_SpinBox.h" #include "SMESHGUI_MeshEditPreview.h" -#include "SMDS_Mesh.hxx" -#include "SMDS_MeshNode.hxx" -#include "SMESH_Actor.h" -#include "SMESH_ActorUtils.h" -#include "SMESH_NumberFilter.hxx" -#include "SMESH_LogicalFilter.hxx" - -#include "GEOMBase.h" -#include "GeometryGUI.h" - -#include "LightApp_DataOwner.h" -#include "LightApp_SelectionMgr.h" -#include "SALOMEDSClient_SObject.hxx" -#include "SALOME_ListIO.hxx" -#include "SUIT_Desktop.h" -#include "SVTK_Selector.h" -#include "SVTK_ViewWindow.h" -#include "SVTK_ViewModel.h" -#include "SalomeApp_Tools.h" -#include "SalomeApp_TypeFilter.h" -#include "SUIT_ResourceMgr.h" -#include "SUIT_OverrideCursor.h" -#include "SUIT_MessageBox.h" - -// OCCT Includes +#include +#include +#include +#include +#include + +// SALOME GEOM includes +#include + +// SALOME GUI includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// OCCT includes #include #include #include - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - +#include + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// VTK includes #include -// IDL Headers +// IDL includes #include #include CORBA_SERVER_HEADER(SMESH_Mesh) #include CORBA_SERVER_HEADER(SMESH_MeshEditor) -#define SPACING 5 -#define MARGIN 10 +#define SPACING 6 +#define MARGIN 11 /*! * \brief Dialog to publish a sub-shape of the mesh main shape @@ -95,11 +86,13 @@ SMESHGUI_MakeNodeAtPointDlg::SMESHGUI_MakeNodeAtPointDlg() : SMESHGUI_Dialog( 0, false, true ) { - setCaption(tr("CAPTION")); + setWindowTitle(tr("CAPTION")); - QVBoxLayout* aDlgLay = new QVBoxLayout (mainFrame(), MARGIN, SPACING); + QVBoxLayout* aDlgLay = new QVBoxLayout (mainFrame()); + aDlgLay->setMargin(MARGIN);; + aDlgLay->setSpacing(SPACING); - QFrame* aMainFrame = createMainFrame (mainFrame()); + QWidget* aMainFrame = createMainFrame (mainFrame()); aDlgLay->addWidget(aMainFrame); @@ -110,9 +103,9 @@ SMESHGUI_MakeNodeAtPointDlg::SMESHGUI_MakeNodeAtPointDlg() // function : createMainFrame() // purpose : Create frame containing dialog's input fields //======================================================================= -QFrame* SMESHGUI_MakeNodeAtPointDlg::createMainFrame (QWidget* theParent) +QWidget* SMESHGUI_MakeNodeAtPointDlg::createMainFrame (QWidget* theParent) { - QFrame* aFrame = new QFrame(theParent); + QWidget* aFrame = new QWidget(theParent); SUIT_ResourceMgr* rm = SMESH::GetResourceMgr( SMESHGUI::GetSMESHGUI() ); QPixmap iconMoveNode (rm->loadPixmap("SMESH", tr("ICON_DLG_MOVE_NODE"))); @@ -120,69 +113,83 @@ QFrame* SMESHGUI_MakeNodeAtPointDlg::createMainFrame (QWidget* theParent) // constructor - QButtonGroup* aPixGrp = new QButtonGroup(1, Qt::Vertical, tr("MESH_PASS_THROUGH_POINT"), aFrame); - aPixGrp->setExclusive(TRUE); + QGroupBox* aPixGrp = new QGroupBox(tr("MESH_PASS_THROUGH_POINT"), aFrame); + QHBoxLayout* aPixGrpLayout = new QHBoxLayout(aPixGrp); + aPixGrpLayout->setMargin(MARGIN); + aPixGrpLayout->setSpacing(SPACING); + QRadioButton* aRBut = new QRadioButton(aPixGrp); - aRBut->setPixmap(iconMoveNode); - aRBut->setChecked(TRUE); + aRBut->setIcon(iconMoveNode); + aRBut->setChecked(true); + aPixGrpLayout->addWidget(aRBut); // coordinates - QGroupBox* aCoordGrp = new QGroupBox(1, Qt::Vertical, tr("SMESH_COORDINATES"), aFrame); + QGroupBox* aCoordGrp = new QGroupBox(tr("SMESH_COORDINATES"), aFrame); + QHBoxLayout* aCoordGrpLayout = new QHBoxLayout(aCoordGrp); + aCoordGrpLayout->setMargin(MARGIN); + aCoordGrpLayout->setSpacing(SPACING); + myCoordBtn = new QPushButton(aCoordGrp); - myCoordBtn->setPixmap(iconSelect); - myCoordBtn->setToggleButton(TRUE); + myCoordBtn->setIcon(iconSelect); + myCoordBtn->setCheckable(true); QLabel* aXLabel = new QLabel(tr("SMESH_X"), aCoordGrp); - aXLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); myX = new SMESHGUI_SpinBox(aCoordGrp); QLabel* aYLabel = new QLabel(tr("SMESH_Y"), aCoordGrp); - //aYLabel->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); - aYLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); myY = new SMESHGUI_SpinBox(aCoordGrp); QLabel* aZLabel = new QLabel(tr("SMESH_Z"), aCoordGrp); - //aZLabel->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); - aZLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); myZ = new SMESHGUI_SpinBox(aCoordGrp); myX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); myY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); myZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); + aCoordGrpLayout->addWidget(myCoordBtn); + aCoordGrpLayout->addWidget(aXLabel); + aCoordGrpLayout->addWidget(myX); + aCoordGrpLayout->addWidget(aYLabel); + aCoordGrpLayout->addWidget(myY); + aCoordGrpLayout->addWidget(aZLabel); + aCoordGrpLayout->addWidget(myZ); + // Method selection - QButtonGroup* aMethodGrp = new QButtonGroup(1, Qt::Vertical, tr("METHOD"), aFrame); - aMethodGrp->setExclusive(TRUE); + QGroupBox* aMethodGrp = new QGroupBox(tr("METHOD"), aFrame); + QHBoxLayout* aMethodGrpLayout = new QHBoxLayout(aMethodGrp); + aMethodGrpLayout->setMargin(MARGIN); + aMethodGrpLayout->setSpacing(SPACING); + myMoveRBtn = new QRadioButton(tr("MOVE_EXISTING_METHOD"), aMethodGrp); myCreateRBtn = new QRadioButton(tr("CREATE_NEW_METHOD"), aMethodGrp); + aMethodGrpLayout->addWidget(myMoveRBtn); + aMethodGrpLayout->addWidget(myCreateRBtn); + // node ID - myNodeToMoveGrp = new QGroupBox(tr("NODE_2MOVE"), aFrame, "anIdGrp"); + myNodeToMoveGrp = new QGroupBox(tr("NODE_2MOVE"), aFrame); - QLabel* idLabel = new QLabel(tr("NODE_2MOVE_ID"), myNodeToMoveGrp, "idLabel"); + QLabel* idLabel = new QLabel(tr("NODE_2MOVE_ID"), myNodeToMoveGrp); myIdBtn = new QPushButton(myNodeToMoveGrp); - myIdBtn->setPixmap(iconSelect); - myIdBtn->setToggleButton(TRUE); - myId = new QLineEdit(myNodeToMoveGrp,"myId"); - myId->setValidator(new SMESHGUI_IdValidator(this, "validator", 1)); - myAutoSearchChkBox = new QCheckBox( tr("AUTO_SEARCH"), myNodeToMoveGrp, "myAutoSearchChkBox"); - myPreviewChkBox = new QCheckBox( tr("PREVIEW"), myNodeToMoveGrp, "myPreviewChkBox"); - - myNodeToMoveGrp->setColumnLayout(0, Qt::Vertical); - myNodeToMoveGrp->layout()->setSpacing(0); - myNodeToMoveGrp->layout()->setMargin(0); - QGridLayout* myNodeToMoveGrpLayout = new QGridLayout(myNodeToMoveGrp->layout()); - myNodeToMoveGrpLayout->setAlignment(Qt::AlignTop); + myIdBtn->setIcon(iconSelect); + myIdBtn->setCheckable(true); + myId = new QLineEdit(myNodeToMoveGrp); + myId->setValidator(new SMESHGUI_IdValidator(this, 1)); + myAutoSearchChkBox = new QCheckBox( tr("AUTO_SEARCH"), myNodeToMoveGrp); + myPreviewChkBox = new QCheckBox( tr("PREVIEW"), myNodeToMoveGrp); + + QGridLayout* myNodeToMoveGrpLayout = new QGridLayout(myNodeToMoveGrp); myNodeToMoveGrpLayout->setSpacing(SPACING); myNodeToMoveGrpLayout->setMargin(MARGIN); + myNodeToMoveGrpLayout->addWidget( idLabel, 0, 0 ); myNodeToMoveGrpLayout->addWidget( myIdBtn, 0, 1 ); myNodeToMoveGrpLayout->addWidget( myId, 0, 2 ); - myNodeToMoveGrpLayout->addMultiCellWidget( myAutoSearchChkBox, 1, 1, 0, 2 ); - myNodeToMoveGrpLayout->addMultiCellWidget( myPreviewChkBox, 2, 2, 0, 2 ); + myNodeToMoveGrpLayout->addWidget( myAutoSearchChkBox, 1, 0, 1, 3 ); + myNodeToMoveGrpLayout->addWidget( myPreviewChkBox, 2, 0, 1, 3 ); QVBoxLayout* aLay = new QVBoxLayout(aFrame); aLay->addWidget(aPixGrp); @@ -196,9 +203,9 @@ QFrame* SMESHGUI_MakeNodeAtPointDlg::createMainFrame (QWidget* theParent) connect(myIdBtn, SIGNAL (toggled(bool)), this, SLOT(ButtonToggled(bool))); connect(myAutoSearchChkBox, SIGNAL (toggled(bool)), this, SLOT(ButtonToggled(bool))); - myMoveRBtn->setChecked(TRUE); - myIdBtn->setOn(TRUE); - myAutoSearchChkBox->setChecked(TRUE); + myMoveRBtn->setChecked(true); + myIdBtn->setDown(true); + myAutoSearchChkBox->setChecked(true); return aFrame; } @@ -217,34 +224,34 @@ void SMESHGUI_MakeNodeAtPointDlg::ButtonToggled (bool on) if ( aSender == myCoordBtn ) // button to set coord by node selection { if ( myIdBtn->isEnabled() ) - myIdBtn->setOn( !on ); + myIdBtn->setDown( !on ); } else if ( aSender == myIdBtn ) // button to select a node to move { - myCoordBtn->setOn( !on ); + myCoordBtn->setDown( !on ); } else if ( aSender == myMoveRBtn ) // move node method { - myNodeToMoveGrp->setEnabled( TRUE ); + myNodeToMoveGrp->setEnabled( true ); } else if ( aSender == myCreateRBtn ) // create node method { - myNodeToMoveGrp->setEnabled( FALSE ); - myCoordBtn->setOn( TRUE ); + myNodeToMoveGrp->setEnabled( false ); + myCoordBtn->setDown( true ); } } if ( aSender == myAutoSearchChkBox ) // automatic node search { if ( on ) { myId->setText(""); - myId->setReadOnly ( TRUE ); - myIdBtn->setOn( FALSE ); - myIdBtn->setEnabled( FALSE ); - myCoordBtn->setOn( TRUE ); + myId->setReadOnly ( true ); + myIdBtn->setDown( false ); + myIdBtn->setEnabled( false ); + myCoordBtn->setDown( true ); } else { - myId->setReadOnly ( FALSE ); - myIdBtn->setEnabled( TRUE ); + myId->setReadOnly ( false ); + myIdBtn->setEnabled( true ); } } } @@ -297,7 +304,7 @@ void SMESHGUI_MakeNodeAtPointOp::startOperation() // SalomeApp_TypeFilter depends on a current study if ( myFilter ) delete myFilter; - QPtrList filters; + QList filters; filters.append( new SalomeApp_TypeFilter((SalomeApp_Study*)study(), "SMESH" )); TColStd_MapOfInteger vertexType; vertexType.Add( TopAbs_VERTEX ); @@ -355,15 +362,15 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply() return false; if ( !myMeshActor ) { - SUIT_MessageBox::warn1( dlg(), tr( "SMESH_WRN_WARNING" ), - tr("INVALID_MESH"), tr( "SMESH_BUT_OK" ) ); + SUIT_MessageBox::warning( dlg(), tr( "SMESH_WRN_WARNING" ), + tr("INVALID_MESH") ); dlg()->show(); return false; } if ( !isValid() ) { // node id is invalid - SUIT_MessageBox::warn1( dlg(), tr( "SMESH_WRN_WARNING" ), - tr("INVALID_ID"), tr( "SMESH_BUT_OK" ) ); + SUIT_MessageBox::warning( dlg(), tr( "SMESH_WRN_WARNING" ), + tr("INVALID_ID") ); dlg()->show(); return false; } @@ -372,8 +379,8 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply() try { SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(myMeshActor->getIO()); if (aMesh->_is_nil()) { - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"), - tr("SMESHG_NO_MESH"), QMessageBox::Ok); + SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"), + tr("SMESHG_NO_MESH") ); return true; } SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor(); @@ -381,7 +388,7 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply() return true; int aResult = 0; - if ( myDlg->myCreateRBtn->isOn() ) + if ( myDlg->myCreateRBtn->isDown() ) { aResult = aMeshEditor->AddNode(myDlg->myX->GetValue(), myDlg->myY->GetValue(), @@ -426,7 +433,7 @@ bool SMESHGUI_MakeNodeAtPointOp::isValid() bool ok = true; if ( myMeshActor && - myDlg->myMoveRBtn->isOn() && + myDlg->myMoveRBtn->isDown() && !myDlg->myAutoSearchChkBox->isChecked() ) { ok = false; @@ -446,7 +453,7 @@ bool SMESHGUI_MakeNodeAtPointOp::isValid() void SMESHGUI_MakeNodeAtPointOp::onSelectionDone() { - if ( !myDlg->isShown() || !myDlg->isEnabled() ) + if ( !myDlg->isVisible() || !myDlg->isEnabled() ) return; try { SALOME_ListIO aList; @@ -457,7 +464,7 @@ void SMESHGUI_MakeNodeAtPointOp::onSelectionDone() SMESH_Actor* aMeshActor = SMESH::FindActorByEntry(anIO->getEntry()); if (!aMeshActor) { // coord by geom - if ( myDlg->myCoordBtn->isOn() ) { + if ( myDlg->myCoordBtn->isDown() ) { GEOM::GEOM_Object_var geom = SMESH::IObjectToInterface(anIO); if ( !geom->_is_nil() ) { TopoDS_Vertex aShape; @@ -485,14 +492,14 @@ void SMESHGUI_MakeNodeAtPointOp::onSelectionDone() if (SMDS_Mesh* aMesh = aMeshActor->GetObject()->GetMesh()) { if (const SMDS_MeshNode* aNode = aMesh->FindNode(aString.toInt())) { myNoPreview = true; - if ( myDlg->myCoordBtn->isOn() ) { // set coord + if ( myDlg->myCoordBtn->isDown() ) { // set coord myDlg->myX->SetValue(aNode->X()); myDlg->myY->SetValue(aNode->Y()); myDlg->myZ->SetValue(aNode->Z()); myNoPreview = false; redisplayPreview(); } - else if ( myDlg->myIdBtn->isOn() && + else if ( myDlg->myIdBtn->isDown() && myDlg->myIdBtn->isEnabled() ) { // set node to move myDlg->myId->setText(aString); myNoPreview = false; @@ -520,7 +527,7 @@ void SMESHGUI_MakeNodeAtPointOp::redisplayPreview() SMESH::MeshPreviewStruct_var aMeshPreviewStruct; bool moveShown = false; - if ( myDlg->myMoveRBtn->isOn() && // Move method + if ( myDlg->myMoveRBtn->isDown() && // Move method myMeshActor) { const bool autoSearch = myDlg->myAutoSearchChkBox->isChecked(); diff --git a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.h b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.h index 6751b6fc1..5da7f3ad0 100644 --- a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.h +++ b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.h @@ -1,55 +1,48 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_MakeNodeAtPointDlg.h +// Author : Edward AGAPOV, Open CASCADE S.A.S. // -// -// File : SMESHGUI_MakeNodeAtPointDlg.h -// Author : Edward AGAPOV -// Module : SMESH +#ifndef SMESHGUI_MAKENODEATPOINTDLG_H +#define SMESHGUI_MAKENODEATPOINTDLG_H -#ifndef SMESHGUI_MakeNodeAtPointDlg_H -#define SMESHGUI_MakeNodeAtPointDlg_H +// SMESH includes +#include "SMESH_SMESHGUI.hxx" #include "SMESHGUI_Dialog.h" #include "SMESHGUI_SelectionOp.h" -#include "VTKViewer.h" - -class QFrame; +class QGroupBox; class QLineEdit; class QPushButton; -class LightApp_SelectionMgr; -class SVTK_ViewWindow; -class QButtonGroup; -class SMESHGUI; class QCheckBox; class QRadioButton; class SMESHGUI_SpinBox; -class SALOME_Actor; class SMESHGUI_MeshEditPreview; class SMESHGUI_MakeNodeAtPointDlg; /*! * \brief Operation to make a mesh pass through a point */ -class SMESHGUI_MakeNodeAtPointOp: public SMESHGUI_SelectionOp +class SMESHGUI_EXPORT SMESHGUI_MakeNodeAtPointOp: public SMESHGUI_SelectionOp { Q_OBJECT @@ -72,12 +65,10 @@ protected slots: virtual bool onApply(); private slots: - void onSelectionDone(); void redisplayPreview(); private: - SMESHGUI_MakeNodeAtPointDlg* myDlg; SUIT_SelectionFilter* myFilter; @@ -85,40 +76,40 @@ private: SMESHGUI_MeshEditPreview* mySimulation; SMESH_Actor* myMeshActor; bool myNoPreview; - }; /*! * \brief Dialog to make a mesh pass through a point */ -class SMESHGUI_MakeNodeAtPointDlg : public SMESHGUI_Dialog +class SMESHGUI_EXPORT SMESHGUI_MakeNodeAtPointDlg : public SMESHGUI_Dialog { Q_OBJECT public: - SMESHGUI_MakeNodeAtPointDlg(); + SMESHGUI_MakeNodeAtPointDlg(); private: - - QFrame* createMainFrame (QWidget*); - - QPushButton* myCoordBtn; - SMESHGUI_SpinBox *myX, *myY, *myZ; - QRadioButton *myMoveRBtn, *myCreateRBtn; - QGroupBox* myNodeToMoveGrp; - QPushButton* myIdBtn; - QLineEdit* myId; - QCheckBox* myAutoSearchChkBox; - QCheckBox* myPreviewChkBox; - - QString myHelpFileName; + QWidget* createMainFrame( QWidget* ); + + QPushButton* myCoordBtn; + SMESHGUI_SpinBox* myX; + SMESHGUI_SpinBox* myY; + SMESHGUI_SpinBox* myZ; + QRadioButton* myMoveRBtn; + QRadioButton* myCreateRBtn; + QGroupBox* myNodeToMoveGrp; + QPushButton* myIdBtn; + QLineEdit* myId; + QCheckBox* myAutoSearchChkBox; + QCheckBox* myPreviewChkBox; + + QString myHelpFileName; friend class SMESHGUI_MakeNodeAtPointOp; private slots: - - void ButtonToggled (bool); + void ButtonToggled( bool ); }; -#endif +#endif // SMESHGUI_MAKENODEATPOINTDLG_H diff --git a/src/SMESHGUI/SMESHGUI_MergeNodesDlg.cxx b/src/SMESHGUI/SMESHGUI_MergeNodesDlg.cxx deleted file mode 100644 index 45f754f52..000000000 --- a/src/SMESHGUI/SMESHGUI_MergeNodesDlg.cxx +++ /dev/null @@ -1,786 +0,0 @@ -// SMESH SMESHGUI : GUI for SMESH component -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SMESHGUI_MergeNodesDlg.cxx -// Author : Michael ZORIN -// Module : SMESH -// $Header: - -#include "SMESHGUI_MergeNodesDlg.h" - -#include "SMESHGUI.h" -#include "SMESHGUI_Utils.h" -#include "SMESHGUI_VTKUtils.h" -#include "SMESHGUI_IdValidator.h" -#include "SMESHGUI_SpinBox.h" - -#include "SMESH_Actor.h" -#include "SMESH_TypeFilter.hxx" -#include "SMESH_LogicalFilter.hxx" -#include "SMESHGUI_MeshUtils.h" -#include "SMDS_Mesh.hxx" - -#include "GEOMBase.h" - -#include "SUIT_ResourceMgr.h" -#include "SUIT_Session.h" -#include "SUIT_MessageBox.h" - -#include "LightApp_Application.h" - -#include "SVTK_ViewModel.h" -#include "SVTK_ViewWindow.h" -#include "SVTK_Selector.h" -#include "SVTK_Selection.h" -#include "SALOME_ListIO.hxx" - -#include "utilities.h" - -// OCCT Includes -#include - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//IDL Headers -#include CORBA_SERVER_HEADER(SMESH_Group) - -using namespace std; - -//================================================================================= -// class : SMESHGUI_MergeNodesDlg() -// purpose : -//================================================================================= -SMESHGUI_MergeNodesDlg::SMESHGUI_MergeNodesDlg( SMESHGUI* theModule, const char* name, - bool modal, WFlags fl) - : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | - WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose), - mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) -{ - QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_MERGE_NODES"))); - QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT"))); - - if (!name) - setName("SMESHGUI_MergeNodesDlg"); - resize(303, 185); - setCaption(tr("SMESH_MERGE_NODES")); - setSizeGripEnabled(TRUE); - SMESHGUI_MergeNodesDlgLayout = new QGridLayout(this); - SMESHGUI_MergeNodesDlgLayout->setSpacing(6); - SMESHGUI_MergeNodesDlgLayout->setMargin(11); - - /***************************************************************/ - GroupConstructors = new QButtonGroup(this, "GroupConstructors"); - GroupConstructors->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)5, - (QSizePolicy::SizeType)0, 0, 0, - GroupConstructors->sizePolicy().hasHeightForWidth())); - GroupConstructors->setTitle(tr("SMESH_MERGE_NODES" )); - GroupConstructors->setExclusive(TRUE); - GroupConstructors->setColumnLayout(0, Qt::Vertical); - GroupConstructors->layout()->setSpacing(0); - GroupConstructors->layout()->setMargin(0); - GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout()); - GroupConstructorsLayout->setAlignment(Qt::AlignTop); - GroupConstructorsLayout->setSpacing(6); - GroupConstructorsLayout->setMargin(11); - QHBoxLayout* RBLayout = new QHBoxLayout(0, 0, 6, "Layout2"); - RadioButton1= new QRadioButton(GroupConstructors, "RadioButton1"); - RadioButton1->setText(tr("" )); - RadioButton1->setPixmap(image0); - RBLayout->addWidget(RadioButton1); - GroupConstructorsLayout->addLayout(RBLayout, 0, 0); - SMESHGUI_MergeNodesDlgLayout->addWidget(GroupConstructors, 0, 0); - - /***************************************************************/ - GroupButtons = new QGroupBox(this, "GroupButtons"); - GroupButtons->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)7, - (QSizePolicy::SizeType)0, 0, 0, - GroupButtons->sizePolicy().hasHeightForWidth())); - GroupButtons->setGeometry(QRect(10, 10, 281, 48)); - GroupButtons->setTitle(tr("" )); - GroupButtons->setColumnLayout(0, Qt::Vertical); - GroupButtons->layout()->setSpacing(0); - GroupButtons->layout()->setMargin(0); - GroupButtonsLayout = new QGridLayout(GroupButtons->layout()); - GroupButtonsLayout->setAlignment(Qt::AlignTop); - GroupButtonsLayout->setSpacing(6); - GroupButtonsLayout->setMargin(11); - buttonHelp = new QPushButton(GroupButtons, "buttonHelp"); - buttonHelp->setText(tr("SMESH_BUT_HELP" )); - buttonHelp->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonHelp, 0, 4); - buttonCancel = new QPushButton(GroupButtons, "buttonCancel"); - buttonCancel->setText(tr("SMESH_BUT_CLOSE" )); - buttonCancel->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonCancel, 0, 3); - buttonApply = new QPushButton(GroupButtons, "buttonApply"); - buttonApply->setText(tr("SMESH_BUT_APPLY" )); - buttonApply->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonApply, 0, 1); - QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - GroupButtonsLayout->addItem(spacer_9, 0, 2); - buttonOk = new QPushButton(GroupButtons, "buttonOk"); - buttonOk->setText(tr("SMESH_BUT_OK" )); - buttonOk->setAutoDefault(TRUE); - buttonOk->setDefault(TRUE); - GroupButtonsLayout->addWidget(buttonOk, 0, 0); - SMESHGUI_MergeNodesDlgLayout->addWidget(GroupButtons, 4, 0); - - /***************************************************************/ - - // Controls for mesh defining - GroupMesh = new QGroupBox(this, "GroupMesh"); - GroupMesh->setTitle(tr("SMESH_SELECT_WHOLE_MESH")); - GroupMesh->setColumnLayout(0, Qt::Vertical); - GroupMesh->layout()->setSpacing(0); - GroupMesh->layout()->setMargin(0); - GroupMeshLayout = new QGridLayout(GroupMesh->layout()); - GroupMeshLayout->setAlignment(Qt::AlignTop); - GroupMeshLayout->setSpacing(6); - GroupMeshLayout->setMargin(11); - - TextLabelName = new QLabel(GroupMesh, "TextLabelName"); - TextLabelName->setText(tr("SMESH_NAME")); - GroupMeshLayout->addWidget(TextLabelName, 0, 0); - - SelectMeshButton = new QPushButton(GroupMesh, "SelectMeshButton"); - SelectMeshButton->setPixmap(image1); - GroupMeshLayout->addWidget(SelectMeshButton, 0, 1); - - LineEditMesh = new QLineEdit(GroupMesh, "LineEditMesh"); - LineEditMesh->setReadOnly(true); - GroupMeshLayout->addWidget(LineEditMesh, 0, 2); - - SMESHGUI_MergeNodesDlgLayout->addWidget(GroupMesh, 1, 0); - - // Controls for coincident nodes detecting - GroupCoincident = new QGroupBox(this, "GroupCoincident"); - GroupCoincident->setTitle(tr("COINCIDENT_NODES")); - GroupCoincident->setColumnLayout(0, Qt::Vertical); - GroupCoincident->layout()->setSpacing(0); - GroupCoincident->layout()->setMargin(0); - QGridLayout* GroupCoincidentLayout = new QGridLayout(GroupCoincident->layout()); - GroupCoincidentLayout->setAlignment(Qt::AlignTop); - GroupCoincidentLayout->setSpacing(6); - GroupCoincidentLayout->setMargin(11); - - TextLabelTolerance = new QLabel(GroupCoincident, "TextLabelTolerance"); - TextLabelTolerance->setText(tr("SMESH_TOLERANCE")); - GroupCoincidentLayout->addWidget(TextLabelTolerance, 0, 0); - - SpinBoxTolerance = new SMESHGUI_SpinBox(GroupCoincident, "SpinBoxTolerance"); - GroupCoincidentLayout->addWidget(SpinBoxTolerance, 0, 1); - - QPushButton* DetectButton = new QPushButton(GroupCoincident, "DetectButton"); - DetectButton->setText(tr("DETECT")); - GroupCoincidentLayout->addWidget(DetectButton, 0, 2); - - ListCoincident = new QListView(GroupCoincident); - ListCoincident->setSorting(-1); - ListCoincident->addColumn("Nodes"); - ListCoincident->header()->hide(); - - GroupCoincidentLayout->addMultiCellWidget(ListCoincident, 1, 1, 0, 1); - - SelectAllCB = new QCheckBox(GroupCoincident, "SelectAllCB"); - SelectAllCB->setText(tr("SELECT_ALL")); - GroupCoincidentLayout->addWidget(SelectAllCB, 2, 0); - - SMESHGUI_MergeNodesDlgLayout->addWidget(GroupCoincident, 2, 0); - - // Controls for editing group of nodes - GroupEdit = new QGroupBox(this, "GroupEdit"); - GroupEdit->setTitle(tr("EDIT_GROUP_OF_NODES")); - GroupEdit->setColumnLayout(0, Qt::Vertical); - GroupEdit->layout()->setSpacing(0); - GroupEdit->layout()->setMargin(0); - QGridLayout* GroupEditLayout = new QGridLayout(GroupEdit->layout()); - GroupEditLayout->setAlignment(Qt::AlignTop); - GroupEditLayout->setSpacing(6); - GroupEditLayout->setMargin(11); - - ListEdit = new QListBox(GroupEdit, "ListEdit"); - ListEdit->setColumnMode(QListBox::FitToHeight); - ListEdit->setSelectionMode(QListBox::Extended); - GroupEditLayout->addMultiCellWidget(ListEdit, 0, 2, 0, 0); - - QPushButton* AddButton = new QPushButton(GroupEdit, "AddButton"); - AddButton->setText(tr("SMESH_BUT_ADD")); - GroupEditLayout->addWidget(AddButton, 0, 1); - - QPushButton* RemoveButton = new QPushButton(GroupEdit, "RemoveButton"); - RemoveButton->setText(tr("SMESH_BUT_REMOVE")); - GroupEditLayout->addWidget(RemoveButton, 1, 1); - - QSpacerItem* spacer = new QSpacerItem(20, 200, QSizePolicy::Minimum, QSizePolicy::Expanding); - GroupEditLayout->addItem(spacer, 2, 1); - - SMESHGUI_MergeNodesDlgLayout->addWidget(GroupEdit, 3, 0); - - /* Initialisations */ - SpinBoxTolerance->RangeStepAndValidator(0.0, COORD_MAX, 0.1, 3); - SpinBoxTolerance->SetValue(1e-05); - - RadioButton1->setChecked(TRUE); - - myEditCurrentArgument = (QWidget*)LineEditMesh; - - myActor = 0; - mySubMeshOrGroup = SMESH::SMESH_subMesh::_nil(); - - mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); - - mySMESHGUI->SetActiveDialogBox((QDialog*)this); - - // Costruction of the logical filter - SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH); - SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter (GROUP); - - QPtrList aListOfFilters; - if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter); - if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter); - - myMeshOrSubMeshOrGroupFilter = - new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR); - - //myMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH); - - /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); - - connect(SelectMeshButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument())); - connect(DetectButton, SIGNAL (clicked()), this, SLOT(onDetect())); - connect(ListCoincident, SIGNAL (selectionChanged()), this, SLOT(onSelectNodesGroup())); - connect(ListCoincident, SIGNAL (pressed(QListViewItem*)), this, SLOT(updateControls())); - connect(ListCoincident, SIGNAL (currentChanged(QListViewItem*)), this, SLOT(updateControls())); - connect(SelectAllCB, SIGNAL(toggled(bool)), this, SLOT(onSelectAll(bool))); - connect(ListEdit, SIGNAL (selectionChanged()), this, SLOT(onSelectNodesFromGroup())); - connect(AddButton, SIGNAL (clicked()), this, SLOT(onAdd())); - connect(RemoveButton, SIGNAL (clicked()), this, SLOT(onRemove())); - - connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); - connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - /* to close dialog if study change */ - connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); - - this->show(); /* displays Dialog */ - - resize(0,0); - buttonOk->setEnabled(false); - buttonApply->setEnabled(false); - - // Init Mesh field from selection - SelectionIntoArgument(); - - myHelpFileName = "merging_nodes_page.html"; -} - -//================================================================================= -// function : ~SMESHGUI_MergeNodesDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -SMESHGUI_MergeNodesDlg::~SMESHGUI_MergeNodesDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -bool SMESHGUI_MergeNodesDlg::ClickOnApply() -{ - if (mySMESHGUI->isActiveStudyLocked() || myMesh->_is_nil()) - return false; - - try { - SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); - - QApplication::setOverrideCursor(Qt::waitCursor); - SMESH::array_of_long_array_var aGroupsOfNodes = new SMESH::array_of_long_array; - aGroupsOfNodes->length(ListCoincident->childCount()); - QListViewItem* item = ListCoincident->firstChild(); - - int anArrayNum = 0; - while (item) { - QStringList aListIds = QStringList(""); - if (((QCheckListItem*) item)->isOn()) - aListIds = QStringList::split(" ", item->text(0), false); - - SMESH::long_array_var anIds = new SMESH::long_array; - anIds->length(aListIds.count()); - - for (int i = 0; i < aListIds.count(); i++) - anIds[i] = aListIds[i].toInt(); - - aGroupsOfNodes[anArrayNum++] = anIds.inout(); - - item = item->itemBelow(); - } - - aMeshEditor->MergeNodes (aGroupsOfNodes.inout()); - QApplication::restoreOverrideCursor(); - } catch(...) { - } - - //mySelectionMgr->clearSelected(); - SMESH::UpdateView(); - - onDetect(); - return true; -} - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void SMESHGUI_MergeNodesDlg::ClickOnOk() -{ - if (ClickOnApply()) - ClickOnCancel(); -} - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void SMESHGUI_MergeNodesDlg::ClickOnCancel() -{ - mySelectionMgr->clearFilters(); - //mySelectionMgr->clearSelected(); - SMESH::SetPointRepresentation(false); - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->SetSelectionMode(ActorSelection); - disconnect(mySelectionMgr, 0, this, 0); - mySMESHGUI->ResetState(); - reject(); -} - -//================================================================================= -// function : ClickOnHelp() -// purpose : -//================================================================================= -void SMESHGUI_MergeNodesDlg::ClickOnHelp() -{ - LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); - if (app) - app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); - else { - QString platform; -#ifdef WIN32 - platform = "winapplication"; -#else - platform = "application"; -#endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); - } -} - -//================================================================================= -// function : onEditNodesGroup() -// purpose : -//================================================================================= -void SMESHGUI_MergeNodesDlg::onEditNodesGroup() -{ - if (ListCoincident->childCount() < 1) - return; - - QString aNewIds = ""; - - QListBoxItem* anItem; - for (anItem = ListEdit->firstItem(); anItem != 0; anItem = anItem->next()) - aNewIds+=QString(" %1").arg(anItem->text()); - - ListCoincident->currentItem()->setText(0, aNewIds); -} - -//================================================================================= -// function : updateControls() -// purpose : -//================================================================================= -void SMESHGUI_MergeNodesDlg::updateControls() -{ - if (ListCoincident->childCount() < 1) { - SMESH::SetPointRepresentation(false); - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->SetSelectionMode(ActorSelection); - return; - } - - bool hasChecked = false, hasUnchecked = false; - - QListViewItem* item = ListCoincident->firstChild(); - - while (item && (!hasChecked || !hasUnchecked)) { - if (((QCheckListItem*) item)->isOn()) - hasChecked = true; - else - hasUnchecked = true; - - item = item->itemBelow(); - } - - if (hasUnchecked) - SelectAllCB->setChecked(false); - - bool enable = !(myMesh->_is_nil()) && hasChecked; - - buttonOk->setEnabled(enable); - buttonApply->setEnabled(enable); -} - -//================================================================================= -// function : onDetect() -// purpose : -//================================================================================= -void SMESHGUI_MergeNodesDlg::onDetect() -{ - if (myMesh->_is_nil()) - return; - - try { - SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); - - QApplication::setOverrideCursor(Qt::waitCursor); - ListCoincident->clear(); - ListEdit->clear(); - - SMESH::array_of_long_array_var aNodeGroups; - if(!mySubMeshOrGroup->_is_nil()) - aMeshEditor->FindCoincidentNodesOnPart(mySubMeshOrGroup, SpinBoxTolerance->GetValue(), aNodeGroups); - else - aMeshEditor->FindCoincidentNodes(SpinBoxTolerance->GetValue(), aNodeGroups); - - for (int i = 0; i < aNodeGroups->length(); i++) { - SMESH::long_array& aGroup = aNodeGroups[i]; - - QString aNodeIds; - for (int j = 0; j < aGroup.length(); j++) - aNodeIds+=QString(" %1").arg(aGroup[j]); - - new QCheckListItem (ListCoincident, aNodeIds, QCheckListItem::CheckBox); - } - QApplication::restoreOverrideCursor(); - } catch(...) { - } - - updateControls(); -} - -//================================================================================= -// function : onSelectNodesGroup() -// purpose : -//================================================================================= -void SMESHGUI_MergeNodesDlg::onSelectNodesGroup() -{ - if (!myActor) - return; - - myEditCurrentArgument = (QWidget*)ListCoincident; - - QListViewItem* aSelectedItem = ListCoincident->selectedItem(); - if (!aSelectedItem) - return; - - QStringList aListId = QStringList::split(" ", aSelectedItem->text(0), false); - - ListEdit->clear(); - ListEdit->insertStringList(aListId); - - //mySelectionMgr->clearSelected(); - //mySelectionMgr->AddIObject(myActor->getIO()); - SALOME_ListIO aList; - aList.Append(myActor->getIO()); - mySelectionMgr->setSelectedObjects(aList, false); - - SMESH::SetPointRepresentation(true); - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->SetSelectionMode(NodeSelection); - - ListEdit->selectAll(true); -} - -//================================================================================= -// function : onSelectAll() -// purpose : -//================================================================================= -void SMESHGUI_MergeNodesDlg::onSelectAll (bool isToggled) -{ - if (isToggled) { - int aNbItems = 0; - QListViewItem* item = ListCoincident->firstChild(); - while (item) { - aNbItems++; - if (!((QCheckListItem*) item)->isOn()) - ((QCheckListItem*) item)->setOn(true); - item = item->itemBelow(); - } - - if (aNbItems) { - buttonOk->setEnabled(true); - buttonApply->setEnabled(true); - } - } -} - -//================================================================================= -// function : onSelectNodesFromGroup() -// purpose : -//================================================================================= -void SMESHGUI_MergeNodesDlg::onSelectNodesFromGroup() -{ - if (!myActor) - return; - - TColStd_MapOfInteger aIndexes; - QListBoxItem* anItem; - for (anItem = ListEdit->firstItem(); anItem != 0; anItem = anItem->next()) { - if (anItem->isSelected()) { - int anId = anItem->text().toInt(); - aIndexes.Add(anId); - } - } - - mySelector->AddOrRemoveIndex(myActor->getIO(), aIndexes, false); - SALOME_ListIO aList; - aList.Append(myActor->getIO()); - mySelectionMgr->setSelectedObjects(aList); -} - -//================================================================================= -// function : onAdd() -// purpose : -//================================================================================= -void SMESHGUI_MergeNodesDlg::onAdd() -{ - if (!myActor) - return; - - QString aListStr = ""; - int aNbNnodes = 0; - - aNbNnodes = SMESH::GetNameOfSelectedNodes(mySelector, myActor->getIO(), aListStr); - if (aNbNnodes < 1) - return; - - QStringList aNodes = QStringList::split(" ", aListStr); - QListBoxItem* anItem = 0; - - for (QStringList::iterator it = aNodes.begin(); it != aNodes.end(); ++it) { - anItem = ListEdit->findItem(*it, Qt::ExactMatch); - if (!anItem) { - anItem = new QListBoxText(*it); - ListEdit->insertItem(anItem); - } - ListEdit->setSelected(anItem, true); - } - - onEditNodesGroup(); -} - -//================================================================================= -// function : onRemove() -// purpose : -//================================================================================= -void SMESHGUI_MergeNodesDlg::onRemove() -{ - if (myEditCurrentArgument != (QWidget*)ListCoincident) - return; - - for (int i = ListEdit->count(); i > 0; i--) { - if (ListEdit->isSelected(i-1)) - ListEdit->removeItem(i-1); - } - onEditNodesGroup(); -} - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void SMESHGUI_MergeNodesDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - - disconnect(mySelectionMgr, 0, this, 0); - mySelectionMgr->clearSelected(); - mySelectionMgr->clearFilters(); - - if (send == SelectMeshButton) { - myEditCurrentArgument = (QWidget*)LineEditMesh; - SMESH::SetPointRepresentation(false); - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->SetSelectionMode(ActorSelection); - mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter); - } - - myEditCurrentArgument->setFocus(); - connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - SelectionIntoArgument(); -} - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection as changed or other case -//================================================================================= -void SMESHGUI_MergeNodesDlg::SelectionIntoArgument() -{ - if (myEditCurrentArgument == (QWidget*)LineEditMesh) { - QString aString = ""; - LineEditMesh->setText(aString); - - ListCoincident->clear(); - ListEdit->clear(); - myActor = 0; - - int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString); - if (nbSel != 1) - return; - - SALOME_ListIO aList; - mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type()); - - Handle(SALOME_InteractiveObject) IO = aList.First(); - myMesh = SMESH::GetMeshByIO(IO); - - if (myMesh->_is_nil()) - return; - - myActor = SMESH::FindActorByEntry(IO->getEntry()); - if (!myActor) - myActor = SMESH::FindActorByObject(myMesh); - if(!myActor) - return; - - mySubMeshOrGroup = SMESH::SMESH_IDSource::_nil(); - - if ((!SMESH::IObjectToInterface(IO)->_is_nil() || //SUBMESH OR GROUP - !SMESH::IObjectToInterface(IO)->_is_nil()) && - !SMESH::IObjectToInterface(IO)->_is_nil()) - mySubMeshOrGroup = SMESH::IObjectToInterface(IO); - - LineEditMesh->setText(aString); - } -} - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void SMESHGUI_MergeNodesDlg::DeactivateActiveDialog() -{ - if (GroupConstructors->isEnabled()) { - GroupConstructors->setEnabled(false); - GroupMesh->setEnabled(false); - GroupCoincident->setEnabled(false); - GroupEdit->setEnabled(false); - GroupButtons->setEnabled(false); - mySMESHGUI->ResetState(); - mySMESHGUI->SetActiveDialogBox(0); - } -} - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void SMESHGUI_MergeNodesDlg::ActivateThisDialog() -{ - /* Emit a signal to deactivate the active dialog */ - mySMESHGUI->EmitSignalDeactivateDialog(); - GroupConstructors->setEnabled(true); - GroupMesh->setEnabled(true); - GroupCoincident->setEnabled(true); - GroupEdit->setEnabled(true); - GroupButtons->setEnabled(true); - - mySMESHGUI->SetActiveDialogBox((QDialog*)this); - - SelectionIntoArgument(); -} - -//================================================================================= -// function : enterEvent() -// purpose : -//================================================================================= -void SMESHGUI_MergeNodesDlg::enterEvent (QEvent*) -{ - if (!GroupConstructors->isEnabled()) - ActivateThisDialog(); -} - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void SMESHGUI_MergeNodesDlg::closeEvent (QCloseEvent*) -{ - /* same than click on cancel button */ - ClickOnCancel(); -} - -//======================================================================= -//function : hideEvent() -//purpose : caused by ESC key -//======================================================================= -void SMESHGUI_MergeNodesDlg::hideEvent (QHideEvent*) -{ - if (!isMinimized()) - ClickOnCancel(); -} - -//================================================================================= -// function : keyPressEvent() -// purpose : -//================================================================================= -void SMESHGUI_MergeNodesDlg::keyPressEvent( QKeyEvent* e ) -{ - QDialog::keyPressEvent( e ); - if ( e->isAccepted() ) - return; - - if ( e->key() == Key_F1 ) - { - e->accept(); - ClickOnHelp(); - } -} diff --git a/src/SMESHGUI/SMESHGUI_MergeNodesDlg.h b/src/SMESHGUI/SMESHGUI_MergeNodesDlg.h deleted file mode 100644 index 65ca3cde3..000000000 --- a/src/SMESHGUI/SMESHGUI_MergeNodesDlg.h +++ /dev/null @@ -1,150 +0,0 @@ -// SMESH SMESHGUI : GUI for SMESH component -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SMESHGUI_MergeNodesDlg.h -// Author : Michael ZORIN -// Module : SMESH -// $Header: - -#ifndef DIALOGBOX_MERGENODES_H -#define DIALOGBOX_MERGENODES_H - -#include "SMESH_SMESHGUI.hxx" - -#include "LightApp_SelectionMgr.h" -//#include "SMESH_TypeFilter.hxx" -#include "SUIT_SelectionFilter.h" - -// QT Includes -#include - -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; -class QCheckBox; -class QListView; -class QListViewItem; -class QListBox; -class SMESHGUI; -class SMESHGUI_SpinBox; -class SMESH_Actor; -class SVTK_ViewWindow; -class SVTK_Selector; - - -// IDL Headers -#include -#include CORBA_SERVER_HEADER(SMESH_MeshEditor) - - -//================================================================================= -// class : SMESHGUI_MergeNodesDlg -// purpose : -//================================================================================= -class SMESHGUI_EXPORT SMESHGUI_MergeNodesDlg : public QDialog -{ - Q_OBJECT - -public: - SMESHGUI_MergeNodesDlg( SMESHGUI*, - const char* name = 0, - bool modal = FALSE, - WFlags fl = 0); - ~SMESHGUI_MergeNodesDlg(); - -private: - void Init(); - void closeEvent( QCloseEvent* e ); - void enterEvent ( QEvent * ); /* mouse enter the QWidget */ - void hideEvent ( QHideEvent * ); /* ESC key */ - void keyPressEvent( QKeyEvent* e ); - void onEditNodesGroup(); - - SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ - LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ - SVTK_Selector* mySelector; - - QWidget* myEditCurrentArgument; - - SMESH::SMESH_Mesh_var myMesh; - SMESH::SMESH_IDSource_var mySubMeshOrGroup; - SMESH_Actor* myActor; - //Handle(SMESH_TypeFilter) myMeshOrSubMeshFilter; - SUIT_SelectionFilter* myMeshOrSubMeshOrGroupFilter; - - QButtonGroup* GroupConstructors; - QRadioButton* RadioButton1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QPushButton* buttonHelp; - QGroupBox* GroupMesh; - QGroupBox* GroupCoincident; - QGroupBox* GroupEdit; - QLabel* TextLabelName; - QLabel* TextLabelTolerance; - QLineEdit* LineEditMesh; - QPushButton* SelectMeshButton; - QPushButton* DetectButton; - QPushButton* AddButton; - QPushButton* RemoveButton; - QCheckBox* SelectAllCB; - QListView* ListCoincident; - QListBox* ListEdit; - SMESHGUI_SpinBox* SpinBoxTolerance; - - QString myHelpFileName; - -private slots: - - void ClickOnOk(); - void ClickOnCancel(); - bool ClickOnApply(); - void ClickOnHelp(); - void updateControls(); - void onDetect(); - void onSelectNodesGroup(); - void onSelectAll(bool isToggled); - void onSelectNodesFromGroup(); - void onAdd(); - void onRemove(); - void SetEditCurrentArgument(); - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* SMESHGUI_MergeNodesDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupMeshLayout; - QGridLayout* GroupCoincidentLayout; - QGridLayout* GroupEditLayout; -}; - -#endif // DIALOGBOX_MERGENODES_H diff --git a/src/SMESHGUI/SMESHGUI_MeshDlg.cxx b/src/SMESHGUI/SMESHGUI_MeshDlg.cxx index b9b4f079d..f01212a3d 100644 --- a/src/SMESHGUI/SMESHGUI_MeshDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshDlg.cxx @@ -1,50 +1,49 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public +// SMESH SMESHGUI : GUI for SMESH component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public +// You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -/** -* SMESH SMESHGUI -* -* Copyright (C) 2005 CEA/DEN, EDF R&D -* -* -* -* File : SMESHGUI_MeshDlg.cxx -* Author : Sergey LITONIN -* Module : SMESH -*/ +// File : SMESHGUI_MeshDlg.cxx +// Author : Sergey LITONIN, Open CASCADE S.A.S. +// +// SMESH includes #include "SMESHGUI_MeshDlg.h" +// SALOME GUI includes #include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SPACING 6 +#define MARGIN 11 /*! * \brief Tab for tab widget containing controls for definition of @@ -60,12 +59,11 @@ */ //================================================================================ SMESHGUI_MeshTab::SMESHGUI_MeshTab( QWidget* theParent ) -: QFrame( theParent ), - myPopup( 0 ) + : QFrame( theParent ) { SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); - QIconSet aCreateIcon( aResMgr->loadPixmap( "SMESH", tr( "ICON_HYPO" ) ) ); - QIconSet aEditIcon( aResMgr->loadPixmap( "SMESH", tr( "ICON_HYPO_EDIT" ) ) ); + QIcon aCreateIcon( aResMgr->loadPixmap( "SMESH", tr( "ICON_HYPO" ) ) ); + QIcon aEditIcon( aResMgr->loadPixmap( "SMESH", tr( "ICON_HYPO_EDIT" ) ) ); // Algorifm QLabel* anAlgoLbl = new QLabel( tr( "ALGORITHM" ), this ); @@ -76,9 +74,9 @@ SMESHGUI_MeshTab::SMESHGUI_MeshTab( QWidget* theParent ) myHyp[ MainHyp ] = new QComboBox( this ); myHyp[ MainHyp ]->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); myCreateHyp[ MainHyp ] = new QToolButton( this ); - myCreateHyp[ MainHyp ]->setIconSet( aCreateIcon ); + myCreateHyp[ MainHyp ]->setIcon( aCreateIcon ); myEditHyp[ MainHyp ] = new QToolButton( this ); - myEditHyp[ MainHyp ]->setIconSet( aEditIcon ); + myEditHyp[ MainHyp ]->setIcon( aEditIcon ); // Line QFrame* aLine = new QFrame( this ); @@ -89,19 +87,22 @@ SMESHGUI_MeshTab::SMESHGUI_MeshTab( QWidget* theParent ) myHyp[ AddHyp ] = new QComboBox( this ); myHyp[ AddHyp ]->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); myCreateHyp[ AddHyp ] = new QToolButton( this ); - myCreateHyp[ AddHyp ]->setIconSet( aCreateIcon ); + myCreateHyp[ AddHyp ]->setIcon( aCreateIcon ); myEditHyp[ AddHyp ] = new QToolButton( this ); - myEditHyp[ AddHyp ]->setIconSet( aEditIcon ); + myEditHyp[ AddHyp ]->setIcon( aEditIcon ); // Fill layout - QGridLayout* aLay = new QGridLayout( this, 5, 4, 5, 5 ); + QGridLayout* aLay = new QGridLayout( this ); + aLay->setMargin( MARGIN ); + aLay->setSpacing( SPACING ); + aLay->addWidget( anAlgoLbl, 0, 0 ); aLay->addWidget( myHyp[ Algo ], 0, 1 ); aLay->addWidget( aHypLbl, 1, 0 ); aLay->addWidget( myHyp[ MainHyp ], 1, 1 ); aLay->addWidget( myCreateHyp[ MainHyp ], 1, 2 ); aLay->addWidget( myEditHyp[ MainHyp ], 1, 3 ); - aLay->addMultiCellWidget( aLine, 2, 2, 0, 3 ); + aLay->addWidget( aLine, 2, 0, 1, 4 ); aLay->addWidget( anAddHypLbl, 3, 0 ); aLay->addWidget( myHyp[ AddHyp ], 3, 1 ); aLay->addWidget( myCreateHyp[ AddHyp ], 3, 2 ); @@ -124,10 +125,13 @@ SMESHGUI_MeshTab::SMESHGUI_MeshTab( QWidget* theParent ) setAvailableHyps( AddHyp, QStringList() ); } +//================================================================================ +/*! + * \brief Destructor + */ +//================================================================================ SMESHGUI_MeshTab::~SMESHGUI_MeshTab() { - if ( myPopup ) - delete myPopup; } //================================================================================ @@ -147,9 +151,9 @@ void SMESHGUI_MeshTab::setAvailableHyps( const int theId, const QStringList& the if ( theId == Algo ) { myHyp[ Algo ]->clear(); - myHyp[ Algo ]->insertItem( tr( "NONE" ) ); - myHyp[ Algo ]->insertStringList( theHyps ); - myHyp[ Algo ]->setCurrentItem( 0 ); + myHyp[ Algo ]->addItem( tr( "NONE" ) ); + myHyp[ Algo ]->addItems( theHyps ); + myHyp[ Algo ]->setCurrentIndex( 0 ); } else { myCreateHyp[ theId ]->setEnabled( enable ); @@ -172,9 +176,9 @@ void SMESHGUI_MeshTab::setExistingHyps( const int theId, const QStringList& theH if ( theId != Algo ) { myHyp[ theId ]->clear(); - myHyp[ theId ]->insertItem( tr( "NONE" ) ); - myHyp[ theId ]->insertStringList( theHyps ); - myHyp[ theId ]->setCurrentItem( 0 ); + myHyp[ theId ]->addItem( tr( "NONE" ) ); + myHyp[ theId ]->addItems( theHyps ); + myHyp[ theId ]->setCurrentIndex( 0 ); myHyp[ theId ]->setEnabled( !theHyps.isEmpty() ); myEditHyp[ theId ]->setEnabled( false ); } @@ -192,8 +196,8 @@ void SMESHGUI_MeshTab::setExistingHyps( const int theId, const QStringList& theH //================================================================================ void SMESHGUI_MeshTab::addHyp( const int theId, const QString& theHyp ) { - myHyp[ theId ]->insertItem( theHyp ); - myHyp[ theId ]->setCurrentItem( myHyp[ theId ]->count() - 1 ); + myHyp[ theId ]->addItem( theHyp ); + myHyp[ theId ]->setCurrentIndex( myHyp[ theId ]->count() - 1 ); myEditHyp[ theId ]->setEnabled( true ); myHyp[ theId ]->setEnabled( true ); } @@ -213,7 +217,7 @@ void SMESHGUI_MeshTab::renameHyp( const int theId, const QString& theNewName ) { if ( theIndex > 0 && theIndex < myHyp[ theId ]->count() ) - myHyp[ theId ]->changeItem( theNewName, theIndex ); + myHyp[ theId ]->setItemText( theIndex, theNewName ); } //================================================================================ @@ -229,7 +233,7 @@ void SMESHGUI_MeshTab::setCurrentHyp( const int theId, const int theIndex ) { if ( theIndex >= 0 && theIndex < myHyp[ theId ]->count() ) { - myHyp[ theId ]->setCurrentItem( theIndex ); + myHyp[ theId ]->setCurrentIndex( theIndex ); if ( myEditHyp[ theId ] ) myEditHyp[ theId ]->setEnabled( theIndex > 0 ); } @@ -246,7 +250,7 @@ void SMESHGUI_MeshTab::setCurrentHyp( const int theId, const int theIndex ) //================================================================================ int SMESHGUI_MeshTab::currentHyp( const int theId ) const { - return myHyp[ theId ]->currentItem(); + return myHyp[ theId ]->currentIndex(); } //================================================================================ @@ -259,31 +263,20 @@ int SMESHGUI_MeshTab::currentHyp( const int theId ) const //================================================================================ void SMESHGUI_MeshTab::onCreateHyp() { - const QObject* aSender = sender(); - - if ( !myPopup ) - { - myPopup = new QPopupMenu( 0 ); - connect( myPopup, SIGNAL( activated( int ) ), SLOT( onPopupItem( int ) ) ); - } + bool isMainHyp = sender() == myCreateHyp[ MainHyp ]; + + QMenu aPopup( this ); - QStringList aHypNames; - if ( aSender == myCreateHyp[ MainHyp ] ) - { - aHypNames = myAvailableHyps[ MainHyp ]; - myPopup->setName( "MainHypPopup" ); - } - else - { - aHypNames = myAvailableHyps[ AddHyp ]; - myPopup->setName( "AddHypPopup" ); - } - - myPopup->clear(); + QStringList aHypNames = isMainHyp ? + myAvailableHyps[ MainHyp ] : aHypNames = myAvailableHyps[ AddHyp ]; + + QList actions; for ( int i = 0, n = aHypNames.count(); i < n; i++ ) - myPopup->insertItem( aHypNames[ i ], i ); + actions.append( aPopup.addAction( aHypNames[ i ] ) ); - myPopup->exec( QCursor::pos() ); + QAction* a = aPopup.exec( QCursor::pos() ); + if ( a ) + emit createHyp( isMainHyp ? MainHyp : AddHyp, actions.indexOf( a ) ); } //================================================================================ @@ -298,7 +291,7 @@ void SMESHGUI_MeshTab::onEditHyp() { const QObject* aSender = sender(); int aHypType = aSender == myEditHyp[ MainHyp ] ? MainHyp : AddHyp; - emit editHyp( aHypType, myHyp[ aHypType ]->currentItem() - 1 ); // - 1 because there is NONE on the top + emit editHyp( aHypType, myHyp[ aHypType ]->currentIndex() - 1 ); // - 1 because there is NONE on the top } //================================================================================ @@ -321,21 +314,6 @@ void SMESHGUI_MeshTab::onHyp( int theIndex ) } } -//================================================================================ -/*! - * \brief Emits createHyp signal - * - * SLOT called when item of popup for hypothesis creation is activated. Emits - * createHyp signal to notify operation obout this event - */ -//================================================================================ -void SMESHGUI_MeshTab::onPopupItem( int theId ) -{ - const QObject* aSender = sender(); - if ( aSender ) - emit createHyp( strcmp( aSender->name(), "MainHypPopup" ) == 0 ? MainHyp : AddHyp, theId ); -} - //================================================================================ /*! * \brief Resets all tab fields @@ -347,7 +325,7 @@ void SMESHGUI_MeshTab::reset() { for ( int i = Algo; i <= AddHyp; i++ ) { - myHyp[ i ]->setCurrentItem( 0 ); + myHyp[ i ]->setCurrentIndex( 0 ); if ( myEditHyp[ i ] ) myEditHyp[ i ]->setEnabled( false ); } @@ -374,18 +352,15 @@ SMESHGUI_MeshDlg::SMESHGUI_MeshDlg( const bool theToCreate, const bool theIsMesh : SMESHGUI_Dialog( 0, false, true ) { // Create top controls - - QGroupBox* aGrp = new QGroupBox( 3, Qt::Horizontal, mainFrame() ); - aGrp->setFrameStyle( QFrame::NoFrame ); - aGrp->setInsideMargin( 0 ); + // name - createObject( tr( "NAME" ), aGrp, Obj ); + createObject( tr( "NAME" ), mainFrame(), Obj ); setNameIndication( Obj, OneName ); setReadOnly( Obj, false ); // mesh - createObject( tr( "MESH" ), aGrp, Mesh ); + createObject( tr( "MESH" ), mainFrame(), Mesh ); // geometry - createObject( tr( "GEOMETRY" ), aGrp, Geom ); + createObject( tr( "GEOMETRY" ), mainFrame(), Geom ); myGeomPopup = 0; // Create tab widget @@ -401,47 +376,52 @@ SMESHGUI_MeshDlg::SMESHGUI_MeshDlg( const bool theToCreate, const bool theIsMesh myTabWg->addTab( myTabs[ Dim0D ], tr( "DIM_0D" ) ); // Hypotheses Sets - myHypoSetPopup = new QPopupMenu(); - QButton* aHypoSetButton = new QPushButton( mainFrame(), "aHypoSetButton"); - aHypoSetButton->setText( tr( "HYPOTHESES_SETS" ) ); + myHypoSetButton = new QToolButton( mainFrame() ); + myHypoSetButton->setText( tr( "HYPOTHESES_SETS" ) ); + myHypoSetButton->setEnabled( false ); // Fill layout - QVBoxLayout* aLay = new QVBoxLayout( mainFrame(), 0, 5 ); - aLay->addWidget( aGrp ); - aLay->addItem( new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum) ); - aLay->addWidget( myTabWg ); - aLay->addWidget( aHypoSetButton ); + QGridLayout* aLay = new QGridLayout( mainFrame() ); + aLay->setMargin( 0 ); + aLay->setSpacing( SPACING ); + + aLay->addWidget( objectWg( Obj, Label ), 0, 0 ); + aLay->addWidget( objectWg( Obj, Btn ), 0, 1 ); + aLay->addWidget( objectWg( Obj, Control ), 0, 2 ); + aLay->addWidget( objectWg( Mesh, Label ), 1, 0 ); + aLay->addWidget( objectWg( Mesh, Btn ), 1, 1 ); + aLay->addWidget( objectWg( Mesh, Control ), 1, 2 ); + aLay->addWidget( objectWg( Geom, Label ), 2, 0 ); + aLay->addWidget( objectWg( Geom, Btn ), 2, 1 ); + aLay->addWidget( objectWg( Geom, Control ), 2, 2 ); + aLay->addWidget( myTabWg, 4, 0, 1, 3 ); + aLay->addWidget( myHypoSetButton, 5, 0, 1, 3 ); + aLay->setRowMinimumHeight( 3, 20 ); // Disable controls if necessary setObjectShown( Mesh, false ); if ( theToCreate ) { - setCaption( tr( "CREATE_MESH" ) ); + setWindowTitle( tr( "CREATE_MESH" ) ); objectWg( Obj, Btn )->hide(); if ( theIsMesh ) - setCaption( tr( "CREATE_MESH" ) ); + setWindowTitle( tr( "CREATE_MESH" ) ); else { - setCaption( tr( "CREATE_SUBMESH" ) ); + setWindowTitle( tr( "CREATE_SUBMESH" ) ); setObjectShown( Mesh, true ); } } else { - setCaption( tr( "EDIT_MESH_SUBMESH" ) ); + setWindowTitle( tr( "EDIT_MESH_SUBMESH" ) ); objectWg( Mesh, Btn )->hide(); objectWg( Geom, Btn )->hide(); } - - // Connect signals and slots - connect( aHypoSetButton, SIGNAL( clicked() ), SLOT( onHypoSetButton() ) ); - connect( myHypoSetPopup, SIGNAL( activated( int ) ), SLOT( onHypoSetPopup( int ) ) ); } SMESHGUI_MeshDlg::~SMESHGUI_MeshDlg() { - if ( myHypoSetPopup ) - delete myHypoSetPopup; } //================================================================================ @@ -480,7 +460,7 @@ void SMESHGUI_MeshDlg::reset() //================================================================================ void SMESHGUI_MeshDlg::setCurrentTab( const int theId ) { - myTabWg->setCurrentPage( Dim3D - theId ); + myTabWg->setCurrentIndex( Dim3D - theId ); } //================================================================================ @@ -497,10 +477,10 @@ void SMESHGUI_MeshDlg::setMaxHypoDim( const int maxDim ) bool enable = ( dim <= DIM ); if ( !enable ) myTabs[ dim ]->reset(); - myTabWg->setTabEnabled( myTabs[ dim ], enable ); + myTabWg->setTabEnabled( myTabWg->indexOf( myTabs[ dim ] ), enable ); } // deselect desabled tab - if ( !myTabWg->isTabEnabled( myTabWg->currentPage() )) + if ( !myTabWg->isTabEnabled( myTabWg->currentIndex() ) ) setCurrentTab( DIM - 1 ); } @@ -512,10 +492,18 @@ void SMESHGUI_MeshDlg::setMaxHypoDim( const int maxDim ) void SMESHGUI_MeshDlg::setHypoSets( const QStringList& theSets ) { - myHypoSetPopup->clear(); + QMenu* aHypoSetPopup = myHypoSetButton->menu(); + if ( !aHypoSetPopup ) { + aHypoSetPopup = new QMenu( myHypoSetButton ); + connect( aHypoSetPopup, SIGNAL( triggered( QAction* ) ), SLOT( onHypoSetPopup( QAction* ) ) ); + myHypoSetButton->setMenu( aHypoSetPopup ); + myHypoSetButton->setPopupMode( QToolButton::InstantPopup ); + } + aHypoSetPopup->clear(); for ( int i = 0, n = theSets.count(); i < n; i++ ) { - myHypoSetPopup->insertItem( theSets[ i ], i ); + aHypoSetPopup->addAction( theSets[ i ] ); } + myHypoSetButton->setEnabled( !aHypoSetPopup->isEmpty() ); } //================================================================================ @@ -527,22 +515,11 @@ void SMESHGUI_MeshDlg::setHypoSets( const QStringList& theSets ) */ //================================================================================ -void SMESHGUI_MeshDlg::onHypoSetPopup( int theIndex ) +void SMESHGUI_MeshDlg::onHypoSetPopup( QAction* a ) { - emit hypoSet( myHypoSetPopup->text( theIndex )); + emit hypoSet( a->text() ); } -//================================================================================ -/*! - * \brief Shows myHypoSetPopup - */ -//================================================================================ - -void SMESHGUI_MeshDlg::onHypoSetButton() -{ - myHypoSetPopup->exec( QCursor::pos() ); -} - //================================================================================ /*! * \brief Enable showing of the popup when Geometry selection btn is clicked @@ -554,15 +531,15 @@ enum { DIRECT_GEOM_INDEX = 0, GEOM_BY_MESH_INDEX }; void SMESHGUI_MeshDlg::setGeomPopupEnabled( const bool enable ) { - if ( QButton* selBtn = dynamic_cast( objectWg( Geom, Btn ))) + if ( QToolButton* selBtn = qobject_cast( objectWg( Geom, Btn ))) { disconnect( selBtn, SIGNAL( toggled(bool) ), this, SLOT( onGeomSelectionButton(bool) )); if ( enable ) { if ( ! myGeomPopup ) { - myGeomPopup = new QPopupMenu(); - myGeomPopup->insertItem( tr("DIRECT_GEOM_SELECTION"), DIRECT_GEOM_INDEX ); - myGeomPopup->insertItem( tr("GEOM_BY_MESH_ELEM_SELECTION"), GEOM_BY_MESH_INDEX ); - connect( myGeomPopup, SIGNAL( activated( int ) ), SLOT( onGeomPopup( int ) ) ); + myGeomPopup = new QMenu(); + myGeomPopup->addAction( tr("DIRECT_GEOM_SELECTION") )->setData( DIRECT_GEOM_INDEX ); + myGeomPopup->addAction( tr("GEOM_BY_MESH_ELEM_SELECTION") )->setData( GEOM_BY_MESH_INDEX ); + connect( myGeomPopup, SIGNAL( triggered( QAction* ) ), SLOT( onGeomPopup( QAction* ) ) ); } connect( selBtn, SIGNAL( toggled(bool) ), this, SLOT( onGeomSelectionButton(bool) )); } @@ -577,7 +554,7 @@ void SMESHGUI_MeshDlg::setGeomPopupEnabled( const bool enable ) */ //================================================================================ void SMESHGUI_MeshDlg::disableTab(const int theTabId) { - myTabWg->setTabEnabled( myTabs[ theTabId ], false ); + myTabWg->setTabEnabled( myTabWg->indexOf( myTabs[ theTabId ] ), false ); } //================================================================================ @@ -587,7 +564,7 @@ void SMESHGUI_MeshDlg::disableTab(const int theTabId) { */ //================================================================================ void SMESHGUI_MeshDlg::enableTab(const int theTabId) { - myTabWg->setTabEnabled( myTabs[ theTabId ], true ); + myTabWg->setTabEnabled( myTabWg->indexOf( myTabs[ theTabId ] ), true ); } void SMESHGUI_MeshDlg::onGeomSelectionButton(bool isBtnOn) @@ -596,7 +573,7 @@ void SMESHGUI_MeshDlg::onGeomSelectionButton(bool isBtnOn) myGeomPopup->exec( QCursor::pos() ); } -void SMESHGUI_MeshDlg::onGeomPopup( int index ) +void SMESHGUI_MeshDlg::onGeomPopup( QAction* a ) { - emit geomSelectionByMesh( index == GEOM_BY_MESH_INDEX ); + emit geomSelectionByMesh( a->data().toInt() == GEOM_BY_MESH_INDEX ); } diff --git a/src/SMESHGUI/SMESHGUI_MeshDlg.h b/src/SMESHGUI/SMESHGUI_MeshDlg.h index 4b909b3c8..4d434df5b 100644 --- a/src/SMESHGUI/SMESHGUI_MeshDlg.h +++ b/src/SMESHGUI/SMESHGUI_MeshDlg.h @@ -1,52 +1,47 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public +// SMESH SMESHGUI : GUI for SMESH component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public +// You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -/** -* SMESH SMESHGUI -* -* Copyright (C) 2005 CEA/DEN, EDF R&D -* -* -* -* File : SMESHGUI_MeshDlg.h -* Author : Sergey LITONIN -* Module : SMESH -*/ - +// File : SMESHGUI_MeshDlg.h +// Author : Sergey LITONIN, Open CASCADE S.A.S. +// -#ifndef SMESHGUI_MeshDlg_H -#define SMESHGUI_MeshDlg_H +#ifndef SMESHGUI_MESHDLG_H +#define SMESHGUI_MESHDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" #include "SMESHGUI_Dialog.h" -#include -#include -#include + +// Qt includes +#include +#include +#include class SMESHGUI_MeshTab; class QTabWidget; -class QLineEdit; class QComboBox; class QToolButton; -class QString; -class QPopupMenu; +class QMenu; +class QAction; /*! * \brief Dialog for mech creation or editing @@ -65,7 +60,7 @@ public: enum Dimensions { Dim0D = 0, Dim1D, Dim2D, Dim3D }; public: - SMESHGUI_MeshDlg( const bool theToCreate, const bool theIsMesh ); + SMESHGUI_MeshDlg( const bool, const bool ); virtual ~SMESHGUI_MeshDlg(); SMESHGUI_MeshTab* tab( const int ) const; @@ -79,23 +74,19 @@ public: signals: - void hypoSet( const QString& ); void geomSelectionByMesh( bool ); private slots: - - void onHypoSetPopup( int ); - void onHypoSetButton(); - void onGeomPopup( int ); + void onHypoSetPopup( QAction* ); + void onGeomPopup( QAction* ); void onGeomSelectionButton( bool ); private: - - QMap< int, SMESHGUI_MeshTab* > myTabs; - QTabWidget* myTabWg; - QPopupMenu* myHypoSetPopup; - QPopupMenu* myGeomPopup; + QMap myTabs; + QTabWidget* myTabWg; + QToolButton* myHypoSetButton; + QMenu* myGeomPopup; }; /*! @@ -129,31 +120,26 @@ public: void reset(); signals: - - void createHyp( const int theHypType, const int theIndex ); + void createHyp( const int, const int ); //!< Emited when "Create hypothesis" button clicked - void editHyp( const int theHypType, const int theIndex ); + void editHyp( const int, const int ); //!< Emited when "Edit hypothesis" button clicked - void selectAlgo( const int theIndex ); + void selectAlgo( const int ); //!< Emited when an algorithm is selected private slots: - void onCreateHyp(); void onEditHyp(); void onHyp( int ); void onPopupItem( int ); private: + QMap myHyp; + QMap myCreateHyp; + QMap myEditHyp; - QMap< int, QComboBox* > myHyp; - QMap< int, QToolButton* > myCreateHyp; - QMap< int, QToolButton* > myEditHyp; - - QMap< int, QStringList > myAvailableHyps; - QMap< int, QStringList > myExistingHyps; - - QPopupMenu* myPopup; + QMap myAvailableHyps; + QMap myExistingHyps; }; -#endif +#endif // SMESHGUI_MESHDLG_H diff --git a/src/SMESHGUI/SMESHGUI_MeshEditPreview.cxx b/src/SMESHGUI/SMESHGUI_MeshEditPreview.cxx index 61900244e..0013564ff 100644 --- a/src/SMESHGUI/SMESHGUI_MeshEditPreview.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshEditPreview.cxx @@ -1,40 +1,41 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_MeshEditPreview.cxx +// Author : Open CASCADE S.A.S. // -// -// File : SMESHGUI_MeshEditPreview.cxx -// Module : SMESH -// $Header: +// SMESH includes #include "SMESHGUI_MeshEditPreview.h" -#include "VTKViewer_CellLocationsArray.h" -#include "SVTK_ViewWindow.h" - -#include "SMESH_Actor.h" -#include "SMESH_ActorUtils.h" #include "SMESHGUI_VTKUtils.h" -// VTK Includes +#include +#include + +// SALOME GUI includes +#include +#include + +// VTK includes #include #include #include @@ -44,15 +45,13 @@ #include #include -// QT Includes -#include +// Qt includes +#include -// IDL Headers -#include "SALOMEconfig.h" +// IDL includes +#include #include CORBA_SERVER_HEADER(SMESH_MeshEditor) -using namespace SMESH; - //================================================================================ /*! * \brief Constructor @@ -74,7 +73,7 @@ SMESHGUI_MeshEditPreview::SMESHGUI_MeshEditPreview(SVTK_ViewWindow* theViewWindo myPreviewActor->PickableOff(); vtkFloatingPointType anRGB[3]; - GetColor( "SMESH", "selection_element_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) ); + SMESH::GetColor( "SMESH", "selection_element_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) ); SetColor( anRGB[0], anRGB[1], anRGB[2] ); myPreviewActor->SetMapper( aMapper ); @@ -184,7 +183,7 @@ void SMESHGUI_MeshEditPreview::SetData (const SMESH::MeshPreviewStruct* previewD int aNodePos = 0; for ( int i = 0; i < anElemTypes.length(); i++ ) { - const ElementSubType& anElementSubType = anElemTypes[i]; + const SMESH::ElementSubType& anElementSubType = anElemTypes[i]; SMDSAbs_ElementType aType = SMDSAbs_ElementType(anElementSubType.SMDS_ElementType); vtkIdType aNbNodes = anElementSubType.nbNodesInElement; anIdList->SetNumberOfIds( aNbNodes ); @@ -230,7 +229,7 @@ void SMESHGUI_MeshEditPreview::SetData (const SMESH::MeshPreviewStruct* previewD void SMESHGUI_MeshEditPreview::SetVisibility (bool theVisibility) { myPreviewActor->SetVisibility(theVisibility); - RepaintCurrentView(); + SMESH::RepaintCurrentView(); } //================================================================================ @@ -243,3 +242,13 @@ void SMESHGUI_MeshEditPreview::SetColor(double R, double G, double B) { myPreviewActor->SetColor( R, G, B ); } + +//================================================================================ +/*! + * \brief Get preview actor + */ +//================================================================================ +SALOME_Actor* SMESHGUI_MeshEditPreview::GetActor() const +{ + return myPreviewActor; +} diff --git a/src/SMESHGUI/SMESHGUI_MeshEditPreview.h b/src/SMESHGUI/SMESHGUI_MeshEditPreview.h index 7e2012560..fac3ba0ae 100644 --- a/src/SMESHGUI/SMESHGUI_MeshEditPreview.h +++ b/src/SMESHGUI/SMESHGUI_MeshEditPreview.h @@ -1,62 +1,61 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_MeshEditPreview.h +// Author : Open CASCADE S.A.S. // -// -// File : SMESHGUI_MeshEditPreview.cxx -// Module : SMESH -// $Header: #ifndef SMESHGUI_MESHEDITPREVIEW_H #define SMESHGUI_MESHEDITPREVIEW_H +// SMESH includes +#include "SMESH_SMESHGUI.hxx" + class SVTK_ViewWindow; class vtkUnstructuredGrid; class SALOME_Actor; -namespace SMESH { + +namespace SMESH +{ class MeshPreviewStruct; } /*! * \brief Displayer of the mesh edition preview */ -class SMESHGUI_MeshEditPreview { - SVTK_ViewWindow* myViewWindow; +class SMESHGUI_EXPORT SMESHGUI_MeshEditPreview +{ + SVTK_ViewWindow* myViewWindow; vtkUnstructuredGrid* myGrid; - SALOME_Actor* myPreviewActor; + SALOME_Actor* myPreviewActor; public: - - SMESHGUI_MeshEditPreview(SVTK_ViewWindow* theViewWindow); + SMESHGUI_MeshEditPreview( SVTK_ViewWindow* ); ~SMESHGUI_MeshEditPreview(); - void SetData (const SMESH::MeshPreviewStruct* theMeshPreviewStruct); - - void SetVisibility (bool theVisibility); - - void SetColor(double R, double G, double B); - - SALOME_Actor* GetActor() { return myPreviewActor; } - + void SetData( const SMESH::MeshPreviewStruct* ); + void SetVisibility( bool ); + void SetColor( double, double, double ); + SALOME_Actor* GetActor() const; }; -#endif +#endif // SMESHGUI_MESHEDITPREVIEW_H diff --git a/src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx b/src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx index 2b74c92a8..e1a5167b2 100644 --- a/src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshInfosDlg.cxx @@ -1,101 +1,95 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_MeshInfosDlg.cxx +// Author : Nicolas BARBEROU // -// -// File : SMESHGUI_MeshInfosDlg.cxx -// Author : Nicolas BARBEROU -// Module : SMESH -// $Header$ +// SMESH includes #include "SMESHGUI_MeshInfosDlg.h" #include "SMESHGUI.h" #include "SMESHGUI_Utils.h" -#include "SUIT_Desktop.h" -#include "SUIT_ResourceMgr.h" -#include "SUIT_OverrideCursor.h" -#include "SUIT_Session.h" -#include "SUIT_MessageBox.h" - -#include "LightApp_SelectionMgr.h" -#include "LightApp_Application.h" -#include "SALOMEDSClient_Study.hxx" -#include "SALOME_ListIO.hxx" - -#include "utilities.h" - -// QT Includes -#include -#include -#include -#include -#include -#include -#include - -// IDL Headers -#include "SALOMEconfig.h" +// SALOME GUI includes +#include +#include +#include +#include +#include + +#include +#include +#include + +// SALOME KERNEL includes +#include + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// IDL includes +#include #include CORBA_SERVER_HEADER(SMESH_Mesh) #include CORBA_SERVER_HEADER(SMESH_Group) -using namespace std; - #define COLONIZE(str) (QString(str).contains(":") > 0 ? QString(str) : QString(str) + " :" ) +#define SPACING 6 +#define MARGIN 11 //================================================================================= // function : SMESHGUI_MeshInfosDlg() // purpose : Constructor //================================================================================= -SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg (SMESHGUI* theModule, - const char* name, - bool modal, - WFlags fl): - QDialog(SMESH::GetDesktop(theModule), - name, - modal, - WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose), +SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg(SMESHGUI* theModule): + QDialog(SMESH::GetDesktop(theModule)), mySelectionMgr(SMESH::GetSelectionMgr(theModule)), mySMESHGUI(theModule) { - if (!name) - setName("SMESHGUI_MeshInfosDlg"); - setCaption(tr("SMESH_MESHINFO_TITLE")); - setSizeGripEnabled(TRUE); + setModal( false ); + setAttribute( Qt::WA_DeleteOnClose, true ); + setWindowTitle(tr("SMESH_MESHINFO_TITLE")); + setSizeGripEnabled(true); myStartSelection = true; myIsActiveWindow = true; QVBoxLayout* aTopLayout = new QVBoxLayout(this); - aTopLayout->setSpacing(6); aTopLayout->setMargin(11); + aTopLayout->setSpacing(SPACING); aTopLayout->setMargin(MARGIN); // select button & label QPixmap image0(SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH",tr("ICON_SELECT"))); - mySelectBtn = new QPushButton(this, "mySelectBtn"); - mySelectBtn->setPixmap(image0); - mySelectBtn->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); + mySelectBtn = new QPushButton(this); + mySelectBtn->setIcon(image0); - mySelectLab = new QLabel(this, "mySelectLab"); - mySelectLab->setAlignment(AlignCenter); + mySelectLab = new QLabel(this); + mySelectLab->setAlignment(Qt::AlignCenter); QFont fnt = mySelectLab->font(); fnt.setBold(true); mySelectLab->setFont(fnt); @@ -105,95 +99,92 @@ SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg (SMESHGUI* theModule, aSelectLayout->addWidget(mySelectLab); // top widget stack - myWGStack = new QWidgetStack(this); + myWGStack = new QStackedWidget(this); // no valid selection QWidget* myBadWidget = new QWidget(myWGStack); QVBoxLayout* aBadLayout = new QVBoxLayout(myBadWidget); - QLabel* myBadLab = new QLabel(tr("SMESH_BAD_SELECTION"), myBadWidget, "myBadLab"); + QLabel* myBadLab = new QLabel(tr("SMESH_BAD_SELECTION"), myBadWidget); myBadLab->setAlignment(Qt::AlignCenter); myBadLab->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); aBadLayout->addWidget(myBadLab); - myWGStack->addWidget(myBadWidget, 0); + myWGStack->addWidget(myBadWidget); // mesh myMeshWidget = new QWidget(myWGStack); QGridLayout* aMeshLayout = new QGridLayout(myMeshWidget); - aMeshLayout->setSpacing(6); aMeshLayout->setMargin(0); + aMeshLayout->setSpacing(SPACING); aMeshLayout->setMargin(0); myWGStack->addWidget(myMeshWidget); // --> name - QLabel* myMeshNameLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NAME")), myMeshWidget, "myMeshNameLab"); - myMeshName = new QLabel(myMeshWidget, "myMeshName"); + QLabel* myMeshNameLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NAME")), myMeshWidget); + myMeshName = new QLabel(myMeshWidget); myMeshName->setMinimumWidth(100); QFrame* line1 = new QFrame(myMeshWidget); line1->setFrameStyle(QFrame::HLine | QFrame::Sunken); // --> nodes - QLabel* myMeshNbNodesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NODES")), myMeshWidget, "myMeshNbNodesLab"); - myMeshNbNodes = new QLabel(myMeshWidget, "myMeshNbNodes"); + QLabel* myMeshNbNodesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NODES")), myMeshWidget); + myMeshNbNodes = new QLabel(myMeshWidget); myMeshNbNodes->setMinimumWidth(100); // --> header with orders - QLabel* myMeshOrder0Lab = new QLabel(tr("SMESH_MESHINFO_ORDER0"), myMeshWidget, "myMeshOrder0Lab"); - QLabel* myMeshOrder1Lab = new QLabel(tr("SMESH_MESHINFO_ORDER1"), myMeshWidget, "myMeshOrder1Lab"); - QLabel* myMeshOrder2Lab = new QLabel(tr("SMESH_MESHINFO_ORDER2"), myMeshWidget, "myMeshOrder2Lab"); + QLabel* myMeshOrder0Lab = new QLabel(tr("SMESH_MESHINFO_ORDER0"), myMeshWidget); + QLabel* myMeshOrder1Lab = new QLabel(tr("SMESH_MESHINFO_ORDER1"), myMeshWidget); + QLabel* myMeshOrder2Lab = new QLabel(tr("SMESH_MESHINFO_ORDER2"), myMeshWidget); QFont fnti = myMeshOrder0Lab->font(); fnti.setItalic(true); myMeshOrder0Lab->setFont(fnti); myMeshOrder1Lab->setFont(fnti); myMeshOrder2Lab->setFont(fnti); // --> edges - QLabel* myMeshNbEdgesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_EDGES")), myMeshWidget, "myMeshNbEdgesLab"); - myMeshNbEdges = new QLabel(myMeshWidget, "myMeshNbEdges"); + QLabel* myMeshNbEdgesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_EDGES")), myMeshWidget); + myMeshNbEdges = new QLabel(myMeshWidget); myMeshNbEdges->setMinimumWidth(100); - myMeshNbEdges1 = new QLabel(myMeshWidget, "myMeshNbEdges1"); + myMeshNbEdges1 = new QLabel(myMeshWidget); myMeshNbEdges1->setMinimumWidth(100); - myMeshNbEdges2 = new QLabel(myMeshWidget, "myMeshNbEdges2"); + myMeshNbEdges2 = new QLabel(myMeshWidget); myMeshNbEdges2->setMinimumWidth(100); // --> faces - myMeshFacesGroup = new QGroupBox(tr("SMESH_MESHINFO_FACES"), myMeshWidget, "myMeshFacesGroup"); - myMeshFacesGroup->setColumnLayout(0, Qt::Vertical); - myMeshFacesGroup->layout()->setSpacing(0); myMeshFacesGroup->layout()->setMargin(0); - QGridLayout* myMeshFacesGroupLayout = new QGridLayout(myMeshFacesGroup->layout()); - myMeshFacesGroupLayout->setAlignment(Qt::AlignTop); - myMeshFacesGroupLayout->setSpacing(6); myMeshFacesGroupLayout->setMargin(11); + myMeshFacesGroup = new QGroupBox(tr("SMESH_MESHINFO_FACES"), myMeshWidget); + QGridLayout* myMeshFacesGroupLayout = new QGridLayout(myMeshFacesGroup); + myMeshFacesGroupLayout->setSpacing(SPACING); myMeshFacesGroupLayout->setMargin(MARGIN); // --> faces --> total - QLabel* myMeshNbFacesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TOTAL")), myMeshFacesGroup, "myMeshNbFacesLab"); + QLabel* myMeshNbFacesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TOTAL")), myMeshFacesGroup); myMeshNbFacesLab->setFont(fnt); - myMeshNbFaces = new QLabel(myMeshFacesGroup, "myMeshNbFaces"); + myMeshNbFaces = new QLabel(myMeshFacesGroup); myMeshNbFaces->setMinimumWidth(100); myMeshNbFaces->setFont(fnt); - myMeshNbFaces1 = new QLabel(myMeshFacesGroup, "myMeshNbFaces1"); + myMeshNbFaces1 = new QLabel(myMeshFacesGroup); myMeshNbFaces1->setMinimumWidth(100); myMeshNbFaces1->setFont(fnt); - myMeshNbFaces2 = new QLabel(myMeshFacesGroup, "myMeshNbFaces2"); + myMeshNbFaces2 = new QLabel(myMeshFacesGroup); myMeshNbFaces2->setMinimumWidth(100); myMeshNbFaces2->setFont(fnt); // --> faces --> triangles - QLabel* myMeshNbTrianglesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TRIANGLES")), myMeshFacesGroup, "myMeshNbTrianglesLab"); - myMeshNbTriangles = new QLabel(myMeshFacesGroup, "myMeshNbTriangles"); + QLabel* myMeshNbTrianglesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TRIANGLES")), myMeshFacesGroup); + myMeshNbTriangles = new QLabel(myMeshFacesGroup); myMeshNbTriangles->setMinimumWidth(100); - myMeshNbTriangles1 = new QLabel(myMeshFacesGroup, "myMeshNbTriangles1"); + myMeshNbTriangles1 = new QLabel(myMeshFacesGroup); myMeshNbTriangles1->setMinimumWidth(100); - myMeshNbTriangles2 = new QLabel(myMeshFacesGroup, "myMeshNbTriangles2"); + myMeshNbTriangles2 = new QLabel(myMeshFacesGroup); myMeshNbTriangles2->setMinimumWidth(100); // --> faces --> quadrangles - QLabel* myMeshNbQuadranglesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_QUADRANGLES")), myMeshFacesGroup, "myMeshNbQuadranglesLab"); - myMeshNbQuadrangles = new QLabel(myMeshFacesGroup, "myMeshNbQuadrangles"); + QLabel* myMeshNbQuadranglesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_QUADRANGLES")), myMeshFacesGroup); + myMeshNbQuadrangles = new QLabel(myMeshFacesGroup); myMeshNbQuadrangles->setMinimumWidth(100); - myMeshNbQuadrangles1 = new QLabel(myMeshFacesGroup, "myMeshNbQuadrangles1"); + myMeshNbQuadrangles1 = new QLabel(myMeshFacesGroup); myMeshNbQuadrangles1->setMinimumWidth(100); - myMeshNbQuadrangles2 = new QLabel(myMeshFacesGroup, "myMeshNbQuadrangles2"); + myMeshNbQuadrangles2 = new QLabel(myMeshFacesGroup); myMeshNbQuadrangles2->setMinimumWidth(100); // --> faces --> polygons - QLabel* myMeshNbPolygonesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_POLYGONES" ) ), myMeshFacesGroup, "myMeshNbPolygonesLab" ); - myMeshNbPolygones = new QLabel( myMeshFacesGroup, "myMeshNbPolygones" ); + QLabel* myMeshNbPolygonesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_POLYGONES" ) ), myMeshFacesGroup ); + myMeshNbPolygones = new QLabel( myMeshFacesGroup ); myMeshNbPolygones->setMinimumWidth( 100 ); myMeshFacesGroupLayout->addWidget(myMeshNbFacesLab, 0, 0); @@ -208,156 +199,150 @@ SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg (SMESHGUI* theModule, myMeshFacesGroupLayout->addWidget(myMeshNbQuadrangles, 2, 1); myMeshFacesGroupLayout->addWidget(myMeshNbQuadrangles1, 2, 2); myMeshFacesGroupLayout->addWidget(myMeshNbQuadrangles2, 2, 3); - myMeshFacesGroupLayout->addWidget( myMeshNbPolygonesLab, 3, 0 ); - myMeshFacesGroupLayout->addWidget( myMeshNbPolygones, 3, 1 ); + myMeshFacesGroupLayout->addWidget(myMeshNbPolygonesLab, 3, 0); + myMeshFacesGroupLayout->addWidget(myMeshNbPolygones, 3, 1); // --> volumes - myMeshVolumesGroup = new QGroupBox(tr("SMESH_MESHINFO_VOLUMES"), myMeshWidget, "myMeshVolumesGroup"); - myMeshVolumesGroup->setColumnLayout(0, Qt::Vertical); - myMeshVolumesGroup->layout()->setSpacing(0); myMeshVolumesGroup->layout()->setMargin(0); - QGridLayout* myMeshVolumesGroupLayout = new QGridLayout(myMeshVolumesGroup->layout()); - myMeshVolumesGroupLayout->setAlignment(Qt::AlignTop); - myMeshVolumesGroupLayout->setSpacing(6); myMeshVolumesGroupLayout->setMargin(11); + myMeshVolumesGroup = new QGroupBox(tr("SMESH_MESHINFO_VOLUMES"), myMeshWidget); + QGridLayout* myMeshVolumesGroupLayout = new QGridLayout(myMeshVolumesGroup); + myMeshVolumesGroupLayout->setSpacing(SPACING); myMeshVolumesGroupLayout->setMargin(MARGIN); // --> volumes --> total - QLabel* myMeshNbVolumesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TOTAL")), myMeshVolumesGroup, "myMeshNbVolumesLab"); + QLabel* myMeshNbVolumesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TOTAL")), myMeshVolumesGroup); myMeshNbVolumesLab->setFont(fnt); - myMeshNbVolumes = new QLabel(myMeshVolumesGroup, "myMeshNbVolumes"); + myMeshNbVolumes = new QLabel(myMeshVolumesGroup); myMeshNbVolumes->setMinimumWidth(100); myMeshNbVolumes->setFont(fnt); - myMeshNbVolumes1 = new QLabel(myMeshVolumesGroup, "myMeshNbVolumes1"); + myMeshNbVolumes1 = new QLabel(myMeshVolumesGroup); myMeshNbVolumes1->setMinimumWidth(100); myMeshNbVolumes1->setFont(fnt); - myMeshNbVolumes2 = new QLabel(myMeshVolumesGroup, "myMeshNbVolumes2"); + myMeshNbVolumes2 = new QLabel(myMeshVolumesGroup); myMeshNbVolumes2->setMinimumWidth(100); myMeshNbVolumes2->setFont(fnt); // --> volumes --> tetrahedrons - QLabel* myMeshNbTetraLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TETRAS")), myMeshVolumesGroup, "myMeshNbTetraLab"); - myMeshNbTetra = new QLabel(myMeshVolumesGroup, "myMeshNbTetra"); + QLabel* myMeshNbTetraLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TETRAS")), myMeshVolumesGroup); + myMeshNbTetra = new QLabel(myMeshVolumesGroup); myMeshNbTetra->setMinimumWidth(100); - myMeshNbTetra1 = new QLabel(myMeshVolumesGroup, "myMeshNbTetra1"); + myMeshNbTetra1 = new QLabel(myMeshVolumesGroup); myMeshNbTetra1->setMinimumWidth(100); - myMeshNbTetra2 = new QLabel(myMeshVolumesGroup, "myMeshNbTetra2"); + myMeshNbTetra2 = new QLabel(myMeshVolumesGroup); myMeshNbTetra2->setMinimumWidth(100); // --> volumes --> hexahedrons - QLabel* myMeshNbHexaLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_HEXAS")), myMeshVolumesGroup, "myMeshNbHexaLab"); - myMeshNbHexa = new QLabel(myMeshVolumesGroup, "myMeshNbHexa"); + QLabel* myMeshNbHexaLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_HEXAS")), myMeshVolumesGroup); + myMeshNbHexa = new QLabel(myMeshVolumesGroup); myMeshNbHexa->setMinimumWidth(100); - myMeshNbHexa1 = new QLabel(myMeshVolumesGroup, "myMeshNbHexa1"); + myMeshNbHexa1 = new QLabel(myMeshVolumesGroup); myMeshNbHexa1->setMinimumWidth(100); - myMeshNbHexa2 = new QLabel(myMeshVolumesGroup, "myMeshNbHexa2"); + myMeshNbHexa2 = new QLabel(myMeshVolumesGroup); myMeshNbHexa2->setMinimumWidth(100); // --> volumes --> prisms - QLabel* myMeshNbPrismLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_PRISMS")), myMeshVolumesGroup, "myMeshNbPrismLab"); - myMeshNbPrism = new QLabel(myMeshVolumesGroup, "myMeshNbPrism"); + QLabel* myMeshNbPrismLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_PRISMS")), myMeshVolumesGroup); + myMeshNbPrism = new QLabel(myMeshVolumesGroup); myMeshNbPrism->setMinimumWidth(100); - myMeshNbPrism1 = new QLabel(myMeshVolumesGroup, "myMeshNbPrism1"); + myMeshNbPrism1 = new QLabel(myMeshVolumesGroup); myMeshNbPrism1->setMinimumWidth(100); - myMeshNbPrism2 = new QLabel(myMeshVolumesGroup, "myMeshNbPrism2"); + myMeshNbPrism2 = new QLabel(myMeshVolumesGroup); myMeshNbPrism2->setMinimumWidth(100); // --> volumes --> pyramids - QLabel* myMeshNbPyraLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_PYRAS")), myMeshVolumesGroup, "myMeshNbPyraLab"); - myMeshNbPyra = new QLabel(myMeshVolumesGroup, "myMeshNbPyra"); + QLabel* myMeshNbPyraLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_PYRAS")), myMeshVolumesGroup); + myMeshNbPyra = new QLabel(myMeshVolumesGroup); myMeshNbPyra->setMinimumWidth(100); - myMeshNbPyra1 = new QLabel(myMeshVolumesGroup, "myMeshNbPyra1"); + myMeshNbPyra1 = new QLabel(myMeshVolumesGroup); myMeshNbPyra1->setMinimumWidth(100); - myMeshNbPyra2 = new QLabel(myMeshVolumesGroup, "myMeshNbPyra2"); + myMeshNbPyra2 = new QLabel(myMeshVolumesGroup); myMeshNbPyra2->setMinimumWidth(100); // --> volumes --> polyherones - QLabel* myMeshNbPolyhedronesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_POLYEDRES" ) ), myMeshVolumesGroup, "myMeshNbPolyhedronLab" ); - myMeshNbPolyhedrones = new QLabel( myMeshVolumesGroup, "myMeshNbPolyhedrones" ); + QLabel* myMeshNbPolyhedronesLab = new QLabel( COLONIZE( tr( "SMESH_MESHINFO_POLYEDRES" ) ), myMeshVolumesGroup ); + myMeshNbPolyhedrones = new QLabel( myMeshVolumesGroup ); myMeshNbPolyhedrones->setMinimumWidth( 100 ); - myMeshVolumesGroupLayout->addWidget(myMeshNbVolumesLab, 0, 0); - myMeshVolumesGroupLayout->addWidget(myMeshNbVolumes, 0, 1); - myMeshVolumesGroupLayout->addWidget(myMeshNbVolumes1, 0, 2); - myMeshVolumesGroupLayout->addWidget(myMeshNbVolumes2, 0, 3); - myMeshVolumesGroupLayout->addWidget(myMeshNbTetraLab, 1, 0); - myMeshVolumesGroupLayout->addWidget(myMeshNbTetra, 1, 1); - myMeshVolumesGroupLayout->addWidget(myMeshNbTetra1, 1, 2); - myMeshVolumesGroupLayout->addWidget(myMeshNbTetra2, 1, 3); - myMeshVolumesGroupLayout->addWidget(myMeshNbHexaLab, 2, 0); - myMeshVolumesGroupLayout->addWidget(myMeshNbHexa, 2, 1); - myMeshVolumesGroupLayout->addWidget(myMeshNbHexa1, 2, 2); - myMeshVolumesGroupLayout->addWidget(myMeshNbHexa2, 2, 3); - myMeshVolumesGroupLayout->addWidget(myMeshNbPrismLab, 3, 0); - myMeshVolumesGroupLayout->addWidget(myMeshNbPrism, 3, 1); - myMeshVolumesGroupLayout->addWidget(myMeshNbPrism1, 3, 2); - myMeshVolumesGroupLayout->addWidget(myMeshNbPrism2, 3, 3); - myMeshVolumesGroupLayout->addWidget(myMeshNbPyraLab, 4, 0); - myMeshVolumesGroupLayout->addWidget(myMeshNbPyra, 4, 1); - myMeshVolumesGroupLayout->addWidget(myMeshNbPyra1, 4, 2); - myMeshVolumesGroupLayout->addWidget(myMeshNbPyra2, 4, 3); - myMeshVolumesGroupLayout->addWidget( myMeshNbPolyhedronesLab, 5, 0 ); - myMeshVolumesGroupLayout->addWidget( myMeshNbPolyhedrones, 5, 1 ); - - aMeshLayout->addWidget(myMeshNameLab, 0, 0); - aMeshLayout->addWidget(myMeshName, 0, 1); - aMeshLayout->addMultiCellWidget(line1, 1, 1, 0, 1); - aMeshLayout->addWidget(myMeshNbNodesLab, 2, 0); - aMeshLayout->addWidget(myMeshNbNodes, 2, 1); - aMeshLayout->addWidget(myMeshOrder0Lab, 3, 1); - aMeshLayout->addWidget(myMeshOrder1Lab, 3, 2); - aMeshLayout->addWidget(myMeshOrder2Lab, 3, 3); - aMeshLayout->addWidget(myMeshNbEdgesLab, 4, 0); - aMeshLayout->addWidget(myMeshNbEdges, 4, 1); - aMeshLayout->addWidget(myMeshNbEdges1, 4, 2); - aMeshLayout->addWidget(myMeshNbEdges2, 4, 3); - aMeshLayout->addMultiCellWidget(myMeshFacesGroup, 5, 5, 0, 3); - aMeshLayout->addMultiCellWidget(myMeshVolumesGroup, 6, 6, 0, 3); - aMeshLayout->addItem(new QSpacerItem(6, 6, QSizePolicy::Minimum, QSizePolicy::Expanding), 7, 0); + myMeshVolumesGroupLayout->addWidget(myMeshNbVolumesLab, 0, 0); + myMeshVolumesGroupLayout->addWidget(myMeshNbVolumes, 0, 1); + myMeshVolumesGroupLayout->addWidget(myMeshNbVolumes1, 0, 2); + myMeshVolumesGroupLayout->addWidget(myMeshNbVolumes2, 0, 3); + myMeshVolumesGroupLayout->addWidget(myMeshNbTetraLab, 1, 0); + myMeshVolumesGroupLayout->addWidget(myMeshNbTetra, 1, 1); + myMeshVolumesGroupLayout->addWidget(myMeshNbTetra1, 1, 2); + myMeshVolumesGroupLayout->addWidget(myMeshNbTetra2, 1, 3); + myMeshVolumesGroupLayout->addWidget(myMeshNbHexaLab, 2, 0); + myMeshVolumesGroupLayout->addWidget(myMeshNbHexa, 2, 1); + myMeshVolumesGroupLayout->addWidget(myMeshNbHexa1, 2, 2); + myMeshVolumesGroupLayout->addWidget(myMeshNbHexa2, 2, 3); + myMeshVolumesGroupLayout->addWidget(myMeshNbPrismLab, 3, 0); + myMeshVolumesGroupLayout->addWidget(myMeshNbPrism, 3, 1); + myMeshVolumesGroupLayout->addWidget(myMeshNbPrism1, 3, 2); + myMeshVolumesGroupLayout->addWidget(myMeshNbPrism2, 3, 3); + myMeshVolumesGroupLayout->addWidget(myMeshNbPyraLab, 4, 0); + myMeshVolumesGroupLayout->addWidget(myMeshNbPyra, 4, 1); + myMeshVolumesGroupLayout->addWidget(myMeshNbPyra1, 4, 2); + myMeshVolumesGroupLayout->addWidget(myMeshNbPyra2, 4, 3); + myMeshVolumesGroupLayout->addWidget(myMeshNbPolyhedronesLab, 5, 0); + myMeshVolumesGroupLayout->addWidget(myMeshNbPolyhedrones, 5, 1); + + aMeshLayout->addWidget(myMeshNameLab, 0, 0); + aMeshLayout->addWidget(myMeshName, 0, 1); + aMeshLayout->addWidget(line1, 1, 0, 1, 2); + aMeshLayout->addWidget(myMeshNbNodesLab, 2, 0); + aMeshLayout->addWidget(myMeshNbNodes, 2, 1); + aMeshLayout->addWidget(myMeshOrder0Lab, 3, 1); + aMeshLayout->addWidget(myMeshOrder1Lab, 3, 2); + aMeshLayout->addWidget(myMeshOrder2Lab, 3, 3); + aMeshLayout->addWidget(myMeshNbEdgesLab, 4, 0); + aMeshLayout->addWidget(myMeshNbEdges, 4, 1); + aMeshLayout->addWidget(myMeshNbEdges1, 4, 2); + aMeshLayout->addWidget(myMeshNbEdges2, 4, 3); + aMeshLayout->addWidget(myMeshFacesGroup, 5, 0, 1, 4); + aMeshLayout->addWidget(myMeshVolumesGroup, 6, 0, 1, 4); + aMeshLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 7, 0); // submesh mySubMeshWidget = new QWidget(myWGStack); QGridLayout* aSubMeshLayout = new QGridLayout(mySubMeshWidget); - aSubMeshLayout->setSpacing(6); aSubMeshLayout->setMargin(0); + aSubMeshLayout->setSpacing(SPACING); aSubMeshLayout->setMargin(0); myWGStack->addWidget(mySubMeshWidget); // --> name - QLabel* mySubMeshNameLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NAME")), mySubMeshWidget, "mySubMeshNameLab"); - mySubMeshName = new QLabel(mySubMeshWidget, "mySubMeshName"); + QLabel* mySubMeshNameLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NAME")), mySubMeshWidget); + mySubMeshName = new QLabel(mySubMeshWidget); mySubMeshName->setMinimumWidth(100); QFrame* line2 = new QFrame(mySubMeshWidget); line2->setFrameStyle(QFrame::HLine | QFrame::Sunken); // --> nodes - QLabel* mySubMeshNbNodesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NODES")), mySubMeshWidget, "mySubMeshNbNodesLab"); - mySubMeshNbNodes = new QLabel(mySubMeshWidget, "mySubMeshNbNodes"); + QLabel* mySubMeshNbNodesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NODES")), mySubMeshWidget); + mySubMeshNbNodes = new QLabel(mySubMeshWidget); mySubMeshNbNodes->setMinimumWidth(100); // --> elements - mySubMeshElementsGroup = new QGroupBox(tr("SMESH_MESHINFO_ELEMENTS"), mySubMeshWidget, "mySubMeshElementsGroup"); - mySubMeshElementsGroup->setColumnLayout(0, Qt::Vertical); - mySubMeshElementsGroup->layout()->setSpacing(0); mySubMeshElementsGroup->layout()->setMargin(0); - QGridLayout* mySubMeshElementsGroupLayout = new QGridLayout(mySubMeshElementsGroup->layout()); - mySubMeshElementsGroupLayout->setAlignment(Qt::AlignTop); - mySubMeshElementsGroupLayout->setSpacing(6); mySubMeshElementsGroupLayout->setMargin(11); + mySubMeshElementsGroup = new QGroupBox(tr("SMESH_MESHINFO_ELEMENTS"), mySubMeshWidget); + QGridLayout* mySubMeshElementsGroupLayout = new QGridLayout(mySubMeshElementsGroup); + mySubMeshElementsGroupLayout->setSpacing(SPACING); mySubMeshElementsGroupLayout->setMargin(MARGIN); // --> elements --> total - QLabel* mySubMeshNbElementsLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TOTAL")), mySubMeshElementsGroup, "mySubMeshNbElementsLab"); + QLabel* mySubMeshNbElementsLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TOTAL")), mySubMeshElementsGroup); mySubMeshNbElementsLab->setFont(fnt); - mySubMeshNbElements = new QLabel(mySubMeshElementsGroup, "mySubMeshNbElements"); + mySubMeshNbElements = new QLabel(mySubMeshElementsGroup); mySubMeshNbElements->setMinimumWidth(100); mySubMeshNbElements->setFont(fnt); // --> elements --> edges - QLabel* mySubMeshNbEdgesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_EDGES")), mySubMeshElementsGroup, "mySubMeshNbEdgesLab"); - mySubMeshNbEdges = new QLabel(mySubMeshElementsGroup, "mySubMeshNbEdges"); + QLabel* mySubMeshNbEdgesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_EDGES")), mySubMeshElementsGroup); + mySubMeshNbEdges = new QLabel(mySubMeshElementsGroup); mySubMeshNbEdges->setMinimumWidth(100); // --> elements --> faces - QLabel* mySubMeshNbFacesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_FACES")), mySubMeshElementsGroup, "mySubMeshNbFacesLab"); - mySubMeshNbFaces = new QLabel(mySubMeshElementsGroup, "mySubMeshNbFaces"); + QLabel* mySubMeshNbFacesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_FACES")), mySubMeshElementsGroup); + mySubMeshNbFaces = new QLabel(mySubMeshElementsGroup); mySubMeshNbFaces->setMinimumWidth(100); // --> elements --> volumes - QLabel* mySubMeshNbVolumesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_VOLUMES")), mySubMeshElementsGroup, "mySubMeshNbVolumesLab"); - mySubMeshNbVolumes = new QLabel(mySubMeshElementsGroup, "mySubMeshNbVolumes"); + QLabel* mySubMeshNbVolumesLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_VOLUMES")), mySubMeshElementsGroup); + mySubMeshNbVolumes = new QLabel(mySubMeshElementsGroup); mySubMeshNbVolumes->setMinimumWidth(100); mySubMeshElementsGroupLayout->addWidget(mySubMeshNbElementsLab, 0, 0); @@ -369,61 +354,59 @@ SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg (SMESHGUI* theModule, mySubMeshElementsGroupLayout->addWidget(mySubMeshNbVolumesLab, 3, 0); mySubMeshElementsGroupLayout->addWidget(mySubMeshNbVolumes, 3, 1); - aSubMeshLayout->addWidget(mySubMeshNameLab, 0, 0); - aSubMeshLayout->addWidget(mySubMeshName, 0, 1); - aSubMeshLayout->addMultiCellWidget(line2, 1, 1, 0, 1); - aSubMeshLayout->addWidget(mySubMeshNbNodesLab, 2, 0); - aSubMeshLayout->addWidget(mySubMeshNbNodes, 2, 1); - aSubMeshLayout->addMultiCellWidget(mySubMeshElementsGroup, 3, 3, 0, 1); - aSubMeshLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Minimum, QSizePolicy::Expanding), 4, 0); + aSubMeshLayout->addWidget(mySubMeshNameLab, 0, 0); + aSubMeshLayout->addWidget(mySubMeshName, 0, 1); + aSubMeshLayout->addWidget(line2, 1, 0, 1, 2); + aSubMeshLayout->addWidget(mySubMeshNbNodesLab, 2, 0); + aSubMeshLayout->addWidget(mySubMeshNbNodes, 2, 1); + aSubMeshLayout->addWidget(mySubMeshElementsGroup, 3, 0, 1, 2); + aSubMeshLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 4, 0); // group myGroupWidget = new QWidget(myWGStack); QGridLayout* myGroupWidgetLayout = new QGridLayout(myGroupWidget); - myGroupWidgetLayout->setSpacing(6); myGroupWidgetLayout->setMargin(0); + myGroupWidgetLayout->setSpacing(SPACING); myGroupWidgetLayout->setMargin(0); myWGStack->addWidget(myGroupWidget); // --> name - QLabel* myGroupNameLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NAME")), myGroupWidget, "myGroupNameLab"); - myGroupName = new QLabel(myGroupWidget, "myGroupName"); + QLabel* myGroupNameLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_NAME")), myGroupWidget); + myGroupName = new QLabel(myGroupWidget); myGroupName->setMinimumWidth(100); QFrame* line3 = new QFrame(myGroupWidget); line3->setFrameStyle(QFrame::HLine | QFrame::Sunken); // --> type - QLabel* myGroupTypeLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TYPE")), myGroupWidget, "myGroupTypeLab"); - myGroupType = new QLabel(myGroupWidget, "myGroupType"); + QLabel* myGroupTypeLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_TYPE")), myGroupWidget); + myGroupType = new QLabel(myGroupWidget); myGroupType->setMinimumWidth(100); // --> number of entities - QLabel* myGroupNbLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_ENTITIES")), myGroupWidget, "myGroupNbLab"); - myGroupNb = new QLabel(myGroupWidget, "myGroupNb"); + QLabel* myGroupNbLab = new QLabel(COLONIZE(tr("SMESH_MESHINFO_ENTITIES")), myGroupWidget); + myGroupNb = new QLabel(myGroupWidget); myGroupNb->setMinimumWidth(100); - myGroupWidgetLayout->addWidget(myGroupNameLab, 0, 0); - myGroupWidgetLayout->addWidget(myGroupName, 0, 1); - myGroupWidgetLayout->addMultiCellWidget(line3, 1, 1, 0, 1); - myGroupWidgetLayout->addWidget(myGroupTypeLab, 2, 0); - myGroupWidgetLayout->addWidget(myGroupType, 2, 1); - myGroupWidgetLayout->addWidget(myGroupNbLab, 3, 0); - myGroupWidgetLayout->addWidget(myGroupNb, 3, 1); - myGroupWidgetLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Minimum, QSizePolicy::Expanding), 4, 0); + myGroupWidgetLayout->addWidget(myGroupNameLab, 0, 0); + myGroupWidgetLayout->addWidget(myGroupName, 0, 1); + myGroupWidgetLayout->addWidget(line3, 1, 0, 1, 2); + myGroupWidgetLayout->addWidget(myGroupTypeLab, 2, 0); + myGroupWidgetLayout->addWidget(myGroupType, 2, 1); + myGroupWidgetLayout->addWidget(myGroupNbLab, 3, 0); + myGroupWidgetLayout->addWidget(myGroupNb, 3, 1); + myGroupWidgetLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 4, 0); // buttons - myButtonsGroup = new QGroupBox(this, "myButtonsGroup"); - myButtonsGroup->setColumnLayout(0, Qt::Vertical); - myButtonsGroup->layout()->setSpacing(0); myButtonsGroup->layout()->setMargin(0); - QHBoxLayout* myButtonsGroupLayout = new QHBoxLayout(myButtonsGroup->layout()); - myButtonsGroupLayout->setAlignment(Qt::AlignTop); - myButtonsGroupLayout->setSpacing(6); myButtonsGroupLayout->setMargin(11); + myButtonsGroup = new QGroupBox(this); + QHBoxLayout* myButtonsGroupLayout = new QHBoxLayout(myButtonsGroup); + myButtonsGroupLayout->setSpacing(SPACING); myButtonsGroupLayout->setMargin(MARGIN); // buttons --> OK and Help buttons - myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), myButtonsGroup, "myOkBtn"); - myOkBtn->setAutoDefault(TRUE); myOkBtn->setDefault(TRUE); - myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP" ), myButtonsGroup, "myHelpBtn"); - myHelpBtn->setAutoDefault(TRUE); + myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), myButtonsGroup); + myOkBtn->setAutoDefault(true); myOkBtn->setDefault(true); + myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP" ), myButtonsGroup); + myHelpBtn->setAutoDefault(true); myButtonsGroupLayout->addWidget(myOkBtn); + myButtonsGroupLayout->addSpacing(10); myButtonsGroupLayout->addStretch(); myButtonsGroupLayout->addWidget(myHelpBtn); @@ -441,8 +424,6 @@ SMESHGUI_MeshInfosDlg::SMESHGUI_MeshInfosDlg (SMESHGUI* theModule, connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged())); - this->show(); - // init dialog with current selection onSelectionChanged(); @@ -480,8 +461,8 @@ void SMESHGUI_MeshInfosDlg::DumpMeshInfos() if (!CORBA::is_nil(anObject)) { SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow(anObject); if (!aMesh->_is_nil()) { - myWGStack->raiseWidget(myMeshWidget); - setCaption(tr("SMESH_MESHINFO_TITLE") + " [" + tr("SMESH_OBJECT_MESH") + "]"); + myWGStack->setCurrentWidget(myMeshWidget); + setWindowTitle(tr("SMESH_MESHINFO_TITLE") + " [" + tr("SMESH_OBJECT_MESH") + "]"); myMeshName->setText(aSO->GetName().c_str()); myMeshNbNodes->setNum((int)aMesh->NbNodes()); myMeshNbEdges->setNum((int)aMesh->NbEdges()); @@ -517,8 +498,8 @@ void SMESHGUI_MeshInfosDlg::DumpMeshInfos() } SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(anObject); if (!aSubMesh->_is_nil()) { - myWGStack->raiseWidget(mySubMeshWidget); - setCaption(tr("SMESH_MESHINFO_TITLE") + " [" + tr("SMESH_SUBMESH") + "]"); + myWGStack->setCurrentWidget(mySubMeshWidget); + setWindowTitle(tr("SMESH_MESHINFO_TITLE") + " [" + tr("SMESH_SUBMESH") + "]"); mySubMeshName->setText(aSO->GetName().c_str()); mySubMeshNbNodes->setNum((int)aSubMesh->GetNumberOfNodes(true)); mySubMeshNbElements->setNum((int)aSubMesh->GetNumberOfElements()); @@ -529,8 +510,8 @@ void SMESHGUI_MeshInfosDlg::DumpMeshInfos() } SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObject); if (!aGroup->_is_nil()) { - myWGStack->raiseWidget(myGroupWidget); - setCaption(tr("SMESH_MESHINFO_TITLE") + " [" + tr("SMESH_GROUP") + "]"); + myWGStack->setCurrentWidget(myGroupWidget); + setWindowTitle(tr("SMESH_MESHINFO_TITLE") + " [" + tr("SMESH_GROUP") + "]"); myGroupName->setText(aSO->GetName().c_str()); int aType = aGroup->GetType(); QString strType; @@ -547,15 +528,15 @@ void SMESHGUI_MeshInfosDlg::DumpMeshInfos() strType = "SMESH_MESHINFO_ALL_TYPES"; break; } - myGroupType->setText(tr(strType)); + myGroupType->setText(tr(strType.toLatin1().data())); myGroupNb->setNum((int)aGroup->Size()); return; } } } } - myWGStack->raiseWidget(0); - setCaption(tr("SMESH_MESHINFO_TITLE")); + myWGStack->setCurrentIndex(0); + setWindowTitle(tr("SMESH_MESHINFO_TITLE")); } //================================================================================= @@ -572,7 +553,7 @@ void SMESHGUI_MeshInfosDlg::onSelectionChanged() // function : closeEvent() // purpose : //================================================================================= -void SMESHGUI_MeshInfosDlg::closeEvent (QCloseEvent* e) +void SMESHGUI_MeshInfosDlg::closeEvent(QCloseEvent* e) { mySMESHGUI->ResetState(); QDialog::closeEvent(e); @@ -582,7 +563,7 @@ void SMESHGUI_MeshInfosDlg::closeEvent (QCloseEvent* e) // function : windowActivationChange() // purpose : called when window is activated/deactivated //================================================================================= -void SMESHGUI_MeshInfosDlg::windowActivationChange (bool oldActive) +void SMESHGUI_MeshInfosDlg::windowActivationChange(bool oldActive) { QDialog::windowActivationChange(oldActive); if (isActiveWindow() && myIsActiveWindow != isActiveWindow()) @@ -632,16 +613,17 @@ void SMESHGUI_MeshInfosDlg::onHelp() if (app) app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); else { - QString platform; + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName)); } } @@ -655,9 +637,8 @@ void SMESHGUI_MeshInfosDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) - { - e->accept(); - onHelp(); - } + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + onHelp(); + } } diff --git a/src/SMESHGUI/SMESHGUI_MeshInfosDlg.h b/src/SMESHGUI/SMESHGUI_MeshInfosDlg.h index d8925c5d8..2e4499a0a 100644 --- a/src/SMESHGUI/SMESHGUI_MeshInfosDlg.h +++ b/src/SMESHGUI/SMESHGUI_MeshInfosDlg.h @@ -1,136 +1,131 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_MeshInfosDlg.h +// Author : Nicolas BARBEROU // -// File : SMESHGUI_MeshInfosDlg.h -// Author : Nicolas BARBEROU -// Module : SMESH -// $Header$ #ifndef SMESHGUI_MESHINFOSDLG_H #define SMESHGUI_MESHINFOSDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -// QT Includes -#include +// Qt includes +#include class QGroupBox; class QLabel; class QPushButton; -class QWidgetStack; +class QStackedWidget; class LightApp_SelectionMgr; class SMESHGUI; class SMESHGUI_EXPORT SMESHGUI_MeshInfosDlg : public QDialog { - Q_OBJECT + Q_OBJECT public: - SMESHGUI_MeshInfosDlg( SMESHGUI* theModule, - const char* name = 0, - bool modal = FALSE, - WFlags fl = 0 ); - ~SMESHGUI_MeshInfosDlg(); + SMESHGUI_MeshInfosDlg( SMESHGUI* ); + ~SMESHGUI_MeshInfosDlg(); protected: - void closeEvent( QCloseEvent* e ); - void keyPressEvent( QKeyEvent* e ); - void windowActivationChange( bool oldActive ); - void DumpMeshInfos(); + void closeEvent( QCloseEvent* ); + void keyPressEvent( QKeyEvent* ); + void windowActivationChange( bool ); + void DumpMeshInfos(); private slots: - void onSelectionChanged(); - void DeactivateActiveDialog() ; - void ActivateThisDialog(); - void onStartSelection(); - void onHelp(); + void onSelectionChanged(); + void DeactivateActiveDialog(); + void ActivateThisDialog(); + void onStartSelection(); + void onHelp(); private: - SMESHGUI* mySMESHGUI; - LightApp_SelectionMgr* mySelectionMgr; - bool myStartSelection; - bool myIsActiveWindow; - - QPushButton* mySelectBtn; - QLabel* mySelectLab; - - QWidgetStack* myWGStack; - - QWidget* myMeshWidget; - QLabel* myMeshName; - QLabel* myMeshNbNodes; - QLabel* myMeshNbEdges; - QLabel* myMeshNbEdges1; - QLabel* myMeshNbEdges2; - QGroupBox* myMeshFacesGroup; - QLabel* myMeshNbFaces; - QLabel* myMeshNbFaces1; - QLabel* myMeshNbFaces2; - QLabel* myMeshNbTriangles; - QLabel* myMeshNbTriangles1; - QLabel* myMeshNbTriangles2; - QLabel* myMeshNbQuadrangles; - QLabel* myMeshNbQuadrangles1; - QLabel* myMeshNbQuadrangles2; - QLabel* myMeshNbPolygones; - QGroupBox* myMeshVolumesGroup; - QLabel* myMeshNbVolumes; - QLabel* myMeshNbVolumes1; - QLabel* myMeshNbVolumes2; - QLabel* myMeshNbTetra; - QLabel* myMeshNbTetra1; - QLabel* myMeshNbTetra2; - QLabel* myMeshNbHexa; - QLabel* myMeshNbHexa1; - QLabel* myMeshNbHexa2; - QLabel* myMeshNbPyra; - QLabel* myMeshNbPyra1; - QLabel* myMeshNbPyra2; - QLabel* myMeshNbPrism; - QLabel* myMeshNbPrism1; - QLabel* myMeshNbPrism2; - QLabel* myMeshNbPolyhedrones; - - QWidget* mySubMeshWidget; - QLabel* mySubMeshName; - QLabel* mySubMeshNbNodes; - QGroupBox* mySubMeshElementsGroup; - QLabel* mySubMeshNbElements; - QLabel* mySubMeshNbEdges; - QLabel* mySubMeshNbFaces; - QLabel* mySubMeshNbVolumes; - - QWidget* myGroupWidget; - QLabel* myGroupName; - QLabel* myGroupType; - QLabel* myGroupNb; - - QGroupBox* myButtonsGroup; - QPushButton* myOkBtn; - QPushButton* myHelpBtn; - - QString myHelpFileName; + SMESHGUI* mySMESHGUI; + LightApp_SelectionMgr* mySelectionMgr; + bool myStartSelection; + bool myIsActiveWindow; + + QPushButton* mySelectBtn; + QLabel* mySelectLab; + + QStackedWidget* myWGStack; + + QWidget* myMeshWidget; + QLabel* myMeshName; + QLabel* myMeshNbNodes; + QLabel* myMeshNbEdges; + QLabel* myMeshNbEdges1; + QLabel* myMeshNbEdges2; + QGroupBox* myMeshFacesGroup; + QLabel* myMeshNbFaces; + QLabel* myMeshNbFaces1; + QLabel* myMeshNbFaces2; + QLabel* myMeshNbTriangles; + QLabel* myMeshNbTriangles1; + QLabel* myMeshNbTriangles2; + QLabel* myMeshNbQuadrangles; + QLabel* myMeshNbQuadrangles1; + QLabel* myMeshNbQuadrangles2; + QLabel* myMeshNbPolygones; + QGroupBox* myMeshVolumesGroup; + QLabel* myMeshNbVolumes; + QLabel* myMeshNbVolumes1; + QLabel* myMeshNbVolumes2; + QLabel* myMeshNbTetra; + QLabel* myMeshNbTetra1; + QLabel* myMeshNbTetra2; + QLabel* myMeshNbHexa; + QLabel* myMeshNbHexa1; + QLabel* myMeshNbHexa2; + QLabel* myMeshNbPyra; + QLabel* myMeshNbPyra1; + QLabel* myMeshNbPyra2; + QLabel* myMeshNbPrism; + QLabel* myMeshNbPrism1; + QLabel* myMeshNbPrism2; + QLabel* myMeshNbPolyhedrones; + + QWidget* mySubMeshWidget; + QLabel* mySubMeshName; + QLabel* mySubMeshNbNodes; + QGroupBox* mySubMeshElementsGroup; + QLabel* mySubMeshNbElements; + QLabel* mySubMeshNbEdges; + QLabel* mySubMeshNbFaces; + QLabel* mySubMeshNbVolumes; + + QWidget* myGroupWidget; + QLabel* myGroupName; + QLabel* myGroupType; + QLabel* myGroupNb; + + QGroupBox* myButtonsGroup; + QPushButton* myOkBtn; + QPushButton* myHelpBtn; + + QString myHelpFileName; }; #endif // SMESHGUI_MESHINFOSDLG_H diff --git a/src/SMESHGUI/SMESHGUI_MeshOp.cxx b/src/SMESHGUI/SMESHGUI_MeshOp.cxx index 11d298a6d..909fbdd57 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOp.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshOp.cxx @@ -1,79 +1,73 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// SMESH SMESHGUI : GUI for SMESH component // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -/** -* SMESH SMESHGUI -* -* Copyright (C) 2005 CEA/DEN, EDF R&D -* -* -* -* File : SMESHGUI_MeshOp.h -* Author : Sergey LITONIN -* Module : SMESHGUI -*/ +// File : SMESHGUI_MeshOp.cxx +// Author : Sergey LITONIN, Open CASCADE S.A.S. +// +// SMESH includes #include "SMESHGUI_MeshOp.h" + +#include "SMESHGUI.h" #include "SMESHGUI_MeshDlg.h" #include "SMESHGUI_ShapeByMeshDlg.h" -#include "SMESH_TypeFilter.hxx" -#include "SMESHGUI.h" - #include "SMESHGUI_HypothesesUtils.h" #include "SMESHGUI_Hypotheses.h" #include "SMESHGUI_Utils.h" #include "SMESHGUI_GEOMGenUtils.h" -#include "SMESHGUI_VTKUtils.h" - -#include "SMESH_TypeFilter.hxx" -#include "SMESH_NumberFilter.hxx" - -#include CORBA_CLIENT_HEADER(SMESH_Gen) - -#include "GEOM_SelectionFilter.h" -#include "GEOMBase.h" -#include "GeometryGUI.h" - -#include "SalomeApp_Tools.h" -#include "SalomeApp_Application.h" -#include "SALOMEDSClient_Study.hxx" -#include "SALOMEDSClient_AttributeIOR.hxx" -#include "SALOMEDSClient_AttributeName.hxx" -#include "SALOMEDS_SComponent.hxx" -#include "SALOMEDS_SObject.hxx" - -#include "LightApp_SelectionMgr.h" -#include "LightApp_UpdateFlags.h" -#include "SUIT_MessageBox.h" -#include "SUIT_Desktop.h" -#include "SUIT_OverrideCursor.h" -#include "SALOME_InteractiveObject.hxx" -#include "SALOME_ListIO.hxx" - -#include "utilities.h" - -#include -#include +#include +#include + +// SALOME GEOM includes +#include +#include +#include + +// SALOME GUI includes +#include +#include +#include +#include +#include +#include +#include +#include + +// SALOME KERNEL includes +#include +#include + +// Qt includes +#include +#include + +// OCCT includes #include #include +// IDL includes +#include +#include CORBA_CLIENT_HEADER(SMESH_Gen) + //================================================================================ /*! * \brief Constructor @@ -136,8 +130,7 @@ bool SMESHGUI_MeshOp::onApply() { dlg()->show(); if ( aMess != "" ) - SUIT_MessageBox::warn1( myDlg, - tr( "SMESH_WRN_WARNING" ), aMess, tr( "SMESH_BUT_OK" ) ); + SUIT_MessageBox::warning( myDlg, tr( "SMESH_WRN_WARNING" ), aMess ); return false; } @@ -173,8 +166,7 @@ bool SMESHGUI_MeshOp::onApply() { if ( aMess == "" ) aMess = tr( "SMESH_OPERATION_FAILED" ); - SUIT_MessageBox::warn1( myDlg, - tr( "SMESH_ERROR" ), aMess, tr( "SMESH_BUT_OK" ) ); + SUIT_MessageBox::warning( myDlg, tr( "SMESH_ERROR" ), aMess ); } return aResult; @@ -288,7 +280,7 @@ bool SMESHGUI_MeshOp::isSubshapeOk() const // mesh QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh ); - _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.latin1() ); + _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() ); if (!pMesh) return false; SMESH::SMESH_Mesh_var mesh = SMESH::SObjectToInterface( pMesh ); @@ -313,9 +305,9 @@ bool SMESHGUI_MeshOp::isSubshapeOk() const // check all selected shapes QStringList::const_iterator aSubShapesIter = aGEOMs.begin(); - for (; aSubShapesIter != aGEOMs.end(); aSubShapesIter++) { + for ( ; aSubShapesIter != aGEOMs.end(); aSubShapesIter++) { QString aSubGeomEntry = (*aSubShapesIter); - _PTR(SObject) pSubGeom = studyDS()->FindObjectID(aSubGeomEntry.latin1()); + _PTR(SObject) pSubGeom = studyDS()->FindObjectID(aSubGeomEntry.toLatin1().data()); if (!pSubGeom) return false; GEOM::GEOM_Object_var aSubGeomVar = @@ -351,19 +343,19 @@ _PTR(SObject) SMESHGUI_MeshOp::getSubmeshByGeom() const { QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh ); QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom ); - _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.latin1() ); - _PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.latin1() ); + _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() ); + _PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.toLatin1().data() ); if ( pMesh && pGeom ) { GEOM::GEOM_Object_var geom = SMESH::SObjectToInterface( pGeom ); if ( !geom->_is_nil() ) { int tag = -1; switch ( geom->GetShapeType() ) { - case GEOM::VERTEX: tag = SMESH::Tag_SubMeshOnVertex ; break; - case GEOM::EDGE: tag = SMESH::Tag_SubMeshOnEdge ; break; - case GEOM::WIRE: tag = SMESH::Tag_SubMeshOnWire ; break; - case GEOM::FACE: tag = SMESH::Tag_SubMeshOnFace ; break; - case GEOM::SHELL: tag = SMESH::Tag_SubMeshOnShell ; break; - case GEOM::SOLID: tag = SMESH::Tag_SubMeshOnSolid ; break; + case GEOM::VERTEX: tag = SMESH::Tag_SubMeshOnVertex; break; + case GEOM::EDGE: tag = SMESH::Tag_SubMeshOnEdge; break; + case GEOM::WIRE: tag = SMESH::Tag_SubMeshOnWire; break; + case GEOM::FACE: tag = SMESH::Tag_SubMeshOnFace; break; + case GEOM::SHELL: tag = SMESH::Tag_SubMeshOnShell; break; + case GEOM::SOLID: tag = SMESH::Tag_SubMeshOnSolid; break; case GEOM::COMPOUND: tag = SMESH::Tag_SubMeshOnCompound; break; default:; } @@ -373,13 +365,13 @@ _PTR(SObject) SMESHGUI_MeshOp::getSubmeshByGeom() const if ( pMesh->FindSubObject( tag, aSubmeshRoot ) ) { _PTR(ChildIterator) smIter = aStudy->NewChildIterator( aSubmeshRoot ); - for (; smIter->More(); smIter->Next() ) + for ( ; smIter->More(); smIter->Next() ) { _PTR(SObject) aSmObj = smIter->Value(); if ( ! aSmObj->FindAttribute( anAttr, "AttributeIOR" )) continue; _PTR(ChildIterator) anIter1 = aStudy->NewChildIterator(aSmObj); - for (; anIter1->More(); anIter1->Next()) { + for ( ; anIter1->More(); anIter1->Next()) { _PTR(SObject) pGeom2 = anIter1->Value(); if ( pGeom2->ReferencedObject( pGeom2 ) && pGeom2->GetID() == pGeom->GetID() ) @@ -401,7 +393,7 @@ _PTR(SObject) SMESHGUI_MeshOp::getSubmeshByGeom() const //================================================================================ void SMESHGUI_MeshOp::selectionDone() { - if (!dlg()->isShown() || !myDlg->isEnabled()) + if (!dlg()->isVisible() || !myDlg->isEnabled()) return; SMESHGUI_SelectionOp::selectionDone(); @@ -412,7 +404,7 @@ void SMESHGUI_MeshOp::selectionDone() //Check geometry for mesh QString anObjEntry = myDlg->selectedObject(SMESHGUI_MeshDlg::Obj); - _PTR(SObject) pObj = studyDS()->FindObjectID(anObjEntry.latin1()); + _PTR(SObject) pObj = studyDS()->FindObjectID(anObjEntry.toLatin1().data()); if (pObj) { SMESH::SMESH_Mesh_var aMeshVar = @@ -438,9 +430,9 @@ void SMESHGUI_MeshOp::selectionDone() aSeq->length(aGEOMs.count()); QStringList::const_iterator aSubShapesIter = aGEOMs.begin(); int iSubSh = 0; - for (; aSubShapesIter != aGEOMs.end(); aSubShapesIter++, iSubSh++) { + for ( ; aSubShapesIter != aGEOMs.end(); aSubShapesIter++, iSubSh++) { QString aSubGeomEntry = (*aSubShapesIter); - _PTR(SObject) pSubGeom = studyDS()->FindObjectID(aSubGeomEntry.latin1()); + _PTR(SObject) pSubGeom = studyDS()->FindObjectID(aSubGeomEntry.toLatin1().data()); GEOM::GEOM_Object_var aSubGeomVar = GEOM::GEOM_Object::_narrow(_CAST(SObject,pSubGeom)->GetObject()); aSeq[iSubSh] = aSubGeomVar; @@ -448,7 +440,7 @@ void SMESHGUI_MeshOp::selectionDone() } else { // get geometry by selected sub-mesh QString anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj ); - _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.latin1() ); + _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() ); GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj ); if (!aGeomVar->_is_nil()) { aSeq->length(1); @@ -510,10 +502,12 @@ void SMESHGUI_MeshOp::selectionDone() SMESH::SMESH_subMesh_var sm = SMESH::SObjectToInterface( pSubmesh ); bool editSubmesh = ( !sm->_is_nil() && - SUIT_MessageBox::question2( myDlg, tr( "SMESH_WARNING" ), - tr( "EDIT_SUBMESH_QUESTION"), - tr( "SMESH_BUT_YES" ), - tr( "SMESH_BUT_NO" ), 1, 0, 0 )); + SUIT_MessageBox::question( myDlg, tr( "SMESH_WARNING" ), + tr( "EDIT_SUBMESH_QUESTION"), + SUIT_MessageBox::Yes | + SUIT_MessageBox::No, + SUIT_MessageBox::No ) + == SUIT_MessageBox::Yes ); if ( editSubmesh ) { selectionMgr()->clearFilters(); @@ -532,7 +526,7 @@ void SMESHGUI_MeshOp::selectionDone() // enable/disable popup for choice of geom selection way bool enable = false; QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh ); - if ( _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.latin1() )) { + if ( _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() )) { SMESH::SMESH_Mesh_var mesh = SMESH::SObjectToInterface( pMesh ); if ( !mesh->_is_nil() ) enable = ( shapeDim > 1 ) && ( mesh->NbEdges() > 0 ); @@ -587,9 +581,8 @@ bool SMESHGUI_MeshOp::isValid( QString& theMess ) const } // Name - QString aMeshName = myDlg->objectText( SMESHGUI_MeshDlg::Obj ); - aMeshName = aMeshName.stripWhiteSpace(); - if ( aMeshName == "" ) + QString aMeshName = myDlg->objectText( SMESHGUI_MeshDlg::Obj ).trimmed(); + if ( aMeshName.isEmpty() ) { theMess = myIsMesh ? tr( "NAME_OF_MESH_IS_EMPTY" ) : tr( "NAME_OF_SUBMESH_IS_EMPTY" ); return false; @@ -600,7 +593,7 @@ bool SMESHGUI_MeshOp::isValid( QString& theMess ) const { QString aMeshEntry = myDlg->selectedObject ( myToCreate ? SMESHGUI_MeshDlg::Mesh : SMESHGUI_MeshDlg::Obj ); - if ( _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.latin1() )) { + if ( _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() )) { SMESH::SMESH_Mesh_var mesh = SMESH::SObjectToInterface( pMesh ); if ( !mesh->_is_nil() && CORBA::is_nil( mesh->GetShapeToMesh() )) { theMess = tr( "IMPORTED_MESH" ); @@ -618,7 +611,7 @@ bool SMESHGUI_MeshOp::isValid( QString& theMess ) const theMess = tr( "GEOMETRY_OBJECT_IS_NOT_DEFINED" ); return false; } - _PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.latin1() ); + _PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.toLatin1().data() ); if ( !pGeom || GEOM::GEOM_Object::_narrow( _CAST( SObject,pGeom )->GetObject() )->_is_nil() ) { theMess = tr( "GEOMETRY_OBJECT_IS_NULL" ); @@ -634,7 +627,7 @@ bool SMESHGUI_MeshOp::isValid( QString& theMess ) const theMess = tr( "MESH_IS_NOT_DEFINED" ); return false; } - _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.latin1() ); + _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() ); if ( !pMesh || SMESH::SMESH_Mesh::_narrow( _CAST( SObject,pMesh )->GetObject() )->_is_nil() ) { theMess = tr( "MESH_IS_NULL" ); @@ -758,7 +751,7 @@ void SMESHGUI_MeshOp::existingHyps( const int theDim, { _PTR(ChildIterator) anIter = SMESH::GetActiveStudyDocument()->NewChildIterator( aHypRoot ); - for (; anIter->More(); anIter->Next() ) + for ( ; anIter->More(); anIter->Next() ) { _PTR(SObject) anObj = anIter->Value(); if ( isMesh ) // i.e. mesh or submesh @@ -778,8 +771,7 @@ void SMESHGUI_MeshOp::existingHyps( const int theDim, SMESH::SMESH_Hypothesis_var aHypVar = SMESH::SMESH_Hypothesis::_narrow( aVar ); if ( !aHypVar->_is_nil() ) { - CORBA::String_var aHypType( aHypVar->GetName() ); - HypothesisData* aData = SMESH::GetHypothesisData( aHypType ); + HypothesisData* aData = SMESH::GetHypothesisData( aHypVar->GetName() ); if ( ( theDim == -1 || aData->Dim.contains( theDim ) ) && ( isCompatible ( theAlgoData, aData, theHypType )) && ( isAux == aData->IsAux )) @@ -816,7 +808,7 @@ SMESHGUI_MeshOp::getInitParamsHypothesis( const QString& aHypType, const int nbColonsInMeshEntry = 3; bool isSubMesh = myToCreate ? !myIsMesh : - myDlg->selectedObject( SMESHGUI_MeshDlg::Obj ).contains(':') > nbColonsInMeshEntry; + myDlg->selectedObject( SMESHGUI_MeshDlg::Obj ).count(':') > nbColonsInMeshEntry; if ( isSubMesh ) { @@ -826,14 +818,14 @@ SMESHGUI_MeshOp::getInitParamsHypothesis( const QString& aHypType, QString anEntry = myDlg->selectedObject ( myToCreate ? SMESHGUI_MeshDlg::Mesh : SMESHGUI_MeshDlg::Obj ); - if ( _PTR(SObject) pObj = studyDS()->FindObjectID( anEntry.latin1() )) + if ( _PTR(SObject) pObj = studyDS()->FindObjectID( anEntry.toLatin1().data() )) { CORBA::Object_ptr Obj = _CAST( SObject,pObj )->GetObject(); if ( myToCreate ) // mesh and geom may be selected { aMeshVar = SMESH::SMESH_Mesh::_narrow( Obj ); anEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom ); - if ( _PTR(SObject) pGeom = studyDS()->FindObjectID( anEntry.latin1() )) + if ( _PTR(SObject) pGeom = studyDS()->FindObjectID( anEntry.toLatin1().data() )) aGeomVar= GEOM::GEOM_Object::_narrow( _CAST( SObject,pGeom )->GetObject() ); } else // edition: sub-mesh may be selected @@ -847,8 +839,8 @@ SMESHGUI_MeshOp::getInitParamsHypothesis( const QString& aHypType, } if ( !aMeshVar->_is_nil() && !aGeomVar->_is_nil() ) - return SMESHGUI::GetSMESHGen()->GetHypothesisParameterValues( aHypType, - aServerLib, + return SMESHGUI::GetSMESHGen()->GetHypothesisParameterValues( aHypType.toLatin1().data(), + aServerLib.toLatin1().data(), aMeshVar, aGeomVar ); } @@ -929,19 +921,19 @@ void SMESHGUI_MeshOp::createHypothesis (const int theDim, // Main dialog must not update it's own selected objects in this case. dlg()->deactivateAll(); - HypothesisData* aData = SMESH::GetHypothesisData(theTypeName.latin1()); + HypothesisData* aData = SMESH::GetHypothesisData(theTypeName); if (!aData) return; QStringList aHypNames; TDim2Type2HypList::const_iterator aDimIter = myExistingHyps.begin(); - for (; aDimIter != myExistingHyps.end(); aDimIter++) { - const TType2HypList& aType2HypList = aDimIter.data(); + for ( ; aDimIter != myExistingHyps.end(); aDimIter++) { + const TType2HypList& aType2HypList = aDimIter.value(); TType2HypList::const_iterator aTypeIter = aType2HypList.begin(); - for (; aTypeIter != aType2HypList.end(); aTypeIter++) { - const THypList& aHypList = aTypeIter.data(); + for ( ; aTypeIter != aType2HypList.end(); aTypeIter++) { + const THypList& aHypList = aTypeIter.value(); THypList::const_iterator anIter = aHypList.begin(); - for (; anIter != aHypList.end(); anIter++) { + for ( ; anIter != aHypList.end(); anIter++) { const THypItem& aHypItem = *anIter; const QString& aHypName = aHypItem.second; aHypNames.append(aHypName); @@ -1011,8 +1003,7 @@ void SMESHGUI_MeshOp::onEditHyp( const int theHypType, const int theIndex ) if ( aHyp->_is_nil() ) return; - CORBA::String_var aTypeName = aHyp->GetName(); - SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator( aTypeName ); + SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator( aHyp->GetName() ); if ( aCreator ) { myDlg->setEnabled( false ); aCreator->edit( aHyp.in(), aHypItem.second, dlg() ); @@ -1090,7 +1081,7 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex, } HypothesisData* prevAlgo = algoData; bool noCompatible = false; - for (; dim * dir <= lastDim * dir; dim += dir) + for ( ; dim * dir <= lastDim * dir; dim += dir) { if ( !isAccessibleDim( dim )) continue; @@ -1119,10 +1110,10 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex, noCompatible = anAvailable.isEmpty(); // restore previously selected algo - algoIndex = myAvailableHypData[dim][Algo].findIndex( curAlgo ); + algoIndex = myAvailableHypData[dim][Algo].indexOf( curAlgo ); if ( !isSubmesh && algoIndex < 0 && soleCompatible && !forward && dim != SMESH::DIM_0D) // select the sole compatible algo - algoIndex = myAvailableHypData[dim][Algo].findIndex( soleCompatible ); + algoIndex = myAvailableHypData[dim][Algo].indexOf( soleCompatible ); setCurrentHyp( dim, Algo, algoIndex ); // remember current algo @@ -1158,8 +1149,7 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex, myObjHyps[ dim ][ type ].count() > 0 && curHypType == myObjHyps[ dim ][ type ].first().first->GetName()) { - CORBA::String_var aName = curHyp->GetName(); - HypothesisData* hypData = SMESH::GetHypothesisData( aName ); + HypothesisData* hypData = SMESH::GetHypothesisData( curHyp->GetName() ); for (int i = 0; i < myAvailableHypData[ dim ][ Algo ].count(); ++i) { curAlgo = myAvailableHypData[ dim ][ Algo ][ i ]; if (curAlgo && hypData && isCompatible(curAlgo, hypData, type)) @@ -1174,8 +1164,7 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex, { // check if a selected hyp is compatible with the curAlgo if ( !curHyp->_is_nil() ) { - CORBA::String_var aName = curHyp->GetName(); - HypothesisData* hypData = SMESH::GetHypothesisData( aName ); + HypothesisData* hypData = SMESH::GetHypothesisData( curHyp->GetName() ); if ( !isCompatible( curAlgo, hypData, type )) curHyp = SMESH::SMESH_Hypothesis::_nil(); } @@ -1237,12 +1226,12 @@ void SMESHGUI_MeshOp::onHypoSet( const QString& theSetName ) int aDim = aHypData->Dim[0]; // create or/and set if (isAlgo) { - int index = myAvailableHypData[aDim][Algo].findIndex( aHypData ); + int index = myAvailableHypData[aDim][Algo].indexOf( aHypData ); if ( index < 0 ) { QStringList anAvailable; availableHyps( aDim, Algo, anAvailable, myAvailableHypData[aDim][Algo] ); myDlg->tab( aDim )->setAvailableHyps( Algo, anAvailable ); - index = myAvailableHypData[aDim][Algo].findIndex( aHypData ); + index = myAvailableHypData[aDim][Algo].indexOf( aHypData ); } setCurrentHyp( aDim, Algo, index ); onAlgoSelected( index, aDim ); @@ -1252,10 +1241,10 @@ void SMESHGUI_MeshOp::onHypoSet( const QString& theSetName ) QStringList anAvailable; availableHyps( aDim, MainHyp, anAvailable, myAvailableHypData[aDim][MainHyp] ); myDlg->tab( aDim )->setAvailableHyps( MainHyp, anAvailable ); - int index = myAvailableHypData[aDim][MainHyp].findIndex( aHypData ); + int index = myAvailableHypData[aDim][MainHyp].indexOf( aHypData ); if ( index < 0 ) { mainHyp = false; - index = myAvailableHypData[aDim][AddHyp].findIndex( aHypData ); + index = myAvailableHypData[aDim][AddHyp].indexOf( aHypData ); } if (index >= 0) createHypothesis(aDim, mainHyp ? MainHyp : AddHyp, aHypoTypeName); @@ -1283,10 +1272,10 @@ bool SMESHGUI_MeshOp::createMesh( QString& theMess ) QStringList aList; myDlg->selectedObject( SMESHGUI_MeshDlg::Geom, aList ); QStringList::Iterator it = aList.begin(); - for (; it!=aList.end(); it++) + for ( ; it!=aList.end(); it++) { QString aGeomEntry = *it; - _PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.latin1() ); + _PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.toLatin1().data() ); GEOM::GEOM_Object_var aGeomVar = GEOM::GEOM_Object::_narrow( _CAST( SObject,pGeom )->GetObject() ); @@ -1302,7 +1291,7 @@ bool SMESHGUI_MeshOp::createMesh( QString& theMess ) return false; _PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshVar.in() ); if ( aMeshSO ) - SMESH::SetName( aMeshSO, myDlg->objectText( SMESHGUI_MeshDlg::Obj ).latin1() ); + SMESH::SetName( aMeshSO, myDlg->objectText( SMESHGUI_MeshDlg::Obj ) ); for ( int aDim = SMESH::DIM_0D; aDim <= SMESH::DIM_3D; aDim++ ) { if ( !isAccessibleDim( aDim )) continue; @@ -1345,7 +1334,7 @@ bool SMESHGUI_MeshOp::createSubMesh( QString& theMess ) // get mesh object QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh ); - _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.latin1() ); + _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() ); SMESH::SMESH_Mesh_var aMeshVar = SMESH::SMESH_Mesh::_narrow( _CAST( SObject,pMesh )->GetObject() ); if (aMeshVar->_is_nil()) @@ -1365,7 +1354,7 @@ bool SMESHGUI_MeshOp::createSubMesh( QString& theMess ) { //QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom ); QString aGeomEntry = aGEOMs.first(); - _PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.latin1() ); + _PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.toLatin1().data() ); aGeomVar = GEOM::GEOM_Object::_narrow( _CAST( SObject,pGeom )->GetObject() ); } else if (aGEOMs.count() > 1) @@ -1384,9 +1373,9 @@ bool SMESHGUI_MeshOp::createSubMesh( QString& theMess ) GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; aSeq->length(aGEOMs.count()); QStringList::const_iterator aSubShapesIter = aGEOMs.begin(); - for (; aSubShapesIter != aGEOMs.end(); aSubShapesIter++, iSubSh++) { + for ( ; aSubShapesIter != aGEOMs.end(); aSubShapesIter++, iSubSh++) { QString aSubGeomEntry = (*aSubShapesIter); - _PTR(SObject) pSubGeom = studyDS()->FindObjectID(aSubGeomEntry.latin1()); + _PTR(SObject) pSubGeom = studyDS()->FindObjectID(aSubGeomEntry.toLatin1().data()); GEOM::GEOM_Object_var aSubGeomVar = GEOM::GEOM_Object::_narrow(_CAST(SObject,pSubGeom)->GetObject()); TopAbs_ShapeEnum aSubShapeType = (TopAbs_ShapeEnum)aSubGeomVar->GetShapeType(); @@ -1409,7 +1398,8 @@ bool SMESHGUI_MeshOp::createSubMesh( QString& theMess ) QString aNewGeomGroupName ("Auto_group_for_"); aNewGeomGroupName += aName; SALOMEDS::SObject_var aNewGroupSO = - geomGen->AddInStudy(aSMESHGen->GetCurrentStudy(), aGeomVar, aNewGeomGroupName, mainGeom); + geomGen->AddInStudy(aSMESHGen->GetCurrentStudy(), aGeomVar, + aNewGeomGroupName.toLatin1().data(), mainGeom); } } } @@ -1422,7 +1412,7 @@ bool SMESHGUI_MeshOp::createSubMesh( QString& theMess ) SUIT_OverrideCursor aWaitCursor; // create sub-mesh - SMESH::SMESH_subMesh_var aSubMeshVar = aMeshVar->GetSubMesh( aGeomVar, aName.latin1() ); + SMESH::SMESH_subMesh_var aSubMeshVar = aMeshVar->GetSubMesh( aGeomVar, aName.toLatin1().data() ); for ( int aDim = SMESH::DIM_0D; aDim <= SMESH::DIM_3D; aDim++ ) { @@ -1518,7 +1508,7 @@ void SMESHGUI_MeshOp::setDefaultName() const do { aResName = aPrefix + QString::number( i++ ); - anObj = aStudy->FindObject( aResName.latin1() ); + anObj = aStudy->FindObject( aResName.toLatin1().data() ); } while ( anObj ); @@ -1555,7 +1545,7 @@ SMESH::SMESH_Hypothesis_var SMESHGUI_MeshOp::getAlgo( const int theDim ) // look for anexisting algo of such a type THypList& aHypVarList = myExistingHyps[ theDim ][ Algo ]; THypList::iterator anIter = aHypVarList.begin(); - for (; anIter != aHypVarList.end(); anIter++) + for ( ; anIter != aHypVarList.end(); anIter++) { SMESH::SMESH_Hypothesis_var aHypVar = (*anIter).first; CORBA::String_var aName = aHypVar->GetName(); @@ -1615,7 +1605,7 @@ SMESH::SMESH_Hypothesis_var SMESHGUI_MeshOp::getAlgo( const int theDim ) void SMESHGUI_MeshOp::readMesh() { QString anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj ); - _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.latin1() ); + _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() ); if ( !pObj ) return; @@ -1656,9 +1646,8 @@ void SMESHGUI_MeshOp::readMesh() if ( myObjHyps[ dim ][ Algo ].count() > 0 ) { SMESH::SMESH_Hypothesis_var aVar = myObjHyps[ dim ][ Algo ].first().first; - CORBA::String_var aHypTypeName = aVar->GetName(); - HypothesisData* algoData = SMESH::GetHypothesisData( aHypTypeName ); - aHypIndex = myAvailableHypData[ dim ][ Algo ].findIndex ( algoData ); + HypothesisData* algoData = SMESH::GetHypothesisData( aVar->GetName() ); + aHypIndex = myAvailableHypData[ dim ][ Algo ].indexOf ( algoData ); // if ( aHypIndex < 0 && algoData ) { // // assigned algo is incompatible with other algorithms // myAvailableHypData[ dim ][ Algo ].push_back( algoData ); @@ -1745,7 +1734,7 @@ int SMESHGUI_MeshOp::find( const SMESH::SMESH_Hypothesis_var& theHyp, { int i = 0; THypList::const_iterator anIter = theHypList.begin(); - for (; anIter != theHypList.end(); ++ anIter) + for ( ; anIter != theHypList.end(); ++ anIter) { if ( theHyp->_is_equivalent( (*anIter).first ) ) { @@ -1776,7 +1765,7 @@ bool SMESHGUI_MeshOp::editMeshOrSubMesh( QString& theMess ) return false; QString anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj ); - _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.latin1() ); + _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() ); if ( !pObj ) return false; @@ -1784,7 +1773,7 @@ bool SMESHGUI_MeshOp::editMeshOrSubMesh( QString& theMess ) // Set new name QString aName = myDlg->objectText( SMESHGUI_MeshDlg::Obj ); - SMESH::SetName( pObj, aName.latin1() ); + SMESH::SetName( pObj, aName ); int aDim = ( myIsOnGeometry ) ? SMESH::DIM_0D : SMESH::DIM_3D; // First, remove old algos in order to avoid messages on algorithm hiding @@ -1840,7 +1829,7 @@ bool SMESHGUI_MeshOp::editMeshOrSubMesh( QString& theMess ) // remove old hypotheses if ( myObjHyps[ dim ][ hypType ].count() > 0 ) { - anOldHypIndex = find( myObjHyps[ dim ][ hypType ].first().first , + anOldHypIndex = find( myObjHyps[ dim ][ hypType ].first().first, myExistingHyps[ dim ][ hypType ] ); if ( aNewHypIndex != anOldHypIndex || // different hyps anOldHypIndex == -1 ) // hyps of different algos @@ -1916,7 +1905,7 @@ void SMESHGUI_MeshOp::onGeomSelectionByMesh( bool theByMesh ) } // set mesh object to SMESHGUI_ShapeByMeshOp and start it QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh ); - if ( _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.latin1() )) { + if ( _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() )) { SMESH::SMESH_Mesh_var aMeshVar = SMESH::SMESH_Mesh::_narrow( _CAST( SObject,pMesh )->GetObject() ); if ( !aMeshVar->_is_nil() ) { @@ -1946,7 +1935,7 @@ void SMESHGUI_MeshOp::onPublishShapeByMeshDlg(SUIT_Operation* op) if ( !aGeomVar->_is_nil() ) { QString ID = aGeomVar->GetStudyEntry(); - if ( _PTR(SObject) aGeomSO = studyDS()->FindObjectID( ID.latin1() )) { + if ( _PTR(SObject) aGeomSO = studyDS()->FindObjectID( ID.toLatin1().data() )) { selectObject( aGeomSO ); selectionDone(); } diff --git a/src/SMESHGUI/SMESHGUI_MeshOp.h b/src/SMESHGUI/SMESHGUI_MeshOp.h index c658fb74e..e0bc74796 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOp.h +++ b/src/SMESHGUI/SMESHGUI_MeshOp.h @@ -1,47 +1,36 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public +// SMESH SMESHGUI : GUI for SMESH component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public +// You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -/** -* SMESH SMESHGUI -* -* Copyright (C) 2005 CEA/DEN, EDF R&D -* -* -* -* File : SMESHGUI_MeshOp.h -* Author : Sergey LITONIN -* Module : SMESHGUI -*/ +// File : SMESHGUI_MeshOp.h +// Author : Sergey LITONIN, Open CASCADE S.A.S. +// -#ifndef SMESHGUI_MeshOp_H -#define SMESHGUI_MeshOp_H +#ifndef SMESHGUI_MESHOP_H +#define SMESHGUI_MESHOP_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" #include "SMESHGUI_SelectionOp.h" -#include -#include CORBA_CLIENT_HEADER(GEOM_Gen) -#include CORBA_CLIENT_HEADER(SMESH_Mesh) - -#include - class SMESHGUI_MeshDlg; class SMESHGUI_ShapeByMeshOp; class HypothesisData; @@ -56,11 +45,10 @@ class SMESHGUI_EXPORT SMESHGUI_MeshOp : public SMESHGUI_SelectionOp Q_OBJECT public: - enum HypType{ Algo = 0, MainHyp, AddHyp, NbHypTypes }; typedef std::pair THypItem; - typedef QValueList< THypItem > THypList; + typedef QList< THypItem > THypList; typedef int THypType; typedef QMap< THypType, THypList > TType2HypList; @@ -68,7 +56,8 @@ public: typedef int THypDim; typedef QMap< THypDim, TType2HypList > TDim2Type2HypList; - SMESHGUI_MeshOp( const bool theToCreate, const bool theIsMesh = true ); +public: + SMESHGUI_MeshOp( const bool, const bool = true ); virtual ~SMESHGUI_MeshOp(); virtual LightApp_Dialog* dlg() const; @@ -81,37 +70,35 @@ protected: protected slots: virtual bool onApply(); - void onCreateHyp( const int theHypType, const int theIndex ); - void onEditHyp( const int theHypType, const int theIndex ); - void onHypoSet( const QString& theSetName ); + void onCreateHyp( const int, const int ); + void onEditHyp( const int, const int ); + void onHypoSet( const QString& ); void onGeomSelectionByMesh( bool ); - void onPublishShapeByMeshDlg(SUIT_Operation*); - void onCloseShapeByMeshDlg(SUIT_Operation*); - void onAlgoSelected( const int theIndex, - const int theDim = -1); + void onPublishShapeByMeshDlg( SUIT_Operation* ); + void onCloseShapeByMeshDlg( SUIT_Operation* ); + void onAlgoSelected( const int, const int = -1 ); private: - - typedef QValueList THypDataList; // typedef: list of hypothesis data + typedef QList THypDataList; // typedef: list of hypothesis data bool isValid( QString& ) const; - void availableHyps( const int theDim, - const int theHypType, - QStringList& theHyps, - THypDataList& theDataList, - HypothesisData* theAlgoData = 0 ) const; - void existingHyps( const int theDim, - const int theHypType, - _PTR(SObject) theFather, - QStringList& theHyps, - THypList& theHypList, - HypothesisData* theAlgoData = 0); - HypothesisData* hypData( const int theDim, - const int theHypType, - const int theIndex); // access to myAvailableHypData - - void createHypothesis(const int theDim, const int theType, - const QString& theTypeName); + void availableHyps( const int, + const int, + QStringList&, + THypDataList&, + HypothesisData* = 0 ) const; + void existingHyps( const int, + const int, + _PTR(SObject), + QStringList&, + THypList&, + HypothesisData* = 0 ); + HypothesisData* hypData( const int, + const int, + const int ); // access to myAvailableHypData + + void createHypothesis( const int, const int, + const QString& ); bool createMesh( QString& ); bool createSubMesh( QString& ); @@ -125,9 +112,9 @@ private: void readMesh(); QString name( _PTR(SObject) ) const; int find( const SMESH::SMESH_Hypothesis_var&, - const THypList& theHypList) const; - SMESH::SMESH_Hypothesis_var getInitParamsHypothesis( const QString& aHypType, - const QString& aServerLib ) const; + const THypList& ) const; + SMESH::SMESH_Hypothesis_var getInitParamsHypothesis( const QString&, + const QString& ) const; bool isSubshapeOk() const; _PTR(SObject) getSubmeshByGeom() const; void selectObject( _PTR(SObject) ) const; @@ -149,4 +136,4 @@ private: bool myIgnoreAlgoSelection; }; -#endif +#endif // SMESHGUI_MESHOP_H diff --git a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx index 1c99b81ef..67eb31d74 100755 --- a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx @@ -1,34 +1,32 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_MeshPatternDlg.cxx +// Author : Sergey LITONIN, Open CASCADE S.A.S. // -// -// File : SMESHGUI_MeshPatternDlg.cxx -// Author : Sergey LITONIN -// Module : SMESH +// SMESH includes #include "SMESHGUI_MeshPatternDlg.h" #include "SMESHGUI.h" -#include "SMESHGUI_SpinBox.h" #include "SMESHGUI_CreatePatternDlg.h" #include "SMESHGUI_PatternWidget.h" #include "SMESHGUI_Utils.h" @@ -36,59 +34,57 @@ #include "SMESHGUI_PatternUtils.h" #include "SMESHGUI_GEOMGenUtils.h" -#include "SMESH_Actor.h" -#include "SMESH_ActorUtils.h" -#include "SMESH_NumberFilter.hxx" +#include +#include +#include -#include "SMDS_Mesh.hxx" -#include "SMDS_MeshElement.hxx" +#include +#include -#include "SUIT_ResourceMgr.h" -#include "SUIT_Desktop.h" -#include "SUIT_FileDlg.h" -#include "SUIT_Session.h" -#include "SUIT_MessageBox.h" +// SALOME GUI includes +#include +#include +#include +#include +#include -#include "LightApp_SelectionMgr.h" -#include "SalomeApp_Tools.h" -#include "SalomeApp_Study.h" -#include "LightApp_Application.h" +#include +#include +#include -#include "SALOMEDS_SObject.hxx" +#include -#include "SALOME_ListIO.hxx" -#include "SVTK_Selection.h" +#include +#include +#include -#include "SVTK_ViewModel.h" -#include "SVTK_Selector.h" -#include "SVTK_ViewWindow.h" -#include "VTKViewer_CellLocationsArray.h" +// SALOME KERNEL includes +#include -// OCCT Includes +// OCCT includes #include -#include - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// VTK Includes -#include + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// VTK includes #include #include #include @@ -96,8 +92,8 @@ #include #include -#define SPACING 5 -#define MARGIN 10 +#define SPACING 6 +#define MARGIN 11 /*! * Class : SMESHGUI_MeshPatternDlg @@ -108,27 +104,27 @@ // name : SMESHGUI_MeshPatternDlg::SMESHGUI_MeshPatternDlg // Purpose : Constructor //======================================================================= -SMESHGUI_MeshPatternDlg::SMESHGUI_MeshPatternDlg( SMESHGUI* theModule, - const char* theName ) - : QDialog( SMESH::GetDesktop( theModule ), theName, false, WStyle_Customize | - WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), - myBusy(false), - mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) +SMESHGUI_MeshPatternDlg::SMESHGUI_MeshPatternDlg( SMESHGUI* theModule ) + : QDialog( SMESH::GetDesktop( theModule ) ), + mySMESHGUI( theModule ), + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), + myBusy( false ), + myCreationDlg( 0 ) { - setCaption(tr("CAPTION")); + setModal( false ); + setWindowTitle( tr( "CAPTION" ) ); - QVBoxLayout* aDlgLay = new QVBoxLayout(this, MARGIN, SPACING); + QVBoxLayout* aDlgLay = new QVBoxLayout( this ); + aDlgLay->setMargin( MARGIN ); + aDlgLay->setSpacing( SPACING ); - QFrame* aMainFrame = createMainFrame (this); - QFrame* aBtnFrame = createButtonFrame(this); + QWidget* aMainFrame = createMainFrame ( this ); + QWidget* aBtnFrame = createButtonFrame( this ); - aDlgLay->addWidget(aMainFrame); - aDlgLay->addWidget(aBtnFrame); + aDlgLay->addWidget( aMainFrame ); + aDlgLay->addWidget( aBtnFrame ); - aDlgLay->setStretchFactor(aMainFrame, 1); - - myCreationDlg = 0; + aDlgLay->setStretchFactor( aMainFrame, 1 ); mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); @@ -141,129 +137,175 @@ SMESHGUI_MeshPatternDlg::SMESHGUI_MeshPatternDlg( SMESHGUI* theModule, // name : SMESHGUI_MeshPatternDlg::createMainFrame // Purpose : Create frame containing dialog's input fields //======================================================================= -QFrame* SMESHGUI_MeshPatternDlg::createMainFrame (QWidget* theParent) +QWidget* SMESHGUI_MeshPatternDlg::createMainFrame (QWidget* theParent) { SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI ); - QPixmap iconSlct ( mgr->loadPixmap("SMESH", tr("ICON_SELECT"))); - QPixmap icon2d ( mgr->loadPixmap("SMESH", tr("ICON_PATTERN_2d"))); - QPixmap icon3d ( mgr->loadPixmap("SMESH", tr("ICON_PATTERN_3d"))); - QPixmap iconOpen ( mgr->loadPixmap("STD", tr("ICON_FILE_OPEN"))); + QPixmap iconSlct ( mgr->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) ); + QPixmap icon2d ( mgr->loadPixmap( "SMESH", tr( "ICON_PATTERN_2d" ) ) ); + QPixmap icon3d ( mgr->loadPixmap( "SMESH", tr( "ICON_PATTERN_3d" ) ) ); + QPixmap iconOpen ( mgr->loadPixmap( "STD", tr( "ICON_FILE_OPEN" ) ) ); + + QPixmap iconSample2d ( mgr->loadPixmap( "SMESH", tr( "ICON_PATTERN_SAMPLE_2D" ) ) ); + QPixmap iconSample3d ( mgr->loadPixmap( "SMESH", tr( "ICON_PATTERN_SAMPLE_3D" ) ) ); - QPixmap iconSample2d ( mgr->loadPixmap("SMESH", tr("ICON_PATTERN_SAMPLE_2D"))); - QPixmap iconSample3d ( mgr->loadPixmap("SMESH", tr("ICON_PATTERN_SAMPLE_3D"))); + QWidget* aMainGrp = new QWidget( theParent ); - QGroupBox* aMainGrp = new QGroupBox (1, Qt::Horizontal, theParent); - aMainGrp->setFrameStyle(QFrame::NoFrame); - aMainGrp->setInsideMargin(0); + QVBoxLayout* aMainGrpLayout = new QVBoxLayout( aMainGrp ); + aMainGrpLayout->setMargin( 0 ); + aMainGrpLayout->setSpacing( SPACING ); // Pattern type group - myTypeGrp = new QButtonGroup (1, Qt::Vertical, tr("PATTERN_TYPE"), aMainGrp); - mySwitch2d = new QRadioButton (myTypeGrp); - mySwitch3d = new QRadioButton (myTypeGrp); - mySwitch2d->setPixmap(icon2d); - mySwitch3d->setPixmap(icon3d); - myTypeGrp->insert(mySwitch2d, Type_2d); - myTypeGrp->insert(mySwitch3d, Type_3d); + QGroupBox* aTypeGrp = new QGroupBox( tr( "PATTERN_TYPE" ), aMainGrp ); + QHBoxLayout* aTypeGrpLayout = new QHBoxLayout( aTypeGrp ); + aTypeGrpLayout->setMargin( MARGIN ); + aTypeGrpLayout->setSpacing( SPACING ); + + mySwitch2d = new QRadioButton( aTypeGrp ); + mySwitch3d = new QRadioButton( aTypeGrp ); + mySwitch2d->setIcon( icon2d ); + mySwitch3d->setIcon( icon3d ); + + myTypeGrp = new QButtonGroup( aMainGrp ); + myTypeGrp->addButton( mySwitch2d, Type_2d ); + myTypeGrp->addButton( mySwitch3d, Type_3d ); + + // ... layout widgets + + aTypeGrpLayout->addWidget( mySwitch2d ); + aTypeGrpLayout->addWidget( mySwitch3d ); // Mesh group - QGroupBox* aMeshGrp = new QGroupBox(1, Qt::Vertical, tr("SMESH_MESH"), aMainGrp); - new QLabel(tr("SMESH_MESH"), aMeshGrp); - mySelBtn[ Mesh ] = new QPushButton(aMeshGrp); - mySelBtn[ Mesh ]->setPixmap(iconSlct); - mySelEdit[ Mesh ] = new QLineEdit(aMeshGrp); - mySelEdit[ Mesh ]->setReadOnly(true); + QGroupBox* aMeshGrp = new QGroupBox( tr( "SMESH_MESH" ), aMainGrp ); + QHBoxLayout* aMeshGrpLayout = new QHBoxLayout( aMeshGrp ); + aMeshGrpLayout->setMargin( MARGIN ); + aMeshGrpLayout->setSpacing( SPACING ); + + QLabel* aMeshLab = new QLabel( tr( "SMESH_MESH" ), aMeshGrp ); + mySelBtn[ Mesh ] = new QPushButton( aMeshGrp ); + mySelBtn[ Mesh ]->setIcon( iconSlct ); + mySelEdit[ Mesh ] = new QLineEdit( aMeshGrp ); + mySelEdit[ Mesh ]->setReadOnly( true ); + + // ... layout widgets + + aMeshGrpLayout->addWidget( aMeshLab ); + aMeshGrpLayout->addWidget( mySelBtn[ Mesh ] ); + aMeshGrpLayout->addWidget( mySelEdit[ Mesh ] ); // Pattern group - QGroupBox* aPatGrp = new QGroupBox(1, Qt::Horizontal, tr("PATTERN"), aMainGrp); + QGroupBox* aPatGrp = new QGroupBox( tr( "PATTERN" ), aMainGrp ); + QGridLayout* aPatGrpLayout = new QGridLayout( aPatGrp ); + aPatGrpLayout->setMargin( MARGIN ); + aPatGrpLayout->setSpacing( SPACING ); + + // ... Pattern name + + QLabel* aNameLab = new QLabel( tr( "PATTERN" ), aPatGrp ); + myName = new QLineEdit( aPatGrp ); + myName->setReadOnly( true ); + myOpenBtn = new QPushButton( aPatGrp ); + myOpenBtn->setIcon( iconOpen ); + myNewBtn = new QPushButton( tr( "NEW" ), aPatGrp ); + + // ... Mode selection check box + myRefine = new QCheckBox( tr( "REFINE" ), aPatGrp ); + + // ... selection widgets for Apply to geom mode + myGeomGrp = new QFrame( aPatGrp ); + myGeomGrp->setFrameStyle( QFrame::NoFrame ); + QGridLayout* myGeomGrpLayout = new QGridLayout( myGeomGrp ); + myGeomGrpLayout->setMargin( 0 ); + myGeomGrpLayout->setSpacing( SPACING ); + + for ( int i = Object; i <= Vertex2; i++ ) { + mySelLbl[ i ] = new QLabel( myGeomGrp ); + mySelBtn[ i ] = new QPushButton( myGeomGrp ); + mySelBtn[ i ]->setIcon( iconSlct ); + mySelEdit[ i ] = new QLineEdit( myGeomGrp ); + mySelEdit[ i ]->setReadOnly( true ); + myGeomGrpLayout->addWidget( mySelLbl[ i ], i - Object, 0 ); + myGeomGrpLayout->addWidget( mySelBtn[ i ], i - Object, 1 ); + myGeomGrpLayout->addWidget( mySelEdit[ i ], i - Object, 2 ); + } - // pattern name - QGroupBox* aNameGrp = new QGroupBox(1, Qt::Vertical, aPatGrp); - aNameGrp->setFrameStyle(QFrame::NoFrame); - aNameGrp->setInsideMargin(0); - new QLabel(tr("PATTERN"), aNameGrp); - myName = new QLineEdit(aNameGrp); - myName->setReadOnly(true); - myOpenBtn = new QPushButton(aNameGrp); - myOpenBtn->setPixmap(iconOpen); - myNewBtn = new QPushButton(tr("NEW"), aNameGrp); + // ... Widgets for refinement of existing mesh elements - // Mode selection check box - myRefine = new QCheckBox(tr("REFINE"), aPatGrp); + myRefineGrp = new QFrame( aPatGrp ); + myRefineGrp->setFrameStyle( QFrame::NoFrame ); - // selection widgets for Apply to geom mode - myGeomGrp = new QGroupBox(3, Qt::Horizontal, aPatGrp); - myGeomGrp->setFrameStyle(QFrame::NoFrame); - myGeomGrp->setInsideMargin(0); + QGridLayout* myRefineGrpLayout = new QGridLayout( myRefineGrp ); + myRefineGrpLayout->setMargin( 0 ); + myRefineGrpLayout->setSpacing( SPACING ); - for (int i = Object; i <= Vertex2; i++) - { - mySelLbl[ i ] = new QLabel(myGeomGrp); - mySelBtn[ i ] = new QPushButton(myGeomGrp); - mySelBtn[ i ]->setPixmap(iconSlct); - mySelEdit[ i ] = new QLineEdit(myGeomGrp); - mySelEdit[ i ]->setReadOnly(true); - } + mySelLbl[ Ids ] = new QLabel( myRefineGrp ); + mySelBtn[ Ids ] = new QPushButton( myRefineGrp ); + mySelBtn[ Ids ]->setIcon( iconSlct ); + mySelEdit[ Ids ] = new QLineEdit( myRefineGrp ); + + QLabel* aNodeLbl = new QLabel( tr( "NODE_1" ), myRefineGrp ); + myNode1 = new QSpinBox( myRefineGrp ); + myNode2Lbl = new QLabel( tr( "NODE_2" ), myRefineGrp ); + myNode2 = new QSpinBox( myRefineGrp ); - // Widgets for refinement of existing mesh elements - myRefineGrp = new QFrame(aPatGrp); - myRefineGrp->setFrameStyle(QFrame::NoFrame); - QGridLayout* aRefGrid = new QGridLayout(myRefineGrp, 3, 3, 0, 5); - - mySelLbl[ Ids ] = new QLabel(myRefineGrp); - mySelBtn[ Ids ] = new QPushButton(myRefineGrp); - mySelBtn[ Ids ]->setPixmap(iconSlct); - mySelEdit[ Ids ] = new QLineEdit(myRefineGrp); - - QLabel* aNodeLbl = new QLabel(tr("NODE_1"), myRefineGrp); - myNode1 = new QSpinBox(myRefineGrp); - myNode2Lbl = new QLabel(tr("NODE_2"), myRefineGrp); - myNode2 = new QSpinBox(myRefineGrp); - - aRefGrid->addWidget(mySelLbl [ Ids ], 0, 0); - aRefGrid->addWidget(mySelBtn [ Ids ], 0, 1); - aRefGrid->addWidget(mySelEdit[ Ids ], 0, 2); - aRefGrid->addWidget(aNodeLbl, 1, 0); - aRefGrid->addMultiCellWidget(myNode1, 1, 1, 1, 2); - aRefGrid->addWidget(myNode2Lbl, 2, 0); - aRefGrid->addMultiCellWidget(myNode2, 2, 2, 1, 2); - - // reverse check box - myReverseChk = new QCheckBox(tr("REVERSE"), aPatGrp); - - // CreatePoly check box + myRefineGrpLayout->addWidget( mySelLbl[ Ids ], 0, 0 ); + myRefineGrpLayout->addWidget( mySelBtn[ Ids ], 0, 1 ); + myRefineGrpLayout->addWidget( mySelEdit[ Ids ], 0, 2 ); + myRefineGrpLayout->addWidget( aNodeLbl, 1, 0 ); + myRefineGrpLayout->addWidget( myNode1, 1, 1, 1, 2 ); + myRefineGrpLayout->addWidget( myNode2Lbl, 2, 0 ); + myRefineGrpLayout->addWidget( myNode2, 2, 1, 1, 2 ); + + // ... reverse check box + myReverseChk = new QCheckBox( tr( "REVERSE" ), aPatGrp ); + + // ... CreatePoly check box myCreatePolygonsChk = new QCheckBox( tr( "CREATE_POLYGONS_NEAR_BOUNDARY" ), aPatGrp ); myCreatePolyedrsChk = new QCheckBox( tr( "CREATE_POLYEDRS_NEAR_BOUNDARY" ), aPatGrp ); - // Pictures 2d and 3d - for (int i = 0; i < 2; i++) { - if (i == 0) { - myPicture2d = new SMESHGUI_PatternWidget(aPatGrp), - myPicture2d->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); - } else { - myPicture3d = new QFrame(aPatGrp), - myPreview3d = new QLabel(myPicture3d); - myPreview3d->setPixmap(iconSample3d); - QGridLayout* aLay = new QGridLayout(myPicture3d, 3, 3, 0, 0); - QSpacerItem* aSpacerH1 = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); - QSpacerItem* aSpacerH2 = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); - QSpacerItem* aSpacerV1 = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); - QSpacerItem* aSpacerV2 = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); - aLay->addItem(aSpacerH1, 1, 0); - aLay->addItem(aSpacerH2, 1, 2); - aLay->addItem(aSpacerV1, 0, 1); - aLay->addItem(aSpacerV2, 2, 1); - aLay->addWidget(myPreview3d, 1, 1); - } - } + // ... Pictures 2d and 3d + + myPicture2d = new SMESHGUI_PatternWidget( aPatGrp ); + myPicture2d->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); + + myPicture3d = new QLabel( aPatGrp ); + myPicture3d->setPixmap( iconSample3d ); + myPicture3d->setScaledContents( false ); + myPicture3d->setAlignment( Qt::AlignCenter ); + myPicture3d->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); - myPreviewChk = new QCheckBox(tr("PREVIEW"), aPatGrp); + // ... preview check box + + myPreviewChk = new QCheckBox( tr( "PREVIEW" ), aPatGrp ); + + // ... layout widgets + + aPatGrpLayout->addWidget( aNameLab, 0, 0 ); + aPatGrpLayout->addWidget( myName, 0, 1 ); + aPatGrpLayout->addWidget( myOpenBtn, 0, 2 ); + aPatGrpLayout->addWidget( myNewBtn, 0, 3 ); + aPatGrpLayout->addWidget( myRefine, 1, 0, 1, 4 ); + aPatGrpLayout->addWidget( myRefine, 1, 0, 1, 4 ); + aPatGrpLayout->addWidget( myGeomGrp, 2, 0, 1, 4 ); + aPatGrpLayout->addWidget( myRefineGrp, 3, 0, 1, 4 ); + aPatGrpLayout->addWidget( myReverseChk, 4, 0, 1, 4 ); + aPatGrpLayout->addWidget( myCreatePolygonsChk, 5, 0, 1, 4 ); + aPatGrpLayout->addWidget( myCreatePolyedrsChk, 6, 0, 1, 4 ); + aPatGrpLayout->addWidget( myPicture2d, 7, 0, 1, 4 ); + aPatGrpLayout->addWidget( myPicture3d, 8, 0, 1, 4 ); + aPatGrpLayout->addWidget( myPreviewChk, 9, 0, 1, 4 ); + + // main layout + + aMainGrpLayout->addWidget( aTypeGrp ); + aMainGrpLayout->addWidget( aMeshGrp ); + aMainGrpLayout->addWidget( aPatGrp ); // Connect signals and slots - connect(myTypeGrp, SIGNAL(clicked(int)), SLOT(onTypeChanged(int))); + connect(myTypeGrp, SIGNAL(buttonClicked(int)), SLOT(onTypeChanged(int))); connect(myOpenBtn, SIGNAL(clicked()), SLOT(onOpen())); connect(myNewBtn, SIGNAL(clicked()), SLOT(onNew())); @@ -287,7 +329,7 @@ QFrame* SMESHGUI_MeshPatternDlg::createMainFrame (QWidget* theParent) // name : SMESHGUI_MeshPatternDlg::createButtonFrame // Purpose : Create frame containing buttons //======================================================================= -QFrame* SMESHGUI_MeshPatternDlg::createButtonFrame (QWidget* theParent) +QWidget* SMESHGUI_MeshPatternDlg::createButtonFrame (QWidget* theParent) { QFrame* aFrame = new QFrame(theParent); aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken); @@ -295,15 +337,16 @@ QFrame* SMESHGUI_MeshPatternDlg::createButtonFrame (QWidget* theParent) myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), aFrame); myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame); myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame); - myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aFrame); + myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aFrame); - QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); - - QHBoxLayout* aLay = new QHBoxLayout(aFrame, MARGIN, SPACING); + QHBoxLayout* aLay = new QHBoxLayout( aFrame ); + aLay->setMargin( MARGIN ); + aLay->setSpacing( SPACING ); aLay->addWidget(myOkBtn); aLay->addWidget(myApplyBtn); - aLay->addItem(aSpacer); + aLay->addSpacing( 10 ); + aLay->addStretch(); aLay->addWidget(myCloseBtn); aLay->addWidget(myHelpBtn); @@ -348,7 +391,7 @@ void SMESHGUI_MeshPatternDlg::Init() connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate())); connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose())); - myTypeGrp->setButton(Type_2d); + myTypeGrp->button(Type_2d)->setChecked(true); onTypeChanged(Type_2d); onModeToggled(isRefine()); @@ -368,7 +411,7 @@ void SMESHGUI_MeshPatternDlg::Init() //======================================================================= bool SMESHGUI_MeshPatternDlg::isValid (const bool theMess) { - QValueList ids; + QList ids; if ((isRefine() && (myMesh->_is_nil() || !getIds(ids) || getNode(false) < 0 || myType == Type_3d && (getNode(true) < 0 || getNode(false) == getNode(true)))) @@ -378,15 +421,15 @@ bool SMESHGUI_MeshPatternDlg::isValid (const bool theMess) myGeomObj[ Vertex1 ]->_is_nil() || myType == Type_3d && myGeomObj[ Vertex2 ]->_is_nil()))) { if (theMess) - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), - tr("SMESHGUI_INVALID_PARAMETERS"), QMessageBox::Ok); + SUIT_MessageBox::information(this, tr("SMESH_INSUFFICIENT_DATA"), + tr("SMESHGUI_INVALID_PARAMETERS")); return false; } - if ( myName->text()=="" ) { + if ( myName->text().isEmpty() ) { if (theMess) - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"), - tr("SMESHGUI_INVALID_PARAMETERS"), QMessageBox::Ok); + SUIT_MessageBox::information(this, tr("SMESH_INSUFFICIENT_DATA"), + tr("SMESHGUI_INVALID_PARAMETERS")); return false; } @@ -406,12 +449,12 @@ bool SMESHGUI_MeshPatternDlg::onApply() erasePreview(); if (isRefine()) { // Refining existing mesh elements - QValueList ids; + QList ids; getIds(ids); SMESH::long_array_var varIds = new SMESH::long_array(); varIds->length(ids.count()); int i = 0; - for (QValueList::iterator it = ids.begin(); it != ids.end(); ++it) + for (QList::iterator it = ids.begin(); it != ids.end(); ++it) varIds[i++] = *it; myType == Type_2d ? myPattern->ApplyToMeshFaces (myMesh, varIds, getNode(false), myReverseChk->isChecked()) @@ -449,8 +492,8 @@ bool SMESHGUI_MeshPatternDlg::onApply() return true; } else { - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"), - tr("SMESH_OPERATION_FAILED"), QMessageBox::Ok); + SUIT_MessageBox::information(this, tr("SMESH_ERROR"), + tr("SMESH_OPERATION_FAILED")); return false; } } catch (const SALOME::SALOME_Exception& S_ex) { @@ -504,10 +547,11 @@ void SMESHGUI_MeshPatternDlg::onHelp() #else platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName)); } } @@ -712,12 +756,12 @@ QString SMESHGUI_MeshPatternDlg::autoExtension (const QString& theFileName) cons void SMESHGUI_MeshPatternDlg::onOpen() { SUIT_FileDlg* aDlg = new SUIT_FileDlg (this, true); - aDlg->setCaption(tr("LOAD_PATTERN")); - aDlg->setMode(QFileDialog::ExistingFile); + aDlg->setWindowTitle(tr("LOAD_PATTERN")); + aDlg->setFileMode(QFileDialog::ExistingFile); aDlg->setFilters(prepareFilters()); - if (myName->text() != "") - aDlg->setSelection(myName->text() + ".smp"); - QPushButton* anOkBtn = (QPushButton*)aDlg->child("OK", "QPushButton"); + if (!myName->text().isEmpty()) + aDlg->selectFile(myName->text() + ".smp"); + QPushButton* anOkBtn = qFindChild( aDlg, "OK" ); if (anOkBtn != 0) anOkBtn->setText(tr("SMESH_BUT_OK")); @@ -728,7 +772,7 @@ void SMESHGUI_MeshPatternDlg::onOpen() if (fName.isEmpty()) return; - if (QFileInfo(fName).extension().isEmpty()) + if (QFileInfo(fName).suffix().isEmpty()) fName = autoExtension(fName); fName = QDir::convertSeparators(fName); @@ -739,22 +783,21 @@ void SMESHGUI_MeshPatternDlg::onOpen() // Read string from file QFile aFile(fName); - if (!aFile.open(IO_ReadOnly)) { - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"), - tr("ERROR_OF_OPENING"), QMessageBox::Ok); + if (!aFile.open(QIODevice::ReadOnly)) { + SUIT_MessageBox::information(this, tr("SMESH_ERROR"), + tr("ERROR_OF_OPENING")); return; } QByteArray aDataArray = aFile.readAll(); - const char* aData = aDataArray.data(); - if (aData == 0) { - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"), - tr("ERROR_OF_READING"), QMessageBox::Ok); + if (aDataArray.size() > 0) { + SUIT_MessageBox::information(this, tr("SMESH_ERROR"), + tr("ERROR_OF_READING")); return; } - if (loadFromFile(aData)) - myName->setText(QFileInfo(fName).baseName()); + if (loadFromFile(aDataArray)) + myName->setText(QFileInfo(fName).completeBaseName()); updateWgState(); displayPreview(); @@ -848,7 +891,7 @@ void SMESHGUI_MeshPatternDlg::displayPreview() return; } else { PointVector aPoints(pnts->length()); - QValueVector aKeyPoints(keyPoints->length()); + QVector aKeyPoints(keyPoints->length()); ConnectivityVector anElemPoints(elemPoints->length()); for (int i = 0, n = pnts->length(); i < n; i++) @@ -858,7 +901,7 @@ void SMESHGUI_MeshPatternDlg::displayPreview() aKeyPoints[ i2 ] = keyPoints[ i2 ]; for (int i3 = 0, n3 = elemPoints->length(); i3 < n3; i3++) { - QValueVector aVec(elemPoints[ i3 ].length()); + QVector aVec(elemPoints[ i3 ].length()); for (int i4 = 0, n4 = elemPoints[ i3 ].length(); i4 < n4; i4++) aVec[ i4 ] = elemPoints[ i3 ][ i4 ]; @@ -924,7 +967,7 @@ void SMESHGUI_MeshPatternDlg::displayPreview() void SMESHGUI_MeshPatternDlg::erasePreview() { // Erase preview in 2D viewer - myPicture2d->SetPoints(PointVector(), QValueVector(), ConnectivityVector()); + myPicture2d->SetPoints(PointVector(), QVector(), ConnectivityVector()); // Erase preview in 3D viewer if (myPreviewActor == 0) @@ -975,7 +1018,7 @@ void SMESHGUI_MeshPatternDlg::updateWgState() } } - QValueList ids; + QList ids; if (!CORBA::is_nil(myPattern)/* && getIds(ids)*/) { SMESH::long_array_var keyPoints = myPattern->GetKeyPoints(); if (keyPoints->length()) { @@ -1055,7 +1098,7 @@ bool SMESHGUI_MeshPatternDlg::loadFromFile (const QString& theName) try { SMESH::SMESH_Pattern_var aPattern = SMESH::GetPattern(); - if (!aPattern->LoadFromFile(theName.latin1()) || + if (!aPattern->LoadFromFile(theName.toLatin1().data()) || myType == Type_2d && !aPattern->Is2D()) { SMESH::SMESH_Pattern::ErrorCode aCode = aPattern->GetErrorCode(); QString aMess; @@ -1070,7 +1113,7 @@ bool SMESHGUI_MeshPatternDlg::loadFromFile (const QString& theName) else if (aCode == SMESH::SMESH_Pattern::ERR_READ_BAD_KEY_POINT ) aMess = tr("ERR_READ_BAD_KEY_POINT"); else aMess = tr("ERROR_OF_LOADING"); - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"), aMess, QMessageBox::Ok); + SUIT_MessageBox::information(this, tr("SMESH_ERROR"), aMess); return false; } else { myPattern = aPattern; @@ -1078,9 +1121,9 @@ bool SMESHGUI_MeshPatternDlg::loadFromFile (const QString& theName) } } catch (const SALOME::SALOME_Exception& S_ex) { SalomeApp_Tools::QtCatchCorbaException(S_ex); - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"), - tr("ERROR_OF_LOADING"), QMessageBox::Ok); - return false; + SUIT_MessageBox::information(this, tr("SMESH_ERROR"), + tr("ERROR_OF_LOADING") ); + return false; } } @@ -1156,12 +1199,12 @@ vtkUnstructuredGrid* SMESHGUI_MeshPatternDlg::getGrid() try { // Get points from pattern SMESH::point_array_var pnts; - QValueList ids; + QList ids; if (isRefine() && getIds(ids)) { SMESH::long_array_var varIds = new SMESH::long_array(); varIds->length(ids.count()); int i = 0; - for (QValueList::iterator it = ids.begin(); it != ids.end(); ++it) + for (QList::iterator it = ids.begin(); it != ids.end(); ++it) varIds[i++] = *it; pnts = myType == Type_2d ? myPattern->ApplyToMeshFaces (myMesh, varIds, getNode(false), myReverseChk->isChecked()) @@ -1306,7 +1349,7 @@ void SMESHGUI_MeshPatternDlg::onTextChanged (const QString& theNewText) aMesh = anActor->GetObject()->GetMesh(); if (aMesh) { - QStringList aListId = QStringList::split(" ", theNewText, false); + QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts); TColStd_MapOfInteger newIndices; @@ -1336,7 +1379,7 @@ void SMESHGUI_MeshPatternDlg::onNodeChanged (int value) QSpinBox* second = first == myNode1 ? myNode2 : myNode1; int secondVal = second->value(); if (secondVal == value) { - secondVal = value == second->maxValue() ? second->minValue() : value + 1; + secondVal = value == second->maximum() ? second->minimum() : value + 1; bool blocked = second->signalsBlocked(); second->blockSignals(true); second->setValue(secondVal); @@ -1351,10 +1394,10 @@ void SMESHGUI_MeshPatternDlg::onNodeChanged (int value) // name : getIds // Purpose : //======================================================================= -bool SMESHGUI_MeshPatternDlg::getIds (QValueList& ids) const +bool SMESHGUI_MeshPatternDlg::getIds (QList& ids) const { ids.clear(); - QStringList strIds = QStringList::split(" ", mySelEdit[Ids]->text()); + QStringList strIds = mySelEdit[Ids]->text().split(" ", QString::SkipEmptyParts ); bool isOk; int val; for (QStringList::iterator it = strIds.begin(); it != strIds.end(); ++it) { @@ -1385,7 +1428,7 @@ void SMESHGUI_MeshPatternDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) + if ( e->key() == Qt::Key_F1 ) { e->accept(); onHelp(); diff --git a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.h b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.h index d0eab7c59..d74249b0e 100755 --- a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.h +++ b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.h @@ -1,61 +1,56 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_MeshPatternDlg.h +// Author : Sergey LITONIN, Open CASCADE S.A.S. // -// File : SMESHGUI_MeshPatternDlg.h -// Author : Sergey LITONIN -// Module : SMESH - -#ifndef SMESHGUI_MeshPatternDlg_H -#define SMESHGUI_MeshPatternDlg_H +#ifndef SMESHGUI_MESHPATTERNDLG_H +#define SMESHGUI_MESHPATTERNDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include +// Qt includes +#include +#include -// IDL Headers +// IDL includes #include -#include CORBA_SERVER_HEADER(GEOM_Gen) #include CORBA_SERVER_HEADER(SMESH_Mesh) #include CORBA_SERVER_HEADER(SMESH_Pattern) -class QCloseEvent; class QFrame; class QLineEdit; -class SMESHGUI_SpinBox; class QPushButton; -class LightApp_SelectionMgr; class QRadioButton; class QCheckBox; class QButtonGroup; class QLabel; class QSpinBox; -class QGroupBox; -class SMESHGUI_CreatePatternDlg; -class SMESHGUI_PatternWidget; class vtkUnstructuredGrid; class SALOME_Actor; -class SVTK_ViewWindow; class SVTK_Selector; +class LightApp_SelectionMgr; class SMESHGUI; +class SMESHGUI_CreatePatternDlg; +class SMESHGUI_PatternWidget; /* Class : SMESHGUI_MeshPatternDlg @@ -73,14 +68,12 @@ class SMESHGUI_EXPORT SMESHGUI_MeshPatternDlg : public QDialog enum { Mesh, Object, Vertex1, Vertex2, Ids }; public: - SMESHGUI_MeshPatternDlg( SMESHGUI*, - const char* = 0 ); - virtual ~SMESHGUI_MeshPatternDlg(); + SMESHGUI_MeshPatternDlg( SMESHGUI* ); + virtual ~SMESHGUI_MeshPatternDlg(); void Init(); private slots: - void onOk(); bool onApply(); void onClose(); @@ -100,12 +93,11 @@ private slots: void onOkCreationDlg(); void onCloseCreationDlg(); void onTextChanged( const QString& ); - void onNodeChanged( int value ); + void onNodeChanged( int ); private: - - QFrame* createButtonFrame( QWidget* ); - QFrame* createMainFrame ( QWidget* ); + QWidget* createButtonFrame( QWidget* ); + QWidget* createMainFrame( QWidget* ); void displayPreview(); vtkUnstructuredGrid* getGrid(); void erasePreview(); @@ -113,19 +105,18 @@ private: bool loadFromFile( const QString& ); void activateSelection(); QStringList prepareFilters() const; - QString autoExtension( const QString& theFileName ) const; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; - void keyPressEvent(QKeyEvent*); - bool isValid( const bool theMess = true ); + QString autoExtension( const QString& ) const; + void closeEvent( QCloseEvent* ); + void enterEvent( QEvent* ); + void keyPressEvent( QKeyEvent* ); + bool isValid( const bool = true ); void resetSelInput(); bool isRefine() const; - bool getIds( QValueList& ) const; + bool getIds( QList& ) const; int getNode( bool = false ) const; private: - QPushButton* myOkBtn; QPushButton* myApplyBtn; QPushButton* myCloseBtn; @@ -142,10 +133,10 @@ private: QSpinBox* myNode2; QLabel* myNode2Lbl; - QGroupBox* myGeomGrp; - QMap< int, QPushButton* > mySelBtn; - QMap< int, QLineEdit* > mySelEdit; - QMap< int, QLabel* > mySelLbl; + QFrame* myGeomGrp; + QMap mySelBtn; + QMap mySelEdit; + QMap mySelLbl; QLineEdit* myName; QPushButton* myOpenBtn; @@ -155,8 +146,7 @@ private: QCheckBox* myCreatePolygonsChk; QCheckBox* myCreatePolyedrsChk; SMESHGUI_PatternWidget* myPicture2d; - QFrame* myPicture3d; - QLabel* myPreview3d; + QLabel* myPicture3d; QCheckBox* myPreviewChk; @@ -171,7 +161,7 @@ private: SMESH::SMESH_Mesh_var myMesh; GEOM::GEOM_Object_var myMeshShape; - QMap< int, GEOM::GEOM_Object_var > myGeomObj; + QMap myGeomObj; SMESHGUI_CreatePatternDlg* myCreationDlg; SMESH::SMESH_Pattern_var myPattern; @@ -180,4 +170,4 @@ private: QString myHelpFileName; }; -#endif +#endif // SMESHGUI_MESHPATTERNDLG_H diff --git a/src/SMESHGUI/SMESHGUI_MeshUtils.cxx b/src/SMESHGUI/SMESHGUI_MeshUtils.cxx index ccbdaff7d..37116d124 100644 --- a/src/SMESHGUI/SMESHGUI_MeshUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshUtils.cxx @@ -1,33 +1,45 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// +// SMESH SMESHGUI : GUI for SMESH component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_MeshUtils.cxx +// Author : Open CASCADE S.A.S. +// - +// SMESH includes #include "SMESHGUI_MeshUtils.h" + #include "SMESHGUI_Utils.h" -#include "SALOMEDSClient_Study.hxx" -#include "SALOMEconfig.h" +// SALOME KERNEL includes +#include + +// Qt includes +#include + +// IDL includes +#include #include CORBA_SERVER_HEADER(SMESH_Group) namespace SMESH { - SMESH_Mesh_var GetMeshByIO(const Handle(SALOME_InteractiveObject)& theIO) { CORBA::Object_var anObj = IObjectToObject(theIO); @@ -45,27 +57,28 @@ namespace SMESH return SMESH_Mesh::_nil(); } - QString UniqueMeshName(const char* theBaseName, const char* thePostfix) + QString UniqueMeshName(const QString& theBaseName, const QString& thePostfix) { - QString baseName = theBaseName; - if ( thePostfix/* && !name.contains( postfix )*/) { // add postfix - baseName += "_"; - baseName += thePostfix; - } - if(_PTR(Study) aStudy = GetActiveStudyDocument()) { + QString baseName = thePostfix.isEmpty() ? + theBaseName : theBaseName + "_" + thePostfix; + if ( _PTR(Study) aStudy = GetActiveStudyDocument() ) { QString name = baseName; - while ( !aStudy->FindObjectByName( name.latin1(), "SMESH" ).empty() ) { + while ( !aStudy->FindObjectByName( name.toLatin1().data(), "SMESH" ).empty() ) { int nb = 0; - if ( name[ name.length()-1 ].isNumber() ) { - int nbBeg = name.findRev("_"); - nb = name.right( name.length() - nbBeg - 1 ).toInt(); - name = name.left( nbBeg ); - } - name += QString("_%1").arg( nb+1 ); + QStringList names = name.split("_", QString::KeepEmptyParts); + if ( names.count() > 0 ) { + bool ok; + int index = names.last().toInt( &ok ); + if ( ok ) { + nb = index; + names.removeLast(); + } + } + names.append( QString::number( nb+1 ) ); + name = names.join( "_" ); } return name; } - return QString(""); + return baseName; } - -} +} // end of namespace SMESH diff --git a/src/SMESHGUI/SMESHGUI_MeshUtils.h b/src/SMESHGUI/SMESHGUI_MeshUtils.h index c7e93a065..e879ae85d 100644 --- a/src/SMESHGUI/SMESHGUI_MeshUtils.h +++ b/src/SMESHGUI/SMESHGUI_MeshUtils.h @@ -1,42 +1,51 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// +// SMESH SMESHGUI : GUI for SMESH component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_MeshUtils.h +// Author : Open CASCADE S.A.S. +// -#ifndef SMESHGUI_MeshUtils_HeaderFile -#define SMESHGUI_MeshUtils_HeaderFile +#ifndef SMESHGUI_MESHUTILS_H +#define SMESHGUI_MESHUTILS_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include "SALOME_InteractiveObject.hxx" - -#include "SALOMEconfig.h" -#include CORBA_SERVER_HEADER(SMESH_Mesh) - -#include +// Qt includes +#include +// SALOME GUI includes +#include -namespace SMESH{ - -SMESHGUI_EXPORT - SMESH_Mesh_var GetMeshByIO(const Handle(SALOME_InteractiveObject)& theIO); +// IDL includes +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) - QString UniqueMeshName(const char* theBaseName, const char* thePostfix); +namespace SMESH +{ + SMESHGUI_EXPORT + SMESH_Mesh_var GetMeshByIO( const Handle(SALOME_InteractiveObject)& ); + + SMESHGUI_EXPORT + QString UniqueMeshName( const QString&, const QString& = QString() ); } - -#endif +#endif // SMESHGUI_MESHUTILS_H diff --git a/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx b/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx index de8ebe9b5..131e60b9f 100644 --- a/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MoveNodesDlg.cxx @@ -1,31 +1,29 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_MoveNodesDlg.cxx +// Author : Nicolas REJNERI, Open CASCADE S.A.S. // -// -// File : SMESHGUI_MoveNodesDlg.cxx -// Author : Nicolas REJNERI -// Module : SMESH -// $Header$ +// SMESH includes #include "SMESHGUI_MoveNodesDlg.h" #include "SMESHGUI.h" @@ -35,32 +33,27 @@ #include "SMESHGUI_VTKUtils.h" #include "SMESHGUI_MeshUtils.h" -#include "SMESH_Actor.h" -#include "SMDS_Mesh.hxx" -#include "SMDS_MeshNode.hxx" - -#include "LightApp_SelectionMgr.h" -#include "LightApp_Application.h" -#include "SUIT_ResourceMgr.h" -#include "SUIT_Desktop.h" -#include "SUIT_Session.h" -#include "SUIT_MessageBox.h" +#include +#include -#include "SVTK_Selector.h" -#include "SVTK_ViewModel.h" -#include "SVTK_ViewWindow.h" -#include "SALOME_ListIO.hxx" +// SALOME GUI includes +#include +#include +#include +#include +#include +#include -#include "SVTK_ViewWindow.h" -#include "VTKViewer_CellLocationsArray.h" +#include +#include +#include -#include "utilities.h" +#include // OCCT includes #include // VTK includes -#include #include #include #include @@ -68,54 +61,49 @@ #include #include -// QT includes -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// IDL Headers +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include + +// IDL includes #include #include CORBA_SERVER_HEADER(SMESH_Mesh) #include CORBA_SERVER_HEADER(SMESH_MeshEditor) -#define MARGIN 10 -#define SPACING 5 - +#define SPACING 6 +#define MARGIN 11 //================================================================================= // name : SMESHGUI_MoveNodesDlg::SMESHGUI_MoveNodesDlg // Purpose : //================================================================================= -SMESHGUI_MoveNodesDlg::SMESHGUI_MoveNodesDlg (SMESHGUI* theModule, - const char* theName): - QDialog(SMESH::GetDesktop(theModule), - theName, - false, - WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), +SMESHGUI_MoveNodesDlg::SMESHGUI_MoveNodesDlg(SMESHGUI* theModule): + QDialog(SMESH::GetDesktop(theModule)), mySelectionMgr(SMESH::GetSelectionMgr(theModule)), mySMESHGUI(theModule) { myPreviewActor = 0; myBusy = false; - setCaption(tr("CAPTION")); + setModal(false); + setWindowTitle(tr("CAPTION")); - QVBoxLayout* aDlgLay = new QVBoxLayout (this, MARGIN, SPACING); + QVBoxLayout* aDlgLay = new QVBoxLayout(this); + aDlgLay->setSpacing(SPACING); + aDlgLay->setMargin(MARGIN); - QFrame* aMainFrame = createMainFrame (this); - QFrame* aBtnFrame = createButtonFrame(this); + QWidget* aMainFrame = createMainFrame (this); + QWidget* aBtnFrame = createButtonFrame(this); aDlgLay->addWidget(aMainFrame); aDlgLay->addWidget(aBtnFrame); - aDlgLay->setStretchFactor(aMainFrame, 1); - mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); myHelpFileName = "moving_nodes_page.html"; @@ -127,7 +115,7 @@ SMESHGUI_MoveNodesDlg::SMESHGUI_MoveNodesDlg (SMESHGUI* theModule, // name : SMESHGUI_MoveNodesDlg::createButtonFrame // Purpose : Create frame containing buttons //======================================================================= -QFrame* SMESHGUI_MoveNodesDlg::createButtonFrame (QWidget* theParent) +QWidget* SMESHGUI_MoveNodesDlg::createButtonFrame (QWidget* theParent) { QFrame* aFrame = new QFrame(theParent); aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken); @@ -135,15 +123,17 @@ QFrame* SMESHGUI_MoveNodesDlg::createButtonFrame (QWidget* theParent) myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), aFrame); myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame); myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame); - myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aFrame); + myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aFrame); - QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); - - QHBoxLayout* aLay = new QHBoxLayout(aFrame, MARGIN, SPACING); + QHBoxLayout* aLay = new QHBoxLayout(aFrame); + aLay->setSpacing(SPACING); + aLay->setMargin(MARGIN); aLay->addWidget(myOkBtn); + aLay->addSpacing(10); aLay->addWidget(myApplyBtn); - aLay->addItem(aSpacer); + aLay->addSpacing(10); + aLay->addStretch(); aLay->addWidget(myCloseBtn); aLay->addWidget(myHelpBtn); @@ -159,49 +149,78 @@ QFrame* SMESHGUI_MoveNodesDlg::createButtonFrame (QWidget* theParent) // name : SMESHGUI_MoveNodesDlg::createMainFrame // Purpose : Create frame containing dialog's input fields //======================================================================= -QFrame* SMESHGUI_MoveNodesDlg::createMainFrame (QWidget* theParent) +QWidget* SMESHGUI_MoveNodesDlg::createMainFrame (QWidget* theParent) { - QFrame* aFrame = new QFrame(theParent); + QWidget* aFrame = new QWidget(theParent); QPixmap iconMoveNode (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_MOVE_NODE"))); QPixmap iconSelect (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT"))); - QButtonGroup* aPixGrp = new QButtonGroup(1, Qt::Vertical, tr("MESH_NODE"), aFrame); - aPixGrp->setExclusive(TRUE); + //------------------------------------------------------------ + QGroupBox* aPixGrp = new QGroupBox(tr("MESH_NODE"), aFrame); + QHBoxLayout* aPixGrpLayout = new QHBoxLayout(aPixGrp); + aPixGrpLayout->setSpacing(SPACING); + aPixGrpLayout->setMargin(MARGIN); + QRadioButton* aRBut = new QRadioButton(aPixGrp); - aRBut->setPixmap(iconMoveNode); - aRBut->setChecked(TRUE); + aRBut->setIcon(iconMoveNode); + aRBut->setChecked(true); + + aPixGrpLayout->addWidget(aRBut); + aPixGrpLayout->addStretch(); - QGroupBox* anIdGrp = new QGroupBox(1, Qt::Vertical, tr("SMESH_MOVE"), aFrame); - new QLabel(tr("NODE_ID"), anIdGrp); - (new QPushButton(anIdGrp))->setPixmap(iconSelect); + //------------------------------------------------------------ + QGroupBox* anIdGrp = new QGroupBox(tr("SMESH_MOVE"), aFrame); + QHBoxLayout* anIdGrpLayout = new QHBoxLayout(anIdGrp); + anIdGrpLayout->setSpacing(SPACING); + anIdGrpLayout->setMargin(MARGIN); + + QLabel* idLabl = new QLabel(tr("NODE_ID"), anIdGrp); + QPushButton* idBtn = new QPushButton(anIdGrp); + idBtn->setIcon(iconSelect); myId = new QLineEdit(anIdGrp); - myId->setValidator(new SMESHGUI_IdValidator(this, "validator", 1)); + myId->setValidator(new SMESHGUI_IdValidator(this, 1)); + + anIdGrpLayout->addWidget(idLabl); + anIdGrpLayout->addWidget(idBtn); + anIdGrpLayout->addWidget(myId); + + //------------------------------------------------------------ + QGroupBox* aCoordGrp = new QGroupBox(tr("SMESH_COORDINATES"), aFrame); + QHBoxLayout* aCoordGrpLayout = new QHBoxLayout(aCoordGrp); + aCoordGrpLayout->setSpacing(SPACING); + aCoordGrpLayout->setMargin(MARGIN); - QGroupBox* aCoordGrp = new QGroupBox(1, Qt::Vertical, tr("SMESH_COORDINATES"), aFrame); QLabel* aXLabel = new QLabel(tr("SMESH_X"), aCoordGrp); - aXLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); myX = new SMESHGUI_SpinBox(aCoordGrp); QLabel* aYLabel = new QLabel(tr("SMESH_Y"), aCoordGrp); - //aYLabel->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); - aYLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); myY = new SMESHGUI_SpinBox(aCoordGrp); QLabel* aZLabel = new QLabel(tr("SMESH_Z"), aCoordGrp); - //aZLabel->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); - aZLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); myZ = new SMESHGUI_SpinBox(aCoordGrp); + aCoordGrpLayout->addWidget(aXLabel); + aCoordGrpLayout->addWidget(myX); + aCoordGrpLayout->addWidget(aYLabel); + aCoordGrpLayout->addWidget(myY); + aCoordGrpLayout->addWidget(aZLabel); + aCoordGrpLayout->addWidget(myZ); + + //------------------------------------------------------------ myX->RangeStepAndValidator(COORD_MIN, COORD_MAX, 25.0, DBL_DIGITS_DISPLAY); myY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 25.0, DBL_DIGITS_DISPLAY); myZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 25.0, DBL_DIGITS_DISPLAY); + //------------------------------------------------------------ QVBoxLayout* aLay = new QVBoxLayout(aFrame); + aLay->setMargin(0); + aLay->setMargin(SPACING); aLay->addWidget(aPixGrp); aLay->addWidget(anIdGrp); aLay->addWidget(aCoordGrp); + //------------------------------------------------------------ // connect signale and slots connect(myX, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview())); connect(myY, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview())); @@ -240,8 +259,6 @@ void SMESHGUI_MoveNodesDlg::Init() reset(); setEnabled(true); - this->show(); - // set selection mode SMESH::SetPointRepresentation(true); if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) @@ -254,12 +271,12 @@ void SMESHGUI_MoveNodesDlg::Init() // name : SMESHGUI_MoveNodesDlg::isValid // Purpose : Verify validity of entry information //======================================================================= -bool SMESHGUI_MoveNodesDlg::isValid (const bool theMess) const +bool SMESHGUI_MoveNodesDlg::isValid (const bool theMess) { if (myId->text().isEmpty()) { if (theMess) - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_WARNING"), - tr("NODE_ID_IS_NOT_DEFINED"), QMessageBox::Ok); + SUIT_MessageBox::information(this, tr("SMESH_WARNING"), + tr("NODE_ID_IS_NOT_DEFINED")); return false; } return true; @@ -293,8 +310,8 @@ bool SMESHGUI_MoveNodesDlg::onApply() SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(myMeshActor->getIO()); if (aMesh->_is_nil()) { - QMessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"), - tr("SMESHG_NO_MESH"), QMessageBox::Ok); + SUIT_MessageBox::information(this, tr("SMESH_ERROR"), + tr("SMESHG_NO_MESH")); return false; } @@ -363,10 +380,11 @@ void SMESHGUI_MoveNodesDlg::onHelp() #else platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName)); } } @@ -611,9 +629,8 @@ void SMESHGUI_MoveNodesDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) - { - e->accept(); - onHelp(); - } + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + onHelp(); + } } diff --git a/src/SMESHGUI/SMESHGUI_MoveNodesDlg.h b/src/SMESHGUI/SMESHGUI_MoveNodesDlg.h index ffb43e939..5986cea40 100644 --- a/src/SMESHGUI/SMESHGUI_MoveNodesDlg.h +++ b/src/SMESHGUI/SMESHGUI_MoveNodesDlg.h @@ -1,51 +1,46 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_MoveNodesDlg.h +// Author : Nicolas REJNERI, Open CASCADE S.A.S. // -// File : SMESHGUI_MoveNodesDlg.h -// Author : Nicolas REJNERI -// Module : SMESH -// $Header$ -#ifndef DIALOGBOX_MOVE_NODES_H -#define DIALOGBOX_MOVE_NODES_H +#ifndef SMESHGUI_MOVENODESDLG_H +#define SMESHGUI_MOVENODESDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include "LightApp_SelectionMgr.h" - -#include +// Qt includes +#include class QLineEdit; class QPushButton; -class SMESHGUI_SpinBox; -class SALOME_Actor; -class QFrame; class SMESHGUI; class SMESH_Actor; -class SUIT_Desktop; +class SMESHGUI_SpinBox; +class SALOME_Actor; class SVTK_Selector; -class SVTK_ViewWindow; +class LightApp_SelectionMgr; //================================================================================= // class : SMESHGUI_MoveNodesDlg @@ -56,15 +51,12 @@ class SMESHGUI_EXPORT SMESHGUI_MoveNodesDlg : public QDialog Q_OBJECT public: - - SMESHGUI_MoveNodesDlg(SMESHGUI* theModule, - const char* name = 0); - virtual ~SMESHGUI_MoveNodesDlg(); + SMESHGUI_MoveNodesDlg( SMESHGUI* ); + virtual ~SMESHGUI_MoveNodesDlg(); - void Init(); + void Init(); private slots: - void onOk(); bool onApply(); void onClose(); @@ -74,23 +66,21 @@ private slots: void onSelectionDone(); void redisplayPreview(); - void onTextChange(const QString&); + void onTextChange( const QString& ); private: - - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; - void hideEvent ( QHideEvent * ); + void closeEvent( QCloseEvent* ); + void enterEvent( QEvent* ); + void hideEvent( QHideEvent* ); void keyPressEvent( QKeyEvent* ); void erasePreview(); - QFrame* createButtonFrame( QWidget* ); - QFrame* createMainFrame ( QWidget* ); - bool isValid( const bool ) const; + QWidget* createButtonFrame( QWidget* ); + QWidget* createMainFrame ( QWidget* ); + bool isValid( const bool ); void reset(); void updateButtons(); private: - QPushButton* myOkBtn; QPushButton* myApplyBtn; QPushButton* myCloseBtn; @@ -112,4 +102,4 @@ private: QString myHelpFileName; }; -#endif // DIALOGBOX_MOVE_NODES_H +#endif // SMESHGUI_MOVENODESDLG_H diff --git a/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx b/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx index 70bf3f61d..83b092f0d 100755 --- a/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx @@ -1,30 +1,27 @@ -// SMESH SMESHGUI : GUI for SMESH component +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_MultiEditDlg.cxx +// Author : Sergey LITONIN, Open CASCADE S.A.S. // -// -// File : SMESHGUI_MultiEditDlg.cxx -// Author : Sergey LITONIN -// Module : SMESH +// SMESH includes #include "SMESHGUI_MultiEditDlg.h" #include "SMESHGUI.h" @@ -36,38 +33,31 @@ #include "SMESHGUI_FilterUtils.h" #include "SMESHGUI_SpinBox.h" -#include "SMESH_Actor.h" -#include "SMESH_TypeFilter.hxx" -#include "SMDS_Mesh.hxx" -#include "SMDS_MeshElement.hxx" +#include +#include +#include -#include "SUIT_ResourceMgr.h" -#include "SUIT_Desktop.h" -#include "SUIT_Session.h" -#include "SUIT_MessageBox.h" +// SALOME GUI includes +#include +#include +#include +#include -#include "LightApp_SelectionMgr.h" -#include "LightApp_Application.h" -#include "SALOME_ListIO.hxx" -#include "SALOME_ListIteratorOfListIO.hxx" +#include +#include +#include +#include -#include "SVTK_Selector.h" -#include "SVTK_ViewModel.h" -#include "SVTK_ViewWindow.h" -#include "VTKViewer_CellLocationsArray.h" +#include +#include +#include -// OCCT Includes -#include +// OCCT includes #include #include #include -// VTK Includes -#include -#include -#include -#include -#include +// VTK includes #include #include #include @@ -75,26 +65,27 @@ #include #include -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// IDL Headers -#include "SALOMEconfig.h" +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// IDL includes +#include #include CORBA_SERVER_HEADER(SMESH_Group) -#define SPACING 5 -#define MARGIN 10 +#define SPACING 6 +#define MARGIN 11 /*! * Class : SMESHGUI_MultiEditDlg @@ -109,30 +100,29 @@ SMESHGUI_MultiEditDlg ::SMESHGUI_MultiEditDlg(SMESHGUI* theModule, const int theMode, - const bool the3d2d, - const char* theName): - QDialog(SMESH::GetDesktop(theModule), - theName, - false, - WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose), - mySelector(SMESH::GetViewWindow(theModule)->GetSelector()), - mySelectionMgr(SMESH::GetSelectionMgr(theModule)), - mySMESHGUI(theModule) + const bool the3d2d): + QDialog(SMESH::GetDesktop(theModule)), + mySelector(SMESH::GetViewWindow(theModule)->GetSelector()), + mySelectionMgr(SMESH::GetSelectionMgr(theModule)), + mySMESHGUI(theModule) { + setModal(false); + setAttribute(Qt::WA_DeleteOnClose, true); + myFilterDlg = 0; myEntityType = 0; myFilterType = theMode; - QVBoxLayout* aDlgLay = new QVBoxLayout(this, MARGIN, SPACING); + QVBoxLayout* aDlgLay = new QVBoxLayout(this); + aDlgLay->setMargin(MARGIN); + aDlgLay->setSpacing(SPACING); - QFrame* aMainFrame = createMainFrame (this, the3d2d); - QFrame* aBtnFrame = createButtonFrame(this); + QWidget* aMainFrame = createMainFrame (this, the3d2d); + QWidget* aBtnFrame = createButtonFrame(this); aDlgLay->addWidget(aMainFrame); aDlgLay->addWidget(aBtnFrame); - aDlgLay->setStretchFactor(aMainFrame, 1); - aDlgLay->setStretchFactor(aBtnFrame, 0); Init(); } @@ -140,86 +130,137 @@ SMESHGUI_MultiEditDlg // name : SMESHGUI_MultiEditDlg::createMainFrame // Purpose : Create frame containing dialog's input fields //======================================================================= -QFrame* SMESHGUI_MultiEditDlg::createMainFrame (QWidget* theParent, const bool the3d2d) +QWidget* SMESHGUI_MultiEditDlg::createMainFrame (QWidget* theParent, const bool the3d2d) { - QGroupBox* aMainGrp = new QGroupBox(1, Qt::Horizontal, theParent); - aMainGrp->setFrameStyle(QFrame::NoFrame); - aMainGrp->setInsideMargin(0); + QWidget* aMainGrp = new QWidget(theParent); + QVBoxLayout* aMainGrpLayout = new QVBoxLayout(aMainGrp); + aMainGrpLayout->setMargin(0); + aMainGrpLayout->setSpacing(SPACING); QPixmap aPix (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT"))); // "Selected cells" group - mySelGrp = new QGroupBox(1, Qt::Horizontal, aMainGrp); + mySelGrp = new QGroupBox(aMainGrp); + + QGridLayout* mySelGrpLayout = new QGridLayout(mySelGrp); + mySelGrpLayout->setMargin(MARGIN); + mySelGrpLayout->setSpacing(SPACING); myEntityTypeGrp = 0; if (the3d2d) { - myEntityTypeGrp = new QHButtonGroup(tr("SMESH_ELEMENTS_TYPE"), mySelGrp); - (new QRadioButton(tr("SMESH_FACE"), myEntityTypeGrp))->setChecked(true); - (new QRadioButton(tr("SMESH_VOLUME"), myEntityTypeGrp)); - myEntityType = myEntityTypeGrp->id(myEntityTypeGrp->selected()); - } + QGroupBox* aEntityTypeGrp = new QGroupBox(tr("SMESH_ELEMENTS_TYPE"), mySelGrp); + myEntityTypeGrp = new QButtonGroup(mySelGrp); + QHBoxLayout* aEntityLayout = new QHBoxLayout(aEntityTypeGrp); + aEntityLayout->setMargin(MARGIN); + aEntityLayout->setSpacing(SPACING); - QFrame* aFrame = new QFrame(mySelGrp); + QRadioButton* aFaceRb = new QRadioButton(tr("SMESH_FACE"), aEntityTypeGrp); + QRadioButton* aVolumeRb = new QRadioButton(tr("SMESH_VOLUME"), aEntityTypeGrp); - myListBox = new QListBox(aFrame); - myListBox->setSelectionMode(QListBox::Extended); - myListBox->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); - myListBox->installEventFilter(this); + aEntityLayout->addWidget(aFaceRb); + aEntityLayout->addWidget(aVolumeRb); - myFilterBtn = new QPushButton(tr("FILTER") , aFrame); - myAddBtn = new QPushButton(tr("ADD") , aFrame); - myRemoveBtn = new QPushButton(tr("REMOVE") , aFrame); - mySortBtn = new QPushButton(tr("SORT_LIST"), aFrame); + myEntityTypeGrp->addButton(aFaceRb, 0); + myEntityTypeGrp->addButton(aVolumeRb, 1); + aFaceRb->setChecked(true); + myEntityType = myEntityTypeGrp->checkedId(); - QGridLayout* aLay = new QGridLayout(aFrame, 5, 2, 0, 5); - aLay->addMultiCellWidget(myListBox, 0, 4, 0, 0); - aLay->addWidget(myFilterBtn, 0, 1); - aLay->addWidget(myAddBtn, 1, 1); - aLay->addWidget(myRemoveBtn, 2, 1); - aLay->addWidget(mySortBtn, 3, 1); + mySelGrpLayout->addWidget(aEntityTypeGrp, 0, 0, 1, 2); + } - QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); - aLay->addItem(aSpacer, 4, 1); + myListBox = new QListWidget(mySelGrp); + myListBox->setSelectionMode(QListWidget::ExtendedSelection); + myListBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); + myListBox->installEventFilter(this); + + myFilterBtn = new QPushButton(tr("FILTER"), mySelGrp); + myAddBtn = new QPushButton(tr("ADD"), mySelGrp); + myRemoveBtn = new QPushButton(tr("REMOVE"), mySelGrp); + mySortBtn = new QPushButton(tr("SORT_LIST"), mySelGrp); + + int row = mySelGrpLayout->rowCount(); + mySelGrpLayout->addWidget(myListBox, row, 0, 6, 1); + mySelGrpLayout->addWidget(myFilterBtn, row, 1); + mySelGrpLayout->addWidget(myAddBtn, row+2, 1); + mySelGrpLayout->addWidget(myRemoveBtn, row+3, 1); + mySelGrpLayout->addWidget(mySortBtn, row+5, 1); + mySelGrpLayout->setRowMinimumHeight(row+1, 10); + mySelGrpLayout->setRowMinimumHeight(row+4, 10); + mySelGrpLayout->setRowStretch(row+1, 5); + mySelGrpLayout->setRowStretch(row+4, 5); myToAllChk = new QCheckBox(tr("TO_ALL"), mySelGrp); + mySelGrpLayout->addWidget(myToAllChk, mySelGrpLayout->rowCount(), 0, + 1, mySelGrpLayout->columnCount()); // Split/Join criterion group - myCriterionGrp = new QGroupBox(3, Qt::Vertical, tr("SPLIT_JOIN_CRITERION"), aMainGrp); - - myGroupChoice = new QButtonGroup(3, Qt::Vertical, myCriterionGrp); - myGroupChoice->setInsideMargin(0); - myGroupChoice->setFrameStyle(QFrame::NoFrame); - (new QRadioButton(tr("USE_DIAGONAL_1_3"), myGroupChoice))->setChecked(true); - (new QRadioButton(tr("USE_DIAGONAL_2_4"), myGroupChoice)); - (new QRadioButton(tr("USE_NUMERIC_FUNC"), myGroupChoice)); + myCriterionGrp = new QGroupBox(tr("SPLIT_JOIN_CRITERION"), aMainGrp); + QVBoxLayout* aCriterionLayout = new QVBoxLayout(myCriterionGrp); + aCriterionLayout->setMargin(MARGIN); + aCriterionLayout->setSpacing(SPACING); + + myChoiceWidget = new QWidget(myCriterionGrp); + myGroupChoice = new QButtonGroup(myChoiceWidget); + QVBoxLayout* aGroupChoiceLayout = new QVBoxLayout(myChoiceWidget); + aGroupChoiceLayout->setMargin(0); + aGroupChoiceLayout->setSpacing(SPACING); + + QRadioButton* aDiag13RB = new QRadioButton(tr("USE_DIAGONAL_1_3"), myChoiceWidget); + QRadioButton* aDiag24RB = new QRadioButton(tr("USE_DIAGONAL_2_4"), myChoiceWidget); + QRadioButton* aNumFuncRB = new QRadioButton(tr("USE_NUMERIC_FUNC"), myChoiceWidget); + + aGroupChoiceLayout->addWidget(aDiag13RB); + aGroupChoiceLayout->addWidget(aDiag24RB); + aGroupChoiceLayout->addWidget(aNumFuncRB); + myGroupChoice->addButton(aDiag13RB, 0); + myGroupChoice->addButton(aDiag24RB, 1); + myGroupChoice->addButton(aNumFuncRB, 2); + aDiag13RB->setChecked(true); myComboBoxFunctor = new QComboBox(myCriterionGrp); - myComboBoxFunctor->insertItem(tr("ASPECTRATIO_ELEMENTS")); - myComboBoxFunctor->insertItem(tr("MINIMUMANGLE_ELEMENTS")); - myComboBoxFunctor->insertItem(tr("SKEW_ELEMENTS")); - myComboBoxFunctor->insertItem(tr("AREA_ELEMENTS")); - //myComboBoxFunctor->insertItem(tr("LENGTH2D_EDGES")); // for existing elements only - //myComboBoxFunctor->insertItem(tr("MULTI2D_BORDERS")); // for existing elements only - myComboBoxFunctor->setCurrentItem(0); + myComboBoxFunctor->addItem(tr("ASPECTRATIO_ELEMENTS")); + myComboBoxFunctor->addItem(tr("MINIMUMANGLE_ELEMENTS")); + myComboBoxFunctor->addItem(tr("SKEW_ELEMENTS")); + myComboBoxFunctor->addItem(tr("AREA_ELEMENTS")); + //myComboBoxFunctor->addItem(tr("LENGTH2D_EDGES")); // for existing elements only + //myComboBoxFunctor->addItem(tr("MULTI2D_BORDERS")); // for existing elements only + myComboBoxFunctor->setCurrentIndex(0); + + aCriterionLayout->addWidget(myChoiceWidget); + aCriterionLayout->addWidget(myComboBoxFunctor); myCriterionGrp->hide(); - myGroupChoice->hide(); + myChoiceWidget->hide(); myComboBoxFunctor->setEnabled(false); // "Select from" group - QGroupBox* aGrp = new QGroupBox(3, Qt::Horizontal, tr("SELECT_FROM"), aMainGrp); + QGroupBox* aGrp = new QGroupBox(tr("SELECT_FROM"), aMainGrp); + QGridLayout* aGrpLayout = new QGridLayout(aGrp); + aGrpLayout->setMargin(MARGIN); + aGrpLayout->setSpacing(SPACING); mySubmeshChk = new QCheckBox(tr("SMESH_SUBMESH"), aGrp); mySubmeshBtn = new QPushButton(aGrp); mySubmesh = new QLineEdit(aGrp); mySubmesh->setReadOnly(true); - mySubmeshBtn->setPixmap(aPix); + mySubmeshBtn->setIcon(aPix); myGroupChk = new QCheckBox(tr("SMESH_GROUP"), aGrp); myGroupBtn = new QPushButton(aGrp); myGroup = new QLineEdit(aGrp); myGroup->setReadOnly(true); - myGroupBtn->setPixmap(aPix); + myGroupBtn->setIcon(aPix); + + aGrpLayout->addWidget(mySubmeshChk); + aGrpLayout->addWidget(mySubmeshBtn); + aGrpLayout->addWidget(mySubmesh); + aGrpLayout->addWidget(myGroupChk); + aGrpLayout->addWidget(myGroupBtn); + aGrpLayout->addWidget(myGroup); + + aMainGrpLayout->addWidget(mySelGrp); + aMainGrpLayout->addWidget(myCriterionGrp); + aMainGrpLayout->addWidget(aGrp); return aMainGrp; } @@ -228,23 +269,24 @@ QFrame* SMESHGUI_MultiEditDlg::createMainFrame (QWidget* theParent, const bool t // name : SMESHGUI_MultiEditDlg::createButtonFrame // Purpose : Create frame containing buttons //======================================================================= -QFrame* SMESHGUI_MultiEditDlg::createButtonFrame (QWidget* theParent) +QWidget* SMESHGUI_MultiEditDlg::createButtonFrame (QWidget* theParent) { - QFrame* aFrame = new QFrame (theParent); - aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken); + QGroupBox* aFrame = new QGroupBox(theParent); myOkBtn = new QPushButton (tr("SMESH_BUT_OK" ), aFrame); myApplyBtn = new QPushButton (tr("SMESH_BUT_APPLY"), aFrame); myCloseBtn = new QPushButton (tr("SMESH_BUT_CLOSE"), aFrame); - myHelpBtn = new QPushButton (tr("SMESH_BUT_HELP"), aFrame); - - QSpacerItem* aSpacer = new QSpacerItem (0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); + myHelpBtn = new QPushButton (tr("SMESH_BUT_HELP"), aFrame); - QHBoxLayout* aLay = new QHBoxLayout (aFrame, MARGIN, SPACING); + QHBoxLayout* aLay = new QHBoxLayout (aFrame); + aLay->setMargin(MARGIN); + aLay->setSpacing(SPACING); aLay->addWidget(myOkBtn); + aLay->addSpacing(10); aLay->addWidget(myApplyBtn); - aLay->addItem(aSpacer); + aLay->addSpacing(10); + aLay->addStretch(); aLay->addWidget(myCloseBtn); aLay->addWidget(myHelpBtn); @@ -269,7 +311,7 @@ SMESHGUI_MultiEditDlg::~SMESHGUI_MultiEditDlg() { if (myFilterDlg != 0) { - myFilterDlg->reparent(0, QPoint()); + myFilterDlg->setParent(0); delete myFilterDlg; } } @@ -282,7 +324,7 @@ bool SMESHGUI_MultiEditDlg::eventFilter (QObject* object, QEvent* event) { if (object == myListBox && event->type() == QEvent::KeyPress) { QKeyEvent* ke = (QKeyEvent*)event; - if (ke->key() == Key_Delete) + if (ke->key() == Qt::Key_Delete) onRemoveBtn(); } return QDialog::eventFilter(object, event); @@ -316,7 +358,7 @@ SMESH::NumericalFunctor_ptr SMESHGUI_MultiEditDlg::getNumericalFunctor() aNF = aFilterMgr->CreateLength2D(); else if (myComboBoxFunctor->currentText() == tr("MULTI2D_BORDERS")) aNF = aFilterMgr->CreateMultiConnection2D(); - else ; + else; return aNF._retn(); } @@ -347,16 +389,16 @@ void SMESHGUI_MultiEditDlg::Init() // dialog controls connect(myFilterBtn, SIGNAL(clicked()), SLOT(onFilterBtn() )); - connect(myAddBtn , SIGNAL(clicked()), SLOT(onAddBtn() )); + connect(myAddBtn, SIGNAL(clicked()), SLOT(onAddBtn() )); connect(myRemoveBtn, SIGNAL(clicked()), SLOT(onRemoveBtn() )); - connect(mySortBtn , SIGNAL(clicked()), SLOT(onSortListBtn())); + connect(mySortBtn, SIGNAL(clicked()), SLOT(onSortListBtn())); connect(mySubmeshChk, SIGNAL(stateChanged(int)), SLOT(onSubmeshChk())); - connect(myGroupChk , SIGNAL(stateChanged(int)), SLOT(onGroupChk() )); - connect(myToAllChk , SIGNAL(stateChanged(int)), SLOT(onToAllChk() )); + connect(myGroupChk, SIGNAL(stateChanged(int)), SLOT(onGroupChk() )); + connect(myToAllChk, SIGNAL(stateChanged(int)), SLOT(onToAllChk() )); if (myEntityTypeGrp) - connect(myEntityTypeGrp, SIGNAL(clicked(int)), SLOT(on3d2dChanged(int))); + connect(myEntityTypeGrp, SIGNAL(buttonClicked(int)), SLOT(on3d2dChanged(int))); connect(myListBox, SIGNAL(selectionChanged()), SLOT(onListSelectionChanged())); @@ -396,26 +438,26 @@ SMESH::long_array_var SMESHGUI_MultiEditDlg::getIds() { // skl 07.02.2006 SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh(); - if( myFilterType == SMESHGUI_TriaFilter || - myFilterType == SMESHGUI_QuadFilter || - myFilterType == SMESHGUI_FaceFilter ) { + if( myFilterType == SMESH::TriaFilter || + myFilterType == SMESH::QuadFilter || + myFilterType == SMESH::FaceFilter ) { SMDS_FaceIteratorPtr it = aMesh->facesIterator(); while(it->more()) { const SMDS_MeshFace* f = it->next(); - if(myFilterType == SMESHGUI_FaceFilter) { + if(myFilterType == SMESH::FaceFilter) { myIds.Add(f->GetID()); } - else if( myFilterType==SMESHGUI_TriaFilter && + else if( myFilterType==SMESH::TriaFilter && ( f->NbNodes()==3 || f->NbNodes()==6 ) ) { myIds.Add(f->GetID()); } - else if( myFilterType==SMESHGUI_QuadFilter && + else if( myFilterType==SMESH::QuadFilter && ( f->NbNodes()==4 || f->NbNodes()==8 ) ) { myIds.Add(f->GetID()); } } } - else if(myFilterType == SMESHGUI_VolumeFilter) { + else if(myFilterType == SMESH::VolumeFilter) { SMDS_VolumeIteratorPtr it = aMesh->volumesIterator(); while(it->more()) { const SMDS_MeshVolume* f = it->next(); @@ -490,16 +532,17 @@ void SMESHGUI_MultiEditDlg::onHelp() if (app) app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); else { - QString platform; + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName)); } } @@ -548,11 +591,12 @@ void SMESHGUI_MultiEditDlg::onSelectionDone() Handle(SALOME_InteractiveObject) anIO = aList.First(); int aNbItems = SMESH::GetNameOfSelectedElements(mySelector,anIO,aListStr); if (aNbItems > 0) { - QStringList anElements = QStringList::split(" ", aListStr); - QListBoxItem* anItem = 0; + QStringList anElements = aListStr.split(" ", QString::SkipEmptyParts); for (QStringList::iterator it = anElements.begin(); it != anElements.end(); ++it) { - anItem = myListBox->findItem(*it, Qt::ExactMatch); - if (anItem) myListBox->setSelected(anItem, true); + QList items = myListBox->findItems(*it, Qt::MatchExactly); + QListWidgetItem* anItem; + foreach(anItem, items) + anItem->setSelected(true); } } @@ -643,7 +687,7 @@ void SMESHGUI_MultiEditDlg::onFilterAccepted() { myIds.Clear(); for (int i = 0, n = myListBox->count(); i < n; i++) - myIds.Add(myListBox->text(i).toInt()); + myIds.Add(myListBox->item(i)->text().toInt()); emit ListContensChanged(); @@ -691,7 +735,7 @@ void SMESHGUI_MultiEditDlg::onAddBtn() mySelector->GetIndex(aList.First(),toBeAdded); } else if (mySubmeshChk->isChecked()) { SALOME_ListIteratorOfListIO anIter(aList); - for (; anIter.More(); anIter.Next()) { + for ( ; anIter.More(); anIter.Next()) { SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface(anIter.Value()); if (!aSubMesh->_is_nil()) { @@ -706,7 +750,7 @@ void SMESHGUI_MultiEditDlg::onAddBtn() } } else if (myGroupChk->isChecked()) { SALOME_ListIteratorOfListIO anIter(aList); - for (; anIter.More(); anIter.Next()) { + for ( ; anIter.More(); anIter.Next()) { SMESH::SMESH_GroupBase_var aGroup = SMESH::IObjectToInterface(anIter.Value()); if (!aGroup->_is_nil() && (aGroup->GetType() == SMESH::FACE && @@ -730,9 +774,9 @@ void SMESHGUI_MultiEditDlg::onAddBtn() myGroupChk->setChecked(false); for(int i = 1; i <= toBeAdded.Extent(); i++) if (myIds.Add(toBeAdded(i))) { - QListBoxItem * item = new QListBoxText(QString("%1").arg(toBeAdded(i))); - myListBox->insertItem(item); - myListBox->setSelected(item, true); + QListWidgetItem* item = new QListWidgetItem(QString("%1").arg(toBeAdded(i))); + myListBox->addItem(item); + item->setSelected(true); } myBusy = false; @@ -796,18 +840,14 @@ void SMESHGUI_MultiEditDlg::onRemoveBtn() { myBusy = true; - for (int i = 0, n = myListBox->count(); i < n; i++) + QList selItems = myListBox->selectedItems(); + QListWidgetItem* item; + foreach(item, selItems) { - for (int i = myListBox->count(); i > 0; i--) { - if (myListBox->isSelected(i - 1)) - { - int anId = myListBox->text(i - 1).toInt(); - myIds.Remove(anId); - myIds.Remove(anId); - myListBox->removeItem(i-1); - } - } + myIds.Remove(item->text().toInt()); + delete item; } + myBusy = false; emit ListContensChanged(); @@ -826,26 +866,23 @@ void SMESHGUI_MultiEditDlg::onSortListBtn() int i, k = myListBox->count(); if (k > 0) { - QStringList aSelected; + QList aSelected; std::vector anArray(k); - QListBoxItem* anItem; - for (anItem = myListBox->firstItem(), i = 0; anItem != 0; anItem = anItem->next(), i++) + for (i = 0; i < k; i++) { - anArray[ i ] = anItem->text().toInt(); - if (anItem->isSelected()) - aSelected.append(anItem->text()); + int id = myListBox->item(i)->text().toInt(); + anArray[ i ] = id; + if (myListBox->item(i)->isSelected()) + aSelected.append(id); } std::sort(anArray.begin(), anArray.end()); - myListBox->clear(); - for (i = 0; i < k; i++) - myListBox->insertItem(QString::number(anArray[ i ])); - for (QStringList::iterator it = aSelected.begin(); it != aSelected.end(); ++it) - { - anItem = myListBox->findItem(*it, Qt::ExactMatch); - if (anItem) - myListBox->setSelected(anItem, true); + myListBox->clear(); + for (i = 0; i < k; i++) { + QListWidgetItem* item = new QListWidgetItem(QString::number(anArray[i])); + myListBox->addItem(item); + item->setSelected(aSelected.contains(anArray[i])); } } myBusy = false; @@ -870,11 +907,12 @@ void SMESHGUI_MultiEditDlg::onListSelectionChanged() TVisualObjPtr anObj = anActor->GetObject(); TColStd_MapOfInteger anIndexes; - for (QListBoxItem* anItem = myListBox->firstItem(); anItem != 0; anItem = anItem->next()) + int total = myListBox->count(); + for (int i = 0; i < total; i++) { - if (anItem->isSelected()) + if (myListBox->item(i)->isSelected()) { - int anId = anItem->text().toInt(); + int anId = myListBox->item(i)->text().toInt(); if (anObj->GetElemVTKId(anId) >= 0) // avoid exception in hilight anIndexes.Add(anId); } @@ -970,9 +1008,9 @@ void SMESHGUI_MultiEditDlg::setSelectionMode() } else { if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->SetSelectionMode(FaceSelection); - if (myFilterType == SMESHGUI_TriaFilter) + if (myFilterType == SMESH::TriaFilter) SMESH::SetFilter(new SMESHGUI_TriangleFilter()); - else if (myFilterType == SMESHGUI_QuadFilter) + else if (myFilterType == SMESH::QuadFilter) SMESH::SetFilter(new SMESHGUI_QuadrangleFilter()); else SMESH::SetFilter(new SMESHGUI_FacesFilter()); @@ -1034,9 +1072,9 @@ void SMESHGUI_MultiEditDlg::on3d2dChanged (int type) emit ListContensChanged(); if (type) - myFilterType = SMESHGUI_VolumeFilter; + myFilterType = SMESH::VolumeFilter; else - myFilterType = SMESHGUI_FaceFilter; + myFilterType = SMESH::FaceFilter; updateButtons(); setSelectionMode(); @@ -1062,11 +1100,10 @@ void SMESHGUI_MultiEditDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) - { - e->accept(); - onHelp(); - } + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + onHelp(); + } } /*! @@ -1075,11 +1112,10 @@ void SMESHGUI_MultiEditDlg::keyPressEvent( QKeyEvent* e ) */ SMESHGUI_ChangeOrientationDlg -::SMESHGUI_ChangeOrientationDlg(SMESHGUI* theModule, - const char* theName): - SMESHGUI_MultiEditDlg(theModule, SMESHGUI_FaceFilter, true, theName) +::SMESHGUI_ChangeOrientationDlg(SMESHGUI* theModule): + SMESHGUI_MultiEditDlg(theModule, SMESH::FaceFilter, true) { - setCaption(tr("CAPTION")); + setWindowTitle(tr("CAPTION")); myHelpFileName = "changing_orientation_of_elements_page.html"; } @@ -1099,25 +1135,30 @@ bool SMESHGUI_ChangeOrientationDlg::process (SMESH::SMESH_MeshEditor_ptr theEdit */ SMESHGUI_UnionOfTrianglesDlg -::SMESHGUI_UnionOfTrianglesDlg(SMESHGUI* theModule, - const char* theName): - SMESHGUI_MultiEditDlg(theModule, SMESHGUI_TriaFilter, false, theName) +::SMESHGUI_UnionOfTrianglesDlg(SMESHGUI* theModule): + SMESHGUI_MultiEditDlg(theModule, SMESH::TriaFilter, false) { - setCaption(tr("CAPTION")); + setWindowTitle(tr("CAPTION")); myComboBoxFunctor->setEnabled(true); - myComboBoxFunctor->insertItem(tr("WARP_ELEMENTS")); // for quadrangles only - myComboBoxFunctor->insertItem(tr("TAPER_ELEMENTS")); // for quadrangles only + myComboBoxFunctor->addItem(tr("WARP_ELEMENTS")); // for quadrangles only + myComboBoxFunctor->addItem(tr("TAPER_ELEMENTS")); // for quadrangles only // Maximum angle - QGroupBox* aMaxAngleGrp = new QGroupBox (2, Qt::Horizontal, myCriterionGrp); - aMaxAngleGrp->setInsideMargin(0); - aMaxAngleGrp->setFrameStyle(QFrame::NoFrame); - new QLabel (tr("MAXIMUM_ANGLE"), aMaxAngleGrp); + QWidget* aMaxAngleGrp = new QWidget(myCriterionGrp); + QHBoxLayout* aMaxAngleGrpLayout = new QHBoxLayout(aMaxAngleGrp); + aMaxAngleGrpLayout->setMargin(0); + aMaxAngleGrpLayout->setSpacing(SPACING); + + QLabel* aLab = new QLabel (tr("MAXIMUM_ANGLE"), aMaxAngleGrp); myMaxAngleSpin = new SMESHGUI_SpinBox (aMaxAngleGrp); myMaxAngleSpin->RangeStepAndValidator(0, 180.0, 1.0, 3); myMaxAngleSpin->SetValue(30.0); + aMaxAngleGrpLayout->addWidget(aLab); + aMaxAngleGrpLayout->addWidget(myMaxAngleSpin); + + ((QVBoxLayout*)aMaxAngleGrpLayout->layout())->addWidget(aMaxAngleGrp); myCriterionGrp->show(); myHelpFileName = "uniting_set_of_triangles_page.html"; @@ -1142,23 +1183,24 @@ bool SMESHGUI_UnionOfTrianglesDlg::process (SMESH::SMESH_MeshEditor_ptr theEdito */ SMESHGUI_CuttingOfQuadsDlg -::SMESHGUI_CuttingOfQuadsDlg(SMESHGUI* theModule, - const char* theName): - SMESHGUI_MultiEditDlg(theModule, SMESHGUI_QuadFilter, false, theName) +::SMESHGUI_CuttingOfQuadsDlg(SMESHGUI* theModule): + SMESHGUI_MultiEditDlg(theModule, SMESH::QuadFilter, false) { - setCaption(tr("CAPTION")); + setWindowTitle(tr("CAPTION")); myPreviewActor = 0; myPreviewChk = new QCheckBox (tr("PREVIEW"), mySelGrp); + QGridLayout* aLay = (QGridLayout*)(mySelGrp->layout()); + aLay->addWidget(myPreviewChk, aLay->rowCount(), 0, 1, aLay->columnCount()); myCriterionGrp->show(); - myGroupChoice->show(); + myChoiceWidget->show(); myComboBoxFunctor->setEnabled(false); - connect(myPreviewChk , SIGNAL(stateChanged(int)) , this, SLOT(onPreviewChk())); - connect(myGroupChoice , SIGNAL(clicked(int)) , this, SLOT(onCriterionRB())); - connect(myComboBoxFunctor, SIGNAL(activated(int)) , this, SLOT(onPreviewChk())); - connect(this , SIGNAL(ListContensChanged()), this, SLOT(onPreviewChk())); + connect(myPreviewChk, SIGNAL(stateChanged(int)), this, SLOT(onPreviewChk())); + connect(myGroupChoice, SIGNAL(buttonClicked(int)), this, SLOT(onCriterionRB())); + connect(myComboBoxFunctor, SIGNAL(activated(int)), this, SLOT(onPreviewChk())); + connect(this, SIGNAL(ListContensChanged()), this, SLOT(onPreviewChk())); myHelpFileName = "cutting_quadrangles_page.html"; } @@ -1176,7 +1218,7 @@ void SMESHGUI_CuttingOfQuadsDlg::onClose() bool SMESHGUI_CuttingOfQuadsDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor, const SMESH::long_array& theIds) { - switch (myGroupChoice->id(myGroupChoice->selected())) { + switch (myGroupChoice->checkedId()) { case 0: // use diagonal 1-3 return theEditor->SplitQuad(theIds, true); case 1: // use diagonal 2-4 @@ -1191,7 +1233,7 @@ bool SMESHGUI_CuttingOfQuadsDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor, void SMESHGUI_CuttingOfQuadsDlg::onCriterionRB() { - if (myGroupChoice->id(myGroupChoice->selected()) == 2) // Use numeric functor + if (myGroupChoice->checkedId() == 2) // Use numeric functor myComboBoxFunctor->setEnabled(true); else myComboBoxFunctor->setEnabled(false); @@ -1235,7 +1277,7 @@ void SMESHGUI_CuttingOfQuadsDlg::displayPreview() return; // 0 - use diagonal 1-3, 1 - use diagonal 2-4, 2 - use numerical functor - int aChoice = myGroupChoice->id(myGroupChoice->selected()); + int aChoice = myGroupChoice->checkedId(); SMESH::NumericalFunctor_var aCriterion = SMESH::NumericalFunctor::_nil(); SMESH::SMESH_MeshEditor_var aMeshEditor = SMESH::SMESH_MeshEditor::_nil(); if (aChoice == 2) { diff --git a/src/SMESHGUI/SMESHGUI_MultiEditDlg.h b/src/SMESHGUI/SMESHGUI_MultiEditDlg.h index 6a58a8489..894b908ae 100755 --- a/src/SMESHGUI/SMESHGUI_MultiEditDlg.h +++ b/src/SMESHGUI/SMESHGUI_MultiEditDlg.h @@ -1,43 +1,41 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_MultiEditDlg.h +// Author : Sergey LITONIN, Open CASCADE S.A.S. // -// -// File : SMESHGUI_MultiEditDlg.h -// Author : Sergey LITONIN -// Module : SMESH - -#ifndef SMESHGUI_MultiEditDlg_H -#define SMESHGUI_MultiEditDlg_H +#ifndef SMESHGUI_MULTIEDITDLG_H +#define SMESHGUI_MULTIEDITDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include - -#include "SUIT_SelectionFilter.h" +// Qt includes +#include +// OCCT includes #include +// IDL includes #include #include CORBA_SERVER_HEADER(SMESH_Mesh) -#include CORBA_SERVER_HEADER(SMESH_Filter) #include CORBA_SERVER_HEADER(SMESH_MeshEditor) class SMESHGUI; @@ -49,11 +47,8 @@ class SMESH_Actor; class LightApp_SelectionMgr; class SALOME_Actor; class SVTK_Selector; -class SVTK_ViewWindow; -class QFrame; -class QObject; -class QListBox; +class QListWidget; class QComboBox; class QCheckBox; class QGroupBox; @@ -72,15 +67,12 @@ class SMESHGUI_EXPORT SMESHGUI_MultiEditDlg : public QDialog Q_OBJECT public: - SMESHGUI_MultiEditDlg(SMESHGUI* theModule, - const int, - const bool = false, - const char* = 0 ); - virtual ~SMESHGUI_MultiEditDlg(); + SMESHGUI_MultiEditDlg( SMESHGUI*, const int, const bool = false ); + virtual ~SMESHGUI_MultiEditDlg(); void Init(); - bool eventFilter( QObject* object, QEvent* event ); + bool eventFilter( QObject*, QEvent* ); signals: void ListContensChanged(); @@ -108,18 +100,19 @@ protected slots: SMESH::NumericalFunctor_ptr getNumericalFunctor(); protected: - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; - void hideEvent ( QHideEvent * ); /* ESC key */ + void closeEvent( QCloseEvent* ); + void enterEvent( QEvent * ); + void hideEvent( QHideEvent* ); /* ESC key */ void keyPressEvent( QKeyEvent* ); - QFrame* createButtonFrame( QWidget* ); - QFrame* createMainFrame ( QWidget*, const bool ); + QWidget* createButtonFrame( QWidget* ); + QWidget* createMainFrame( QWidget*, const bool ); bool isValid( const bool ) const; SMESH::long_array_var getIds(); void updateButtons(); void setSelectionMode(); - virtual bool isIdValid( const int theID ) const; - virtual bool process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& ) = 0; + virtual bool isIdValid( const int ) const; + virtual bool process( SMESH::SMESH_MeshEditor_ptr, + const SMESH::long_array& ) = 0; int entityType(); protected: @@ -137,10 +130,11 @@ protected: QGroupBox* mySelGrp; QGroupBox* myCriterionGrp; + QWidget* myChoiceWidget; QButtonGroup* myGroupChoice; QComboBox* myComboBoxFunctor; - QListBox* myListBox; + QListWidget* myListBox; QPushButton* myFilterBtn; QPushButton* myAddBtn; QPushButton* myRemoveBtn; @@ -175,9 +169,8 @@ class SMESHGUI_ChangeOrientationDlg : public SMESHGUI_MultiEditDlg Q_OBJECT public: - SMESHGUI_ChangeOrientationDlg(SMESHGUI* theModule, - const char* = 0); - virtual ~SMESHGUI_ChangeOrientationDlg(); + SMESHGUI_ChangeOrientationDlg( SMESHGUI* ); + virtual ~SMESHGUI_ChangeOrientationDlg(); protected: virtual bool process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& ); @@ -192,12 +185,11 @@ class SMESHGUI_UnionOfTrianglesDlg : public SMESHGUI_MultiEditDlg Q_OBJECT public: - SMESHGUI_UnionOfTrianglesDlg(SMESHGUI* theModule, - const char* = 0); - virtual ~SMESHGUI_UnionOfTrianglesDlg(); + SMESHGUI_UnionOfTrianglesDlg( SMESHGUI* ); + virtual ~SMESHGUI_UnionOfTrianglesDlg(); protected: - virtual bool process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& ); + virtual bool process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& ); private: SMESHGUI_SpinBox* myMaxAngleSpin; @@ -212,9 +204,8 @@ class SMESHGUI_CuttingOfQuadsDlg : public SMESHGUI_MultiEditDlg Q_OBJECT public: - SMESHGUI_CuttingOfQuadsDlg(SMESHGUI* theModule, - const char* = 0); - virtual ~SMESHGUI_CuttingOfQuadsDlg(); + SMESHGUI_CuttingOfQuadsDlg( SMESHGUI* ); + virtual ~SMESHGUI_CuttingOfQuadsDlg(); protected: virtual bool process( SMESH::SMESH_MeshEditor_ptr, const SMESH::long_array& ); @@ -233,4 +224,4 @@ private: QCheckBox* myPreviewChk; }; -#endif +#endif // SMESHGUI_MULTIEDITDLG_H diff --git a/src/SMESHGUI/SMESHGUI_NodesDlg.cxx b/src/SMESHGUI/SMESHGUI_NodesDlg.cxx index 4b135d591..d3a963b39 100644 --- a/src/SMESHGUI/SMESHGUI_NodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_NodesDlg.cxx @@ -1,31 +1,29 @@ -// SMESH SMESHGUI : GUI for SMESH component -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// SMESH SMESHGUI : GUI for SMESH component // +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_NodesDlg.cxx +// Author : Nicolas REJNERI, Open CASCADE S.A.S. // -// -// File : SMESHGUI_NodesDlg.cxx -// Author : Nicolas REJNERI -// Module : SMESH -// $Header$ +// SMESH includes #include "SMESHGUI_NodesDlg.h" #include "SMESHGUI.h" @@ -34,134 +32,130 @@ #include "SMESHGUI_VTKUtils.h" #include "SMESHGUI_MeshUtils.h" -#include "SMESH_Actor.h" -#include "SMESH_ActorUtils.h" -#include "SMESH_ObjectDef.h" +#include +#include +#include -#include "SMDS_Mesh.hxx" -#include "SMDS_MeshNode.hxx" +#include +#include -#include "SUIT_Session.h" -#include "SUIT_OverrideCursor.h" -#include "SUIT_ViewWindow.h" -#include "SUIT_ViewManager.h" -#include "SUIT_MessageBox.h" -#include "SUIT_Desktop.h" +// SALOME GUI includes +#include +#include +#include +#include +#include -#include "SalomeApp_Study.h" -#include "LightApp_Application.h" -#include "LightApp_SelectionMgr.h" +#include +#include -#include "SVTK_Selector.h" -#include "SVTK_ViewWindow.h" -#include "VTKViewer_CellLocationsArray.h" +#include +#include -#include "SALOME_Actor.h" -#include "SALOME_ListIO.hxx" +// SALOME KERNEL includes +#include +#include -#include "utilities.h" +#include -// VTK Includes -#include +// VTK includes #include #include #include #include #include -#include #include #include - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - +#include + +// Qt includes +#include +#include +#include +#include +#include +#include +#include + +// IDL includes +#include #include CORBA_SERVER_HEADER(SMESH_MeshEditor) -using namespace std; - - -namespace SMESH { +#define SPACING 6 +#define MARGIN 11 - void AddNode (SMESH::SMESH_Mesh_ptr theMesh, float x, float y, float z) +namespace SMESH +{ + void AddNode( SMESH::SMESH_Mesh_ptr theMesh, float x, float y, float z ) { SUIT_OverrideCursor wc; try { - _PTR(SObject) aSobj = SMESH::FindSObject(theMesh); + _PTR(SObject) aSobj = SMESH::FindSObject( theMesh ); SMESH::SMESH_MeshEditor_var aMeshEditor = theMesh->GetMeshEditor(); - aMeshEditor->AddNode(x,y,z); + aMeshEditor->AddNode( x, y, z ); _PTR(Study) aStudy = GetActiveStudyDocument(); CORBA::Long anId = aStudy->StudyId(); - if (TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId, aSobj->GetID().c_str())) { - aVisualObj->Update(true); + if (TVisualObjPtr aVisualObj = SMESH::GetVisualObj( anId, aSobj->GetID().c_str() ) ) { + aVisualObj->Update( true ); } - } catch (SALOME::SALOME_Exception& exc) { - INFOS("Follow exception was cought:\n\t" << exc.details.text); - } catch (const std::exception& exc) { - INFOS("Follow exception was cought:\n\t" << exc.what()); - } catch (...) { - INFOS("Unknown exception was cought !!!"); + } + catch ( SALOME::SALOME_Exception& exc ) { + INFOS( "Follow exception was cought:\n\t" << exc.details.text ); + } + catch ( const std::exception& exc ) { + INFOS( "Follow exception was cought:\n\t" << exc.what() ); + } + catch ( ... ) { + INFOS( "Unknown exception was cought !!!" ); } } - class TNodeSimulation { - SVTK_ViewWindow* myViewWindow; + class TNodeSimulation + { + SVTK_ViewWindow* myViewWindow; - SALOME_Actor *myPreviewActor; + SALOME_Actor* myPreviewActor; vtkDataSetMapper* myMapper; - vtkPoints* myPoints; + vtkPoints* myPoints; public: - TNodeSimulation(SVTK_ViewWindow* theViewWindow): - myViewWindow(theViewWindow) + TNodeSimulation( SVTK_ViewWindow* theViewWindow ): + myViewWindow( theViewWindow ) { vtkUnstructuredGrid* aGrid = vtkUnstructuredGrid::New(); // Create points myPoints = vtkPoints::New(); - myPoints->SetNumberOfPoints(1); - myPoints->SetPoint(0,0.0,0.0,0.0); + myPoints->SetNumberOfPoints( 1 ); + myPoints->SetPoint( 0, 0.0, 0.0, 0.0 ); // Create cells vtkIdList *anIdList = vtkIdList::New(); - anIdList->SetNumberOfIds(1); + anIdList->SetNumberOfIds( 1 ); vtkCellArray *aCells = vtkCellArray::New(); - aCells->Allocate(2, 0); + aCells->Allocate( 2, 0 ); vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New(); - aCellTypesArray->SetNumberOfComponents(1); - aCellTypesArray->Allocate(1); + aCellTypesArray->SetNumberOfComponents( 1 ); + aCellTypesArray->Allocate( 1 ); - anIdList->SetId(0, 0); - aCells->InsertNextCell(anIdList); - aCellTypesArray->InsertNextValue(VTK_VERTEX); + anIdList->SetId( 0, 0 ); + aCells->InsertNextCell( anIdList ); + aCellTypesArray->InsertNextValue( VTK_VERTEX ); VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New(); - aCellLocationsArray->SetNumberOfComponents(1); - aCellLocationsArray->SetNumberOfTuples(1); + aCellLocationsArray->SetNumberOfComponents( 1 ); + aCellLocationsArray->SetNumberOfTuples( 1 ); aCells->InitTraversal(); vtkIdType npts = 0; - aCellLocationsArray->SetValue(0, aCells->GetTraversalLocation(npts)); + aCellLocationsArray->SetValue( 0, aCells->GetTraversalLocation( npts ) ); - aGrid->SetCells(aCellTypesArray, aCellLocationsArray, aCells); + aGrid->SetCells( aCellTypesArray, aCellLocationsArray, aCells ); - aGrid->SetPoints(myPoints); - aGrid->SetCells(aCellTypesArray, aCellLocationsArray,aCells); + aGrid->SetPoints( myPoints ); + aGrid->SetCells( aCellTypesArray, aCellLocationsArray, aCells ); aCellLocationsArray->Delete(); aCellTypesArray->Delete(); aCells->Delete(); @@ -169,14 +163,14 @@ namespace SMESH { // Create and display actor myMapper = vtkDataSetMapper::New(); - myMapper->SetInput(aGrid); + myMapper->SetInput( aGrid ); aGrid->Delete(); myPreviewActor = SALOME_Actor::New(); - myPreviewActor->SetInfinitive(true); + myPreviewActor->SetInfinitive( true ); myPreviewActor->VisibilityOff(); myPreviewActor->PickableOff(); - myPreviewActor->SetMapper(myMapper); + myPreviewActor->SetMapper( myMapper ); vtkProperty* aProp = vtkProperty::New(); aProp->SetRepresentationToPoints(); @@ -191,25 +185,25 @@ namespace SMESH { myPreviewActor->SetProperty( aProp ); aProp->Delete(); - myViewWindow->AddActor(myPreviewActor); + myViewWindow->AddActor( myPreviewActor ); } - void SetPosition (float x, float y, float z) + void SetPosition( float x, float y, float z ) { - myPoints->SetPoint(0,x,y,z); + myPoints->SetPoint( 0, x, y, z ); myPoints->Modified(); - SetVisibility(true); + SetVisibility( true ); } - void SetVisibility (bool theVisibility) + void SetVisibility( bool theVisibility ) { - myPreviewActor->SetVisibility(theVisibility); + myPreviewActor->SetVisibility( theVisibility ); RepaintCurrentView(); } ~TNodeSimulation() { - myViewWindow->RemoveActor(myPreviewActor); + myViewWindow->RemoveActor( myPreviewActor ); myPreviewActor->Delete(); myMapper->RemoveAllInputs(); @@ -224,120 +218,88 @@ namespace SMESH { // class : SMESHGUI_NodesDlg() // purpose : //================================================================================= -SMESHGUI_NodesDlg::SMESHGUI_NodesDlg (SMESHGUI* theModule, - const char* name, - bool modal, - WFlags fl): - QDialog(SMESH::GetDesktop(theModule), - name, - modal, - WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose), - mySelector(SMESH::GetViewWindow(theModule)->GetSelector()), - mySelectionMgr(SMESH::GetSelectionMgr(theModule)), - mySMESHGUI(theModule) +SMESHGUI_NodesDlg::SMESHGUI_NodesDlg( SMESHGUI* theModule ): + QDialog( SMESH::GetDesktop( theModule ) ), + mySelector( SMESH::GetViewWindow( theModule )->GetSelector() ), + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), + mySMESHGUI( theModule ) { - mySimulation = new SMESH::TNodeSimulation(SMESH::GetViewWindow( mySMESHGUI )); - - QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_NODE"))); - if (!name) - setName("SMESHGUI_NodesDlg"); - resize(303, 185); - setCaption(tr("MESH_NODE_TITLE")); - setSizeGripEnabled(TRUE); - SMESHGUI_NodesDlgLayout = new QGridLayout(this); - SMESHGUI_NodesDlgLayout->setSpacing(6); - SMESHGUI_NodesDlgLayout->setMargin(11); + setModal( false ); + setAttribute( Qt::WA_DeleteOnClose, true ); + setWindowTitle( "MESH_NODE_TITLE" ); + setSizeGripEnabled( true ); + + mySimulation = new SMESH::TNodeSimulation( SMESH::GetViewWindow( mySMESHGUI ) ); + + QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", + tr( "ICON_DLG_NODE" ) ) ); + + QVBoxLayout* SMESHGUI_NodesDlgLayout = new QVBoxLayout( this ); + SMESHGUI_NodesDlgLayout->setSpacing( SPACING ); + SMESHGUI_NodesDlgLayout->setMargin( MARGIN ); /***************************************************************/ - GroupButtons = new QGroupBox(this, "GroupButtons"); - GroupButtons->setGeometry(QRect(10, 10, 281, 48)); - GroupButtons->setTitle(tr("" )); - GroupButtons->setColumnLayout(0, Qt::Vertical); - GroupButtons->layout()->setSpacing(0); - GroupButtons->layout()->setMargin(0); - GroupButtonsLayout = new QGridLayout(GroupButtons->layout()); - GroupButtonsLayout->setAlignment(Qt::AlignTop); - GroupButtonsLayout->setSpacing(6); - GroupButtonsLayout->setMargin(11); - buttonHelp = new QPushButton(GroupButtons, "buttonHelp"); - buttonHelp->setText(tr("SMESH_BUT_HELP" )); - buttonHelp->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonHelp, 0, 4); - buttonCancel = new QPushButton(GroupButtons, "buttonCancel"); - buttonCancel->setText(tr("SMESH_BUT_CLOSE" )); - buttonCancel->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonCancel, 0, 3); - buttonApply = new QPushButton(GroupButtons, "buttonApply"); - buttonApply->setText(tr("SMESH_BUT_APPLY" )); - buttonApply->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonApply, 0, 1); - QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - GroupButtonsLayout->addItem(spacer_9, 0, 2); - buttonOk = new QPushButton(GroupButtons, "buttonOk"); - buttonOk->setText(tr("SMESH_BUT_OK" )); - buttonOk->setAutoDefault(TRUE); - buttonOk->setDefault(TRUE); - GroupButtonsLayout->addWidget(buttonOk, 0, 0); - SMESHGUI_NodesDlgLayout->addWidget(GroupButtons, 2, 0); + GroupConstructors = new QGroupBox( tr( "MESH_NODE" ), this ); + QHBoxLayout* GroupConstructorsLayout = new QHBoxLayout( GroupConstructors ); + GroupConstructorsLayout->setSpacing( SPACING ); + GroupConstructorsLayout->setMargin( MARGIN ); + + Constructor1 = new QRadioButton( GroupConstructors ); + Constructor1->setIcon( image0 ); + Constructor1->setChecked( true ); + + GroupConstructorsLayout->addWidget( Constructor1 ); + GroupConstructorsLayout->addStretch(); + + /***************************************************************/ + GroupCoordinates = new QGroupBox( tr( "SMESH_COORDINATES" ), this ); + QHBoxLayout* GroupCoordinatesLayout = new QHBoxLayout(GroupCoordinates); + GroupCoordinatesLayout->setSpacing(SPACING); + GroupCoordinatesLayout->setMargin(MARGIN); + + TextLabel_X = new QLabel( tr( "SMESH_X" ), GroupCoordinates ); + SpinBox_X = new SMESHGUI_SpinBox( GroupCoordinates ); + + TextLabel_Y = new QLabel( tr( "SMESH_Y" ), GroupCoordinates ); + SpinBox_Y = new SMESHGUI_SpinBox( GroupCoordinates ); + + TextLabel_Z = new QLabel( tr( "SMESH_Z" ), GroupCoordinates ); + SpinBox_Z = new SMESHGUI_SpinBox( GroupCoordinates ); + + GroupCoordinatesLayout->addWidget( TextLabel_X ); + GroupCoordinatesLayout->addWidget( SpinBox_X ); + GroupCoordinatesLayout->addWidget( TextLabel_Y); + GroupCoordinatesLayout->addWidget( SpinBox_Y ); + GroupCoordinatesLayout->addWidget( TextLabel_Z ); + GroupCoordinatesLayout->addWidget( SpinBox_Z ); /***************************************************************/ - GroupConstructors = new QButtonGroup(this, "GroupConstructors"); - GroupConstructors->setTitle(tr("MESH_NODE" )); - GroupConstructors->setExclusive(TRUE); - GroupConstructors->setColumnLayout(0, Qt::Vertical); - GroupConstructors->layout()->setSpacing(0); - GroupConstructors->layout()->setMargin(0); - GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout()); - GroupConstructorsLayout->setAlignment(Qt::AlignTop); - GroupConstructorsLayout->setSpacing(6); - GroupConstructorsLayout->setMargin(11); - Constructor1 = new QRadioButton(GroupConstructors, "Constructor1"); - Constructor1->setText(tr("" )); - Constructor1->setPixmap(image0); - Constructor1->setChecked(TRUE); - GroupConstructorsLayout->addWidget(Constructor1, 0, 0); - QSpacerItem* spacer_2 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - GroupConstructorsLayout->addItem(spacer_2, 0, 1); - SMESHGUI_NodesDlgLayout->addWidget(GroupConstructors, 0, 0); + GroupButtons = new QGroupBox( this ); + QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons ); + GroupButtonsLayout->setSpacing( SPACING ); + GroupButtonsLayout->setMargin( MARGIN ); + buttonOk = new QPushButton( tr( "SMESH_BUT_OK" ), GroupButtons ); + buttonOk->setAutoDefault( true ); + buttonOk->setDefault( true ); + buttonApply = new QPushButton( tr( "SMESH_BUT_APPLY" ), GroupButtons ); + buttonApply->setAutoDefault( true ); + buttonCancel = new QPushButton( tr( "SMESH_BUT_CLOSE" ), GroupButtons ); + buttonCancel->setAutoDefault( true ); + buttonHelp = new QPushButton( tr( "SMESH_BUT_HELP" ), GroupButtons ); + buttonHelp->setAutoDefault( true ); + + GroupButtonsLayout->addWidget( buttonOk ); + GroupButtonsLayout->addSpacing( 10 ); + GroupButtonsLayout->addWidget( buttonApply ); + GroupButtonsLayout->addSpacing( 10 ); + GroupButtonsLayout->addStretch(); + GroupButtonsLayout->addWidget( buttonCancel ); + GroupButtonsLayout->addWidget( buttonHelp ); /***************************************************************/ - GroupCoordinates = new QGroupBox(this, "GroupCoordinates"); - GroupCoordinates->setTitle(tr("SMESH_COORDINATES" )); - GroupCoordinates->setColumnLayout(0, Qt::Vertical); - GroupCoordinates->layout()->setSpacing(0); - GroupCoordinates->layout()->setMargin(0); - GroupCoordinatesLayout = new QGridLayout(GroupCoordinates->layout()); - GroupCoordinatesLayout->setAlignment(Qt::AlignTop); - GroupCoordinatesLayout->setSpacing(6); - GroupCoordinatesLayout->setMargin(11); - - TextLabel_X = new QLabel(GroupCoordinates, "TextLabel_X"); - TextLabel_X->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); - TextLabel_X->setText(tr("SMESH_X" )); - GroupCoordinatesLayout->addWidget(TextLabel_X, 0, 0); - - TextLabel_Y = new QLabel(GroupCoordinates, "TextLabel_Y"); - //TextLabel_Y->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); - TextLabel_Y->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); - TextLabel_Y->setText(tr("SMESH_Y" )); - GroupCoordinatesLayout->addWidget(TextLabel_Y, 0, 2); - - TextLabel_Z = new QLabel(GroupCoordinates, "TextLabel_Z"); - //TextLabel_Z->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); - TextLabel_Z->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); - TextLabel_Z->setText(tr("SMESH_Z" )); - GroupCoordinatesLayout->addWidget(TextLabel_Z, 0, 4); - - SpinBox_X = new SMESHGUI_SpinBox(GroupCoordinates, "SpinBox_X"); - GroupCoordinatesLayout->addWidget(SpinBox_X, 0, 1); - - SpinBox_Y = new SMESHGUI_SpinBox(GroupCoordinates, "SpinBox_Y"); - GroupCoordinatesLayout->addWidget(SpinBox_Y, 0, 3); - - SpinBox_Z = new SMESHGUI_SpinBox(GroupCoordinates, "SpinBox_Z"); - GroupCoordinatesLayout->addWidget(SpinBox_Z, 0, 5); - - SMESHGUI_NodesDlgLayout->addWidget(GroupCoordinates, 1, 0); + SMESHGUI_NodesDlgLayout->addWidget( GroupConstructors ); + SMESHGUI_NodesDlgLayout->addWidget( GroupCoordinates ); + SMESHGUI_NodesDlgLayout->addWidget( GroupButtons ); myHelpFileName = "adding_nodes_and_elements_page.html#adding_nodes_anchor"; @@ -358,45 +320,40 @@ SMESHGUI_NodesDlg::~SMESHGUI_NodesDlg() // function : Init() // purpose : //================================================================================= -void SMESHGUI_NodesDlg::Init () +void SMESHGUI_NodesDlg::Init() { /* Get setting of step value from file configuration */ - double step; - // QString St = SUIT_CONFIG->getSetting("xxxxxxxxxxxxx"); TODO - // step = St.toDouble(); TODO - step = 25.0; + double step = 25.0; /* min, max, step and decimals for spin boxes */ - SpinBox_X->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); - SpinBox_Y->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); - SpinBox_Z->RangeStepAndValidator(COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY); - SpinBox_X->SetValue(0.0); - SpinBox_Y->SetValue(0.0); - SpinBox_Z->SetValue(0.0); + SpinBox_X->RangeStepAndValidator( COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY ); + SpinBox_Y->RangeStepAndValidator( COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY ); + SpinBox_Z->RangeStepAndValidator( COORD_MIN, COORD_MAX, step, DBL_DIGITS_DISPLAY ); + SpinBox_X->SetValue( 0.0 ); + SpinBox_Y->SetValue( 0.0 ); + SpinBox_Z->SetValue( 0.0 ); - mySMESHGUI->SetActiveDialogBox((QDialog*)this); + mySMESHGUI->SetActiveDialogBox( this ); /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); + connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ); + connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); + connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( ClickOnHelp() ) ); - connect(SpinBox_X, SIGNAL (valueChanged(double)), SLOT(ValueChangedInSpinBox(double))); - connect(SpinBox_Y, SIGNAL (valueChanged(double)), SLOT(ValueChangedInSpinBox(double))); - connect(SpinBox_Z, SIGNAL (valueChanged(double)), SLOT(ValueChangedInSpinBox(double))); + connect( SpinBox_X, SIGNAL( valueChanged( double ) ), SLOT( ValueChangedInSpinBox( double ) ) ); + connect( SpinBox_Y, SIGNAL( valueChanged( double ) ), SLOT( ValueChangedInSpinBox( double ) ) ); + connect( SpinBox_Z, SIGNAL( valueChanged( double ) ), SLOT( ValueChangedInSpinBox( double ) ) ); - connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(SelectionIntoArgument())); - connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), SLOT(DeactivateActiveDialog())); + connect( mySelectionMgr, SIGNAL( currentSelectionChanged() ), SLOT( SelectionIntoArgument() ) ); + connect( mySMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT( DeactivateActiveDialog() ) ); /* to close dialog if study frame change */ - connect(mySMESHGUI, SIGNAL (SignalStudyFrameChanged()), SLOT(ClickOnCancel())); - - this->show(); + connect( mySMESHGUI, SIGNAL( SignalStudyFrameChanged() ), SLOT( ClickOnCancel() ) ); // set selection mode - SMESH::SetPointRepresentation(true); - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->SetSelectionMode(NodeSelection); + SMESH::SetPointRepresentation( true ); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) ) + aViewWindow->SetSelectionMode( NodeSelection ); SelectionIntoArgument(); } @@ -405,14 +362,14 @@ void SMESHGUI_NodesDlg::Init () // function : ValueChangedInSpinBox() // purpose : //================================================================================= -void SMESHGUI_NodesDlg::ValueChangedInSpinBox (double newValue) +void SMESHGUI_NodesDlg::ValueChangedInSpinBox( double newValue ) { - if (!myMesh->_is_nil()) { + if ( !myMesh->_is_nil() ) { double vx = SpinBox_X->GetValue(); double vy = SpinBox_Y->GetValue(); double vz = SpinBox_Z->GetValue(); - mySimulation->SetPosition(vx,vy,vz); + mySimulation->SetPosition( vx, vy, vz ); } } @@ -422,7 +379,7 @@ void SMESHGUI_NodesDlg::ValueChangedInSpinBox (double newValue) //================================================================================= void SMESHGUI_NodesDlg::ClickOnOk() { - if (ClickOnApply()) + if ( ClickOnApply() ) ClickOnCancel(); } @@ -432,12 +389,12 @@ void SMESHGUI_NodesDlg::ClickOnOk() //================================================================================= bool SMESHGUI_NodesDlg::ClickOnApply() { - if (mySMESHGUI->isActiveStudyLocked()) + if ( mySMESHGUI->isActiveStudyLocked() ) return false; - if (myMesh->_is_nil()) { - SUIT_MessageBox::warn1(SMESHGUI::desktop(), tr("SMESH_WRN_WARNING"), - tr("MESH_IS_NOT_SELECTED"), tr("SMESH_BUT_OK")); + if ( myMesh->_is_nil() ) { + SUIT_MessageBox::warning( this, tr( "SMESH_WRN_WARNING" ), + tr( "MESH_IS_NOT_SELECTED" ) ); return false; } @@ -445,25 +402,25 @@ bool SMESHGUI_NodesDlg::ClickOnApply() double x = SpinBox_X->GetValue(); double y = SpinBox_Y->GetValue(); double z = SpinBox_Z->GetValue(); - mySimulation->SetVisibility(false); - SMESH::AddNode(myMesh,x,y,z); - SMESH::SetPointRepresentation(true); + mySimulation->SetVisibility( false ); + SMESH::AddNode( myMesh, x, y, z ); + SMESH::SetPointRepresentation( true ); // select myMesh SALOME_ListIO aList; - mySelectionMgr->selectedObjects(aList); - if (aList.Extent() != 1) { - if (SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView()) { + mySelectionMgr->selectedObjects( aList ); + if ( aList.Extent() != 1 ) { + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView() ) { vtkActorCollection *aCollection = aViewWindow->getRenderer()->GetActors(); aCollection->InitTraversal(); - while (vtkActor *anAct = aCollection->GetNextActor()) { - if (SMESH_Actor *anActor = dynamic_cast(anAct)) { - if (anActor->hasIO()) { - if (SMESH_MeshObj *aMeshObj = dynamic_cast(anActor->GetObject().get())) { - if (myMesh->_is_equivalent(aMeshObj->GetMeshServer())) { + while ( vtkActor *anAct = aCollection->GetNextActor() ) { + if ( SMESH_Actor *anActor = dynamic_cast( anAct ) ) { + if ( anActor->hasIO() ) { + if ( SMESH_MeshObj *aMeshObj = dynamic_cast( anActor->GetObject().get() ) ) { + if ( myMesh->_is_equivalent( aMeshObj->GetMeshServer() ) ) { aList.Clear(); - aList.Append(anActor->getIO()); - mySelectionMgr->setSelectedObjects(aList, false); + aList.Append( anActor->getIO() ); + mySelectionMgr->setSelectedObjects( aList, false ); break; } } @@ -481,12 +438,12 @@ bool SMESHGUI_NodesDlg::ClickOnApply() //================================================================================= void SMESHGUI_NodesDlg::ClickOnCancel() { - disconnect(mySelectionMgr, 0, this, 0); - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->SetSelectionMode(ActorSelection); + disconnect( mySelectionMgr, 0, this, 0 ); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) ) + aViewWindow->SetSelectionMode( ActorSelection ); - mySimulation->SetVisibility(false); - SMESH::SetPointRepresentation(false); + mySimulation->SetVisibility( false ); + SMESH::SetPointRepresentation( false ); mySMESHGUI->ResetState(); reject(); @@ -498,20 +455,22 @@ void SMESHGUI_NodesDlg::ClickOnCancel() //================================================================================= void SMESHGUI_NodesDlg::ClickOnHelp() { - LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); - if (app) - app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); + LightApp_Application* app = (LightApp_Application*)( SUIT_Session::session()->activeApplication() ); + if ( app ) + app->onHelpContextModule( mySMESHGUI ? app->moduleName( mySMESHGUI->moduleName() ) : + QString( "" ), myHelpFileName ); else { - QString platform; + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning( this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg( app->resourceMgr()->stringValue( "ExternalBrowser", + platform ) ). + arg( myHelpFileName ) ); } } @@ -521,33 +480,33 @@ void SMESHGUI_NodesDlg::ClickOnHelp() //================================================================================= void SMESHGUI_NodesDlg::SelectionIntoArgument() { - if (!GroupConstructors->isEnabled()) + if ( !GroupConstructors->isEnabled() ) return; - mySimulation->SetVisibility(false); - SMESH::SetPointRepresentation(true); + mySimulation->SetVisibility( false ); + SMESH::SetPointRepresentation( true ); const SALOME_ListIO& aList = mySelector->StoredIObjects(); - if (aList.Extent() == 1) { + if ( aList.Extent() == 1 ) { Handle(SALOME_InteractiveObject) anIO = aList.First(); - if (anIO->hasEntry()) { - myMesh = SMESH::GetMeshByIO(anIO); - if (myMesh->_is_nil()) return; + if ( anIO->hasEntry() ) { + myMesh = SMESH::GetMeshByIO( anIO ); + if ( myMesh->_is_nil() ) return; QString aText; - if (SMESH::GetNameOfSelectedNodes(mySelector,anIO,aText) == 1) { - if (SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh.in())) { - if (SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh()) { - if (const SMDS_MeshNode* aNode = aMesh->FindNode(aText.toInt())) { - SpinBox_X->SetValue(aNode->X()); - SpinBox_Y->SetValue(aNode->Y()); - SpinBox_Z->SetValue(aNode->Z()); + if ( SMESH::GetNameOfSelectedNodes( mySelector, anIO, aText ) == 1 ) { + if ( SMESH_Actor* anActor = SMESH::FindActorByObject( myMesh.in() ) ) { + if ( SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh() ) { + if ( const SMDS_MeshNode* aNode = aMesh->FindNode( aText.toInt() ) ) { + SpinBox_X->SetValue( aNode->X() ); + SpinBox_Y->SetValue( aNode->Y() ); + SpinBox_Z->SetValue( aNode->Z() ); } } } } - mySimulation->SetPosition(SpinBox_X->GetValue(), - SpinBox_Y->GetValue(), - SpinBox_Z->GetValue()); + mySimulation->SetPosition( SpinBox_X->GetValue(), + SpinBox_Y->GetValue(), + SpinBox_Z->GetValue() ); } } } @@ -556,7 +515,7 @@ void SMESHGUI_NodesDlg::SelectionIntoArgument() // function : closeEvent() // purpose : //================================================================================= -void SMESHGUI_NodesDlg::closeEvent (QCloseEvent*) +void SMESHGUI_NodesDlg::closeEvent( QCloseEvent* ) { this->ClickOnCancel(); /* same than click on cancel button */ } @@ -565,9 +524,9 @@ void SMESHGUI_NodesDlg::closeEvent (QCloseEvent*) // function : hideEvent() // purpose : caused by ESC key //================================================================================= -void SMESHGUI_NodesDlg::hideEvent (QHideEvent*) +void SMESHGUI_NodesDlg::hideEvent( QHideEvent* ) { - if (!isMinimized()) + if ( !isMinimized() ) ClickOnCancel(); } @@ -575,9 +534,9 @@ void SMESHGUI_NodesDlg::hideEvent (QHideEvent*) // function : enterEvent() // purpose : to reactivate this dialog box when mouse enter onto the window //================================================================================= -void SMESHGUI_NodesDlg::enterEvent(QEvent*) +void SMESHGUI_NodesDlg::enterEvent( QEvent* ) { - if (!GroupConstructors->isEnabled()) + if ( !GroupConstructors->isEnabled() ) ActivateThisDialog(); } @@ -587,13 +546,13 @@ void SMESHGUI_NodesDlg::enterEvent(QEvent*) //================================================================================= void SMESHGUI_NodesDlg::DeactivateActiveDialog() { - if (GroupConstructors->isEnabled()) { - GroupConstructors->setEnabled(false); - GroupCoordinates->setEnabled(false); - GroupButtons->setEnabled(false); - mySimulation->SetVisibility(false); + if ( GroupConstructors->isEnabled() ) { + GroupConstructors->setEnabled( false ); + GroupCoordinates->setEnabled( false ); + GroupButtons->setEnabled( false ); + mySimulation->SetVisibility( false ); mySMESHGUI->ResetState(); - mySMESHGUI->SetActiveDialogBox(0); + mySMESHGUI->SetActiveDialogBox( 0 ); } } @@ -604,13 +563,13 @@ void SMESHGUI_NodesDlg::DeactivateActiveDialog() void SMESHGUI_NodesDlg::ActivateThisDialog() { mySMESHGUI->EmitSignalDeactivateDialog(); - GroupConstructors->setEnabled(true); - GroupCoordinates->setEnabled(true); - GroupButtons->setEnabled(true); + GroupConstructors->setEnabled( true ); + GroupCoordinates->setEnabled( true ); + GroupButtons->setEnabled( true ); - SMESH::SetPointRepresentation(true); - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->SetSelectionMode(NodeSelection); + SMESH::SetPointRepresentation( true ); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) ) + aViewWindow->SetSelectionMode( NodeSelection ); SelectionIntoArgument(); } @@ -625,9 +584,8 @@ void SMESHGUI_NodesDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) - { - e->accept(); - ClickOnHelp(); - } + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + ClickOnHelp(); + } } diff --git a/src/SMESHGUI/SMESHGUI_NodesDlg.h b/src/SMESHGUI/SMESHGUI_NodesDlg.h index 13e62a793..908ad4198 100644 --- a/src/SMESHGUI/SMESHGUI_NodesDlg.h +++ b/src/SMESHGUI/SMESHGUI_NodesDlg.h @@ -1,129 +1,110 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_NodesDlg.h +// Author : Nicolas REJNERI, Open CASCADE S.A.S. // -// -// File : SMESHGUI_NodesDlg.h -// Author : Nicolas REJNERI -// Module : SMESH -// $Header$ -#ifndef DIALOGBOX_NODES_H -#define DIALOGBOX_NODES_H +#ifndef SMESHGUI_NODESDLG_H +#define SMESHGUI_NODESDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include -#include +// Qt includes +#include + +// IDL includes +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QFrame; class QGroupBox; class QLabel; -class QLineEdit; class QPushButton; class QRadioButton; class SMESHGUI; class SVTK_Selector; -class SVTK_ViewWindow; class SMESHGUI_SpinBox; class LightApp_SelectionMgr; -namespace SMESH{ +namespace SMESH +{ struct TNodeSimulation; } -// IDL Headers -#include -#include CORBA_SERVER_HEADER(SMESH_Mesh) - //================================================================================= // class : SMESHGUI_NodesDlg // purpose : //================================================================================= class SMESHGUI_EXPORT SMESHGUI_NodesDlg : public QDialog { - Q_OBJECT + Q_OBJECT public: - SMESHGUI_NodesDlg (SMESHGUI* theModule, - const char* name = 0, - bool modal = FALSE, - WFlags fl = 0); - - ~SMESHGUI_NodesDlg(); + SMESHGUI_NodesDlg( SMESHGUI* ); + ~SMESHGUI_NodesDlg(); private: - LightApp_SelectionMgr* mySelectionMgr; - SVTK_Selector* mySelector; - SMESHGUI* mySMESHGUI; - - SMESH::SMESH_Mesh_var myMesh; - SMESH::TNodeSimulation* mySimulation; - - void Init (); - void enterEvent(QEvent* e); - void closeEvent(QCloseEvent*); - void hideEvent (QHideEvent *); /* ESC key */ - void keyPressEvent(QKeyEvent*); - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupCoordinates; - SMESHGUI_SpinBox* SpinBox_X; - SMESHGUI_SpinBox* SpinBox_Y; - SMESHGUI_SpinBox* SpinBox_Z; - - QLabel* TextLabel_X; - QLabel* TextLabel_Y; - QLabel* TextLabel_Z; - - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonHelp; - - QString myHelpFileName; + LightApp_SelectionMgr* mySelectionMgr; + SVTK_Selector* mySelector; + SMESHGUI* mySMESHGUI; + + SMESH::SMESH_Mesh_var myMesh; + SMESH::TNodeSimulation* mySimulation; + + void Init(); + void enterEvent( QEvent* ); + void closeEvent( QCloseEvent* ); + void hideEvent ( QHideEvent* ); + void keyPressEvent( QKeyEvent* ); + + QGroupBox* GroupConstructors; + QRadioButton* Constructor1; + QGroupBox* GroupCoordinates; + SMESHGUI_SpinBox* SpinBox_X; + SMESHGUI_SpinBox* SpinBox_Y; + SMESHGUI_SpinBox* SpinBox_Z; + + QLabel* TextLabel_X; + QLabel* TextLabel_Y; + QLabel* TextLabel_Z; + + QGroupBox* GroupButtons; + QPushButton* buttonApply; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QPushButton* buttonHelp; + + QString myHelpFileName; private slots: - - void ClickOnOk(); - void ClickOnCancel(); - bool ClickOnApply(); - void ClickOnHelp(); - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void SelectionIntoArgument() ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: - QGridLayout* SMESHGUI_NodesDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupCoordinatesLayout; - QGridLayout* GroupButtonsLayout; + void ClickOnOk(); + void ClickOnCancel(); + bool ClickOnApply(); + void ClickOnHelp(); + void DeactivateActiveDialog(); + void ActivateThisDialog(); + void SelectionIntoArgument(); + void ValueChangedInSpinBox( double ); }; -#endif // DIALOGBOX_NODES_H +#endif // SMESHGUI_NODESDLG_H diff --git a/src/SMESHGUI/SMESHGUI_Operation.cxx b/src/SMESHGUI/SMESHGUI_Operation.cxx index 95c3c5ce1..4a3ea441a 100755 --- a/src/SMESHGUI/SMESHGUI_Operation.cxx +++ b/src/SMESHGUI/SMESHGUI_Operation.cxx @@ -1,39 +1,44 @@ -// SMESH SMDS : implementaion of Salome mesh data structure +// SMESH SMDS : implementaion of Salome mesh data structure // -// Copyright (C) 2003 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_Operation.cxx +// Author : Sergey LITONIN, Open CASCADE S.A.S. // -// File : SMESHGUI_Operation.h -// Author : Sergey LITONIN -// Module : SALOME +// SMESH includes #include "SMESHGUI_Operation.h" -#include -#include +#include "SMESHGUI.h" +#include "SMESHGUI_Dialog.h" + +// SALOME GUI includes #include #include #include #include #include +#include -#include +// Qt includes +#include /* Class : SMESHGUI_Operation @@ -113,8 +118,8 @@ bool SMESHGUI_Operation::isReadyToStart() const return false; else if ( getSMESHGUI() == 0 ) { - SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ), - tr( "NO_MODULE" ), tr( "SMESH_BUT_OK" ) ); + SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ), + tr( "NO_MODULE" ) ); return false; } else if ( isStudyLocked() ) @@ -187,16 +192,17 @@ void SMESHGUI_Operation::onHelp() if (app) app->onHelpContextModule(getSMESHGUI() ? app->moduleName(getSMESHGUI()->moduleName()) : QString(""), myHelpFileName); else { - QString platform; + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning( desktop(), tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName) ); } } @@ -223,8 +229,8 @@ bool SMESHGUI_Operation::isStudyLocked( const bool theMess ) const if ( studyDS()->GetProperties()->IsLocked() ) { if ( theMess ) - SUIT_MessageBox::warn1 ( SMESHGUI::desktop(), QObject::tr( "WRN_WARNING" ), - QObject::tr( "WRN_STUDY_LOCKED" ), QObject::tr( "BUT_OK" ) ); + SUIT_MessageBox::warning( SMESHGUI::desktop(), tr( "WRN_WARNING" ), + tr( "WRN_STUDY_LOCKED" ) ); return true; } } @@ -252,19 +258,8 @@ bool SMESHGUI_Operation::isValid( SUIT_Operation* theOtherOp ) const } return theOtherOp && theOtherOp->inherits( "SMESHGUI_Operation" ) && - ( !anOps.contains( theOtherOp->className() ) || anOps.contains( className() ) ); + ( !anOps.contains( theOtherOp->metaObject()->className() ) || + anOps.contains( metaObject()->className() ) ); return true; } - - - - - - - - - - - - diff --git a/src/SMESHGUI/SMESHGUI_Operation.h b/src/SMESHGUI/SMESHGUI_Operation.h index 4b3aeaf96..a2dca72d7 100755 --- a/src/SMESHGUI/SMESHGUI_Operation.h +++ b/src/SMESHGUI/SMESHGUI_Operation.h @@ -1,34 +1,37 @@ -// SMESH SMDS : implementaion of Salome mesh data structure +// SMESH SMDS : implementaion of Salome mesh data structure // -// Copyright (C) 2003 OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_Operation.h +// Author : Sergey LITONIN, Open CASCADE S.A.S. // -// File : SMESHGUI_Operation.h -// Author : Sergey LITONIN -// Module : SALOME - -#ifndef SMESHGUI_Operation_H -#define SMESHGUI_Operation_H +#ifndef SMESHGUI_OPERATION_H +#define SMESHGUI_OPERATION_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" +// SALOME GUI includes #include + +// SALOME KERNEL includes #include class SMESHGUI; @@ -66,16 +69,10 @@ protected: QString myHelpFileName; protected slots: - virtual void onOk(); - virtual bool onApply(); - virtual void onCancel(); - void onHelp(); + virtual void onOk(); + virtual bool onApply(); + virtual void onCancel(); + void onHelp(); }; -#endif - - - - - - +#endif // SMESHGUI_OPERATION_H diff --git a/src/SMESHGUI/SMESHGUI_PatternUtils.cxx b/src/SMESHGUI/SMESHGUI_PatternUtils.cxx index 9a63ae39a..9e6d34583 100644 --- a/src/SMESHGUI/SMESHGUI_PatternUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_PatternUtils.cxx @@ -1,31 +1,37 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// +// SMESH SMESHGUI : GUI for SMESH component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_PatternUtils.cxx +// Author : Open CASCADE S.A.S. +// - +// SMESH includes #include "SMESHGUI_PatternUtils.h" #include "SMESHGUI.h" -namespace SMESH { - +namespace SMESH +{ SMESH::SMESH_Pattern_var GetPattern() { return SMESHGUI::GetSMESHGen()->GetPattern(); } -} +} // end of namespace SMESH diff --git a/src/SMESHGUI/SMESHGUI_PatternUtils.h b/src/SMESHGUI/SMESHGUI_PatternUtils.h index b466a4b47..0c47dd5eb 100644 --- a/src/SMESHGUI/SMESHGUI_PatternUtils.h +++ b/src/SMESHGUI/SMESHGUI_PatternUtils.h @@ -1,37 +1,42 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// +// SMESH SMESHGUI : GUI for SMESH component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_PatternUtils.h +// Author : Open CASCADE S.A.S. +// -#ifndef SMESHGUI_PatternUtils_HeaderFile -#define SMESHGUI_PatternUtils_HeaderFile +#ifndef SMESHGUI_PATTERNUTILS_H +#define SMESHGUI_PATTERNUTILS_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include "SALOMEconfig.h" +// IDL includes +#include #include CORBA_SERVER_HEADER(SMESH_Pattern) - -namespace SMESH{ - -SMESHGUI_EXPORT - SMESH::SMESH_Pattern_var GetPattern(); - +namespace SMESH +{ + SMESHGUI_EXPORT + SMESH::SMESH_Pattern_var GetPattern(); } - -#endif +#endif // SMESHGUI_PATTERNUTILS_H diff --git a/src/SMESHGUI/SMESHGUI_PatternWidget.cxx b/src/SMESHGUI/SMESHGUI_PatternWidget.cxx index 8deafd0eb..4a576b7d8 100644 --- a/src/SMESHGUI/SMESHGUI_PatternWidget.cxx +++ b/src/SMESHGUI/SMESHGUI_PatternWidget.cxx @@ -1,48 +1,47 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_PatternWidget.cxx +// Author : Michael ZORIN, Open CASCADE S.A.S. // -// -// File : SMESHGUI_PatternWidget.cxx -// Author : Michael ZORIN -// Module : SMESH -// $Header: +// SMESH includes #include "SMESHGUI_PatternWidget.h" -//Qt includes -#include -#include +// Qt includes +#include +const int Shift = 4; // shift of the point number from point +const int Border = 20; // border size +const int Radius = 3; // radius of a point //================================================================================= // class : SMESHGUI_PatternWidget() // purpose : //================================================================================= -SMESHGUI_PatternWidget::SMESHGUI_PatternWidget (QWidget* parent, const char* name, WFlags fl) - : QFrame(parent, name, WStyle_Customize) +SMESHGUI_PatternWidget::SMESHGUI_PatternWidget( QWidget* parent ) + : QFrame( parent ) { - myMinU = myMinV = myMaxU = myMaxV = 0; - setMinimumHeight(150); - repaint(); + myMinU = myMinV = myMaxU = myMaxV = 0; + setMinimumHeight( 150 ); } //================================================================================= @@ -57,109 +56,96 @@ SMESHGUI_PatternWidget::~SMESHGUI_PatternWidget() // function : SetPoints() // purpose : //================================================================================= -void SMESHGUI_PatternWidget::SetPoints (PointVector thePoints, - QValueVector theKeys, - ConnectivityVector theConnections) +void SMESHGUI_PatternWidget::SetPoints( const PointVector& thePoints, + const QVector& theKeys, + const ConnectivityVector& theConnections ) { - myPoints = thePoints; - myKeys = theKeys; - myConnections = theConnections; + myPoints = thePoints; + myKeys = theKeys; + myConnections = theConnections; - if (!thePoints.size()) + if ( myPoints.isEmpty() ) return; - myMinU = myMaxU = (thePoints[0]).x; - myMinV = myMaxV = (thePoints[0]).y; - double x, y; - - for (int i = 1; i < thePoints.size(); i++) { - x = (thePoints[i]).x; - y = (thePoints[i]).y; - - if (myMinU > x) - myMinU = x; - if (myMaxU < x) - myMaxU = x; - if (myMinV > y) - myMinV = y; - if (myMaxV < y) - myMaxV = y; + myMinU = myMaxU = myPoints[0].x; + myMinV = myMaxV = myPoints[0].y; + + for ( int i = 1; i < myPoints.size(); i++ ) { + myMinU = qMin( myPoints[i].x, myMinU ); + myMaxU = qMax( myPoints[i].x, myMaxU ); + myMinV = qMin( myPoints[i].y, myMinV ); + myMaxV = qMax( myPoints[i].y, myMaxV ); } repaint(); } -static const int Shift = 4; // shift of the point number from point -static const int Border = 20; - //================================================================================= // function : paintEvent() // purpose : //================================================================================= -void SMESHGUI_PatternWidget::paintEvent (QPaintEvent*) +void SMESHGUI_PatternWidget::paintEvent( QPaintEvent* ) { - QPainter paint (this); - paint.setBrush(Qt::SolidPattern); - - //Draw points - const int aRadius = 3; // radius of a point + QPainter painter( this ); + painter.setBrush( Qt::SolidPattern ); - for (int i = 0; i < myKeys.size() && i < myPoints.size(); i++) { + // Draw points + for ( int i = 0; i < myKeys.size() && i < myPoints.size(); i++ ) { SMESH::PointStruct aPoint = myPoints[ myKeys[i] ]; - QPoint aQPnt = MapCoords(aPoint.x, aPoint.y); + QPoint aQPnt = mapCoords( aPoint.x, aPoint.y ); - paint.drawPie(aQPnt.x() - aRadius, aQPnt.y() - aRadius, aRadius*2, aRadius*2, 5760, 5760); - paint.drawText(aQPnt.x() + Shift, aQPnt.y() - Shift, QString::number(i+1)); + painter.drawPie( aQPnt.x() - Radius, aQPnt.y() - Radius, + Radius * 2, Radius * 2, 0, 360 * 16 ); + painter.drawText( aQPnt.x() + Shift, aQPnt.y() - Shift, + QString::number( i+1 ) ); } - //Draw lines - for (int i = 0; i < myConnections.size(); i++) { - QValueVector aCVector = myConnections[i]; + // Draw lines + for ( int i = 0; i < myConnections.size(); i++ ) { + QVector aCVector = myConnections[i]; - if (aCVector.size() == 0) + if ( aCVector.isEmpty() ) continue; SMESH::PointStruct aPoint = myPoints[ aCVector[0] ]; - const QPoint aBeginPnt = MapCoords(aPoint.x, aPoint.y); + const QPoint aBeginPnt = mapCoords( aPoint.x, aPoint.y ); QPoint aFirstPnt = aBeginPnt, aSecondPnt; - for (int j = 1; j < aCVector.size(); j++) { + for ( int j = 1; j < aCVector.size(); j++ ) { aPoint = myPoints[ aCVector[j] ]; - aSecondPnt = MapCoords(aPoint.x, aPoint.y); - paint.drawLine(aFirstPnt, aSecondPnt); + aSecondPnt = mapCoords( aPoint.x, aPoint.y ); + painter.drawLine( aFirstPnt, aSecondPnt ); aFirstPnt = aSecondPnt; } - paint.drawLine(aBeginPnt, aSecondPnt); + painter.drawLine( aBeginPnt, aSecondPnt ); } } //================================================================================= -// function : MapCoords() +// function : mapCoords() // purpose : //================================================================================= -QPoint SMESHGUI_PatternWidget::MapCoords (const double u, const double v) +QPoint SMESHGUI_PatternWidget::mapCoords( const double u, const double v ) { - int aWidth = width() - 2*Border; - int aHeight = height() - 2*Border; + int aWidth = width() - 2 * Border; + int aHeight = height() - 2 * Border; double aUBound = myMaxU - myMinU; double aVBound = myMaxV - myMinV; - double aUScale = aWidth/aUBound; - double aVScale = aHeight/aVBound; + double aUScale = aWidth / aUBound; + double aVScale = aHeight / aVBound; double aScale; aUScale <= aVScale ? aScale = aUScale : aScale = aVScale; - double aUMiddle = (myMaxU + myMinU)/2; - double aVMiddle = (myMaxV + myMinV)/2; - - int x = int(aWidth/2 + (u - aUMiddle)*aScale + Border - Shift); + double aUMiddle = ( myMaxU + myMinU ) / 2; + double aVMiddle = ( myMaxV + myMinV ) / 2; - int y = int(aHeight/2 + (aVMiddle - v)*aScale + Border + Shift); + int x = int( aWidth / 2 + ( u - aUMiddle ) * aScale + Border - Shift ); - QPoint aPoint = QPoint(x, y); + int y = int( aHeight / 2 + ( aVMiddle - v ) * aScale + Border + Shift ); - return aPoint; + return QPoint( x, y ); } diff --git a/src/SMESHGUI/SMESHGUI_PatternWidget.h b/src/SMESHGUI/SMESHGUI_PatternWidget.h index 69e66917b..8ce562883 100644 --- a/src/SMESHGUI/SMESHGUI_PatternWidget.h +++ b/src/SMESHGUI/SMESHGUI_PatternWidget.h @@ -1,47 +1,44 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_PatternWidget.h +// Author : Michael ZORIN, Open CASCADE S.A.S. // -// File : SMESHGUI_PatternWidget.h -// Author : Michael ZORIN -// Module : SMESH -// $Header: -#ifndef WIDGET_PATTERN_H -#define WIDGET_PATTERN_H +#ifndef SMESHGUI_PATTERNWIDGET_H +#define SMESHGUI_PATTERNWIDGET_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include -#include +// Qt includes +#include +#include -// IDL Headers +// IDL includes #include #include CORBA_SERVER_HEADER(SMESH_Mesh) -typedef QValueVector PointVector; -typedef QValueVector< QValueVector > ConnectivityVector; - -class QPoint; +typedef QVector PointVector; +typedef QVector< QVector > ConnectivityVector; //================================================================================= // class : SMESHGUI_PatternWidget @@ -49,28 +46,28 @@ class QPoint; //================================================================================= class SMESHGUI_EXPORT SMESHGUI_PatternWidget : public QFrame { - Q_OBJECT + Q_OBJECT public: - SMESHGUI_PatternWidget( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); - - ~SMESHGUI_PatternWidget(); - - void SetPoints( PointVector thePoints, QValueVector theKeys, ConnectivityVector theConnections ); - -private : - PointVector myPoints; - QValueVector myKeys; - ConnectivityVector myConnections; - - double myMinU, myMaxU, myMinV, myMaxV; - -private slots: + SMESHGUI_PatternWidget( QWidget* = 0 ); + ~SMESHGUI_PatternWidget(); + + void SetPoints( const PointVector&, + const QVector&, + const ConnectivityVector& ); +private: + PointVector myPoints; + QVector myKeys; + ConnectivityVector myConnections; + + double myMinU, myMaxU, myMinV, myMaxV; + protected: - void paintEvent( QPaintEvent * ); - QPoint MapCoords( const double u, const double v ); -}; + void paintEvent( QPaintEvent* ); -#endif // WIDGET_PATTERN_H +private: + QPoint mapCoords( const double, const double ); +}; +#endif // SMESHGUI_PATTERNWIDGET_H diff --git a/src/SMESHGUI/SMESHGUI_PrecisionDlg.h b/src/SMESHGUI/SMESHGUI_PrecisionDlg.h deleted file mode 100755 index e033ec438..000000000 --- a/src/SMESHGUI/SMESHGUI_PrecisionDlg.h +++ /dev/null @@ -1,99 +0,0 @@ -// SMESH SMESHGUI : GUI for SMESH component -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SMESHGUI_PrecisionDlg.h -// Author : Sergey LITONIN -// Module : SMESH - - -#ifndef SMESHGUI_PrecisionDlg_H -#define SMESHGUI_PrecisionDlg_H - -#include "SMESH_SMESHGUI.hxx" - -#include - -class QSpinBox; -class QPushButton; -class QCheckBox; -class QFrame; -class SMESHGUI; - -/* - Class : SMESHGUI_PrecisionDlg - Description : Dialog to specify precision of mesh quality controls -*/ - -class SMESHGUI_EXPORT SMESHGUI_PrecisionDlg : public QDialog -{ - Q_OBJECT - -public: - SMESHGUI_PrecisionDlg( SMESHGUI* ); - - virtual ~SMESHGUI_PrecisionDlg(); - - void Init(); - -private slots: - - void onOk(); - void onClose(); - void onNotUse(); - -private: - - QFrame* createButtonFrame( QWidget* ); - QFrame* createMainFrame( QWidget* ); - void closeEvent( QCloseEvent* ); - -private: - SMESHGUI* mySMESHGUI; - QSpinBox* mySpinBox; - QPushButton* myOKBtn; - QPushButton* myCancelBtn; - QCheckBox* myNotUseChk; - -}; - -#endif - - - - - - - - - - - - - - - - - - - - diff --git a/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.cxx b/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.cxx index 5028ed064..63a5fc1dd 100644 --- a/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.cxx @@ -1,264 +1,174 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_Preferences_ColorDlg.cxx +// Author : Nicolas REJNERI, Open CASCADE S.A.S. // -// -// File : SMESHGUI_Preferences_ColorDlg.cxx -// Author : Nicolas REJNERI -// Module : SMESH -// $Header$ +// SMESH includes #include "SMESHGUI_Preferences_ColorDlg.h" + #include "SMESHGUI.h" #include "SMESHGUI_Utils.h" -#include "utilities.h" - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +// SALOME GUI includes +#include +#include -#include "SUIT_Desktop.h" +// Qt includes +#include +#include +#include +#include +#include +#include +#include -using namespace std; +#define SPACING 6 +#define MARGIN 11 //================================================================================= // function : SMESHGUI_Preferences_ColorDlg() // purpose : Constructs a SMESHGUI_Preferences_ColorDlg which is a child // of 'parent', with the name 'name' and widget flags set to 'f' // The dialog will by default be modeless, unless you -// set'modal' to TRUE to construct a modal dialog. +// set'modal' to true to construct a modal dialog. //================================================================================= -SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg( SMESHGUI* theModule, const char* name) - : QDialog( SMESH::GetDesktop( theModule ), name, true, WStyle_Customize | - WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ), +SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg( SMESHGUI* theModule ) + : QDialog( SMESH::GetDesktop( theModule ) ), mySMESHGUI( theModule ) { - if (!name) - setName("SMESHGUI_Preferences_ColorDlg"); - setCaption(tr("Preferences - Set Color")); - setSizeGripEnabled(TRUE); - QGridLayout* SMESHGUI_Preferences_ColorDlgLayout = new QGridLayout(this); - SMESHGUI_Preferences_ColorDlgLayout->setSpacing(6); - SMESHGUI_Preferences_ColorDlgLayout->setMargin(11); - - ButtonGroup1 = new QButtonGroup(tr("Elements"), this, "ButtonGroup1"); - ButtonGroup1->setColumnLayout(0, Qt::Vertical); - ButtonGroup1->layout()->setSpacing(0); - ButtonGroup1->layout()->setMargin(0); - QGridLayout* ButtonGroup1Layout = new QGridLayout(ButtonGroup1->layout()); - ButtonGroup1Layout->setAlignment(Qt::AlignTop); - ButtonGroup1Layout->setSpacing(6); - ButtonGroup1Layout->setMargin(11); - - TextLabel_Fill = new QLabel(tr("Fill"), ButtonGroup1, "TextLabel_2D_Fill"); - ButtonGroup1Layout->addWidget(TextLabel_Fill, 0, 0); - - btnFillColor = new QPushButton(ButtonGroup1, "btnFillColor"); - btnFillColor->setFixedSize(QSize(25, 25)); - ButtonGroup1Layout->addWidget(btnFillColor, 0, 1); - - TextLabel_Outine = new QLabel(tr("Outline"), ButtonGroup1, "TextLabel_2D_Outine"); - ButtonGroup1Layout->addWidget(TextLabel_Outine, 0, 2); - - btnOutlineColor = new QPushButton(ButtonGroup1, "btnOutlineColor"); - btnOutlineColor->setFixedSize(QSize(25, 25)); - ButtonGroup1Layout->addWidget(btnOutlineColor, 0, 3); - - TextLabel_Width = new QLabel(tr("Width"), ButtonGroup1, "TextLabel_2D_Width"); - ButtonGroup1Layout->addWidget(TextLabel_Width, 0, 4); - - SpinBox_Width = new QSpinBox(0, 5, 1, ButtonGroup1, "SpinBox_Width"); - SpinBox_Width->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); - SpinBox_Width->setWrapping(FALSE); - SpinBox_Width->setButtonSymbols(QSpinBox::PlusMinus); - ButtonGroup1Layout->addWidget(SpinBox_Width, 0, 5); - - TextLabel_BackFace = new QLabel(tr("Back Face"), ButtonGroup1, "TextLabel_BackFace"); - ButtonGroup1Layout->addWidget(TextLabel_BackFace, 1, 0); - - btnBackFaceColor = new QPushButton(ButtonGroup1, "btnBackFaceColor"); - btnBackFaceColor->setFixedSize(QSize(25, 25)); - ButtonGroup1Layout->addWidget(btnBackFaceColor, 1, 1); - - TextLabel_ShrinkCoeff = new QLabel(tr("Shrink coef."), ButtonGroup1, "TextLabel_ShrinkCoeff"); - ButtonGroup1Layout->addWidget(TextLabel_ShrinkCoeff, 2, 0); - - SpinBox_Shrink = new QSpinBox(20, 100, 1, ButtonGroup1, "SpinBox_Shrink"); - SpinBox_Shrink->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); - SpinBox_Shrink->setButtonSymbols(QSpinBox::PlusMinus); - ButtonGroup1Layout->addMultiCellWidget(SpinBox_Shrink, 2, 2, 1, 5); - - SMESHGUI_Preferences_ColorDlgLayout->addWidget(ButtonGroup1, 0, 0); - - ButtonGroup2 = new QButtonGroup(tr("Nodes"), this, "ButtonGroup2"); - ButtonGroup2->setColumnLayout(0, Qt::Vertical); - ButtonGroup2->layout()->setSpacing(0); - ButtonGroup2->layout()->setMargin(0); - QGridLayout* ButtonGroup2Layout = new QGridLayout(ButtonGroup2->layout()); - ButtonGroup2Layout->setAlignment(Qt::AlignTop); - ButtonGroup2Layout->setSpacing(6); - ButtonGroup2Layout->setMargin(11); - - TextLabel_Nodes_Color = new QLabel(tr("Color"), ButtonGroup2, "TextLabel_Nodes_Color"); - ButtonGroup2Layout->addWidget(TextLabel_Nodes_Color, 0, 0); - - btnNodeColor = new QPushButton(ButtonGroup2, "btnNodeColor"); - btnNodeColor->setFixedSize(QSize(25, 25)); - ButtonGroup2Layout->addWidget(btnNodeColor, 0, 1); - - TextLabel_Nodes_Size = new QLabel(tr("Size"), ButtonGroup2, "TextLabel_Nodes_Size"); - ButtonGroup2Layout->addWidget(TextLabel_Nodes_Size, 0, 2); - - SpinBox_Nodes_Size = new QSpinBox(0, 5, 1, ButtonGroup2, "SpinBox_Nodes_Size"); - SpinBox_Nodes_Size->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); - SpinBox_Nodes_Size->setWrapping(FALSE); - SpinBox_Nodes_Size->setButtonSymbols(QSpinBox::PlusMinus); - ButtonGroup2Layout->addWidget(SpinBox_Nodes_Size, 0, 3); - - SMESHGUI_Preferences_ColorDlgLayout->addWidget(ButtonGroup2, 1, 0); - - GroupButtons = new QButtonGroup(this, "GroupButtons"); - GroupButtons->setColumnLayout(0, Qt::Vertical); - GroupButtons->layout()->setSpacing(0); - GroupButtons->layout()->setMargin(0); - QGridLayout* GroupButtonsLayout = new QGridLayout(GroupButtons->layout()); - GroupButtonsLayout->setAlignment(Qt::AlignTop); - GroupButtonsLayout->setSpacing(6); - GroupButtonsLayout->setMargin(11); - - buttonOk = new QPushButton(tr("&OK"), GroupButtons, "buttonOk"); - buttonOk->setAutoDefault(TRUE); - buttonOk->setDefault(TRUE); - GroupButtonsLayout->addWidget(buttonOk, 0, 0); - - GroupButtonsLayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1); - - buttonCancel = new QPushButton(tr("&Cancel"), GroupButtons, "buttonCancel"); - buttonCancel->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonCancel, 0, 2); - - SMESHGUI_Preferences_ColorDlgLayout->addWidget(GroupButtons, 2, 0); - - Init(); -} - -//================================================================================= -// function : ~SMESHGUI_Preferences_ColorDlg() -// purpose : Destructor -//================================================================================= -SMESHGUI_Preferences_ColorDlg::~SMESHGUI_Preferences_ColorDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void SMESHGUI_Preferences_ColorDlg::Init() -{ - mySMESHGUI->SetActiveDialogBox((QDialog*)this); + setModal( true ); + setWindowTitle( tr( "Preferences - Set Color" ) ); + setSizeGripEnabled( true ); + + // ------------------------------- + QVBoxLayout* topLayout = new QVBoxLayout( this ); + topLayout->setSpacing( SPACING ); + topLayout->setMargin( MARGIN ); + + // ------------------------------- + QGroupBox* ButtonGroup1 = new QGroupBox( tr( "Elements" ), this ); + QGridLayout* ButtonGroup1Layout = new QGridLayout( ButtonGroup1 ); + ButtonGroup1Layout->setSpacing( SPACING ); + ButtonGroup1Layout->setMargin( MARGIN ); + + QLabel* TextLabel_Fill = new QLabel( tr( "Fill" ), ButtonGroup1 ); + btnFillColor = new QtxColorButton( ButtonGroup1 ); + + QLabel* TextLabel_BackFace = new QLabel( tr( "Back Face" ), ButtonGroup1 ); + btnBackFaceColor = new QtxColorButton( ButtonGroup1 ); + + QLabel* TextLabel_Outine = new QLabel( tr( "Outline" ), ButtonGroup1 ); + btnOutlineColor = new QtxColorButton( ButtonGroup1 ); + + QLabel* TextLabel_Width = new QLabel( tr( "Width" ), ButtonGroup1 ); + SpinBox_Width = new QSpinBox( ButtonGroup1 ); + SpinBox_Width->setRange( 0, 5 ); + SpinBox_Width->setSingleStep( 1 ); + SpinBox_Width->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + SpinBox_Width->setButtonSymbols( QSpinBox::PlusMinus ); + + QLabel* TextLabel_ShrinkCoeff = new QLabel( tr( "Shrink coef." ), ButtonGroup1 ); + SpinBox_Shrink = new QSpinBox( ButtonGroup1 ); + SpinBox_Shrink->setRange( 20, 100 ); + SpinBox_Shrink->setSingleStep( 1 ); + SpinBox_Shrink->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + SpinBox_Shrink->setButtonSymbols( QSpinBox::PlusMinus ); + + ButtonGroup1Layout->addWidget( TextLabel_Fill, 0, 0 ); + ButtonGroup1Layout->addWidget( btnFillColor, 0, 1 ); + ButtonGroup1Layout->addWidget( TextLabel_BackFace, 1, 0 ); + ButtonGroup1Layout->addWidget( btnBackFaceColor, 1, 1 ); + ButtonGroup1Layout->addWidget( TextLabel_Outine, 2, 0 ); + ButtonGroup1Layout->addWidget( btnOutlineColor, 2, 1 ); + ButtonGroup1Layout->addWidget( TextLabel_Width, 0, 2 ); + ButtonGroup1Layout->addWidget( SpinBox_Width, 0, 3 ); + ButtonGroup1Layout->addWidget( TextLabel_ShrinkCoeff, 1, 2 ); + ButtonGroup1Layout->addWidget( SpinBox_Shrink, 1, 3 ); + + // ------------------------------- + QGroupBox* ButtonGroup2 = new QGroupBox( tr( "Nodes" ), this ); + QHBoxLayout* ButtonGroup2Layout = new QHBoxLayout( ButtonGroup2 ); + ButtonGroup2Layout->setSpacing( SPACING ); + ButtonGroup2Layout->setMargin( MARGIN ); + + QLabel* TextLabel_Nodes_Color = new QLabel( tr( "Color" ), ButtonGroup2 ); + btnNodeColor = new QtxColorButton( ButtonGroup2 ); + + QLabel* TextLabel_Nodes_Size = new QLabel( tr( "Size" ), ButtonGroup2 ); + SpinBox_Nodes_Size = new QSpinBox( ButtonGroup2 ); + SpinBox_Nodes_Size->setRange( 0, 5 ); + SpinBox_Nodes_Size->setSingleStep( 1 ); + SpinBox_Nodes_Size->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + SpinBox_Nodes_Size->setButtonSymbols( QSpinBox::PlusMinus ); + + ButtonGroup2Layout->addWidget( TextLabel_Nodes_Color ); + ButtonGroup2Layout->addWidget( btnNodeColor ); + ButtonGroup2Layout->addWidget( TextLabel_Nodes_Size ); + ButtonGroup2Layout->addWidget( SpinBox_Nodes_Size ); + + // ------------------------------- + QGroupBox* GroupButtons = new QGroupBox( this ); + QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons ); + GroupButtonsLayout->setSpacing( SPACING ); + GroupButtonsLayout->setMargin( MARGIN ); + + QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons ); + buttonOk->setAutoDefault( true ); + buttonOk->setDefault( true ); + + QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ), GroupButtons ); + buttonCancel->setAutoDefault( true ); + + GroupButtonsLayout->addWidget( buttonOk ); + GroupButtonsLayout->addSpacing( 10 ); + GroupButtonsLayout->addStretch(); + GroupButtonsLayout->addWidget( buttonCancel ); + + // ------------------------------- + topLayout->addWidget( ButtonGroup1 ); + topLayout->addWidget( ButtonGroup2 ); + topLayout->addWidget( GroupButtons ); + + // ------------------------------- + mySMESHGUI->SetActiveDialogBox( this ); /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ); - connect(btnFillColor, SIGNAL(clicked()), this, SLOT(SelectFillColor())); - connect(btnOutlineColor, SIGNAL(clicked()), this, SLOT(SelectOutlineColor())); - connect(btnNodeColor, SIGNAL(clicked()), this, SLOT(SelectNodeColor())); - connect(btnBackFaceColor, SIGNAL(clicked()), this, SLOT(SelectBackFaceColor())); - - connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), + this, SLOT( DeactivateActiveDialog() ) ); /* to close dialog if study change */ - connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); -} - -//================================================================================= -// function : SelectFillColor() -// purpose : -//================================================================================= -void SMESHGUI_Preferences_ColorDlg::SelectFillColor() -{ - QColor color = btnFillColor->palette().active().button(); - color = QColorDialog::getColor(color); - if (color.isValid()) { - QPalette pal = btnFillColor->palette(); - pal.setColor(QColorGroup::Button, color); - btnFillColor->setPalette(pal); - } -} - -//================================================================================= -// function : SelectBackFaceColor() -// purpose : -//================================================================================= -void SMESHGUI_Preferences_ColorDlg::SelectBackFaceColor() -{ - QColor color = btnBackFaceColor->palette().active().button(); - color = QColorDialog::getColor(color); - if (color.isValid()) { - QPalette pal = btnBackFaceColor->palette(); - pal.setColor(QColorGroup::Button, color); - btnBackFaceColor->setPalette(pal); - } -} - -//================================================================================= -// function : SelectOutlineColor() -// purpose : -//================================================================================= -void SMESHGUI_Preferences_ColorDlg::SelectOutlineColor() -{ - QColor color = btnOutlineColor->palette().active().button(); - color = QColorDialog::getColor(color); - if (color.isValid()) { - QPalette pal = btnOutlineColor->palette(); - pal.setColor(QColorGroup::Button, color); - btnOutlineColor->setPalette(pal); - } + connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), + this, SLOT( ClickOnCancel() ) ); } //================================================================================= -// function : SelectNodeColor() -// purpose : +// function : ~SMESHGUI_Preferences_ColorDlg() +// purpose : Destructor //================================================================================= -void SMESHGUI_Preferences_ColorDlg::SelectNodeColor() +SMESHGUI_Preferences_ColorDlg::~SMESHGUI_Preferences_ColorDlg() { - QColor color = btnNodeColor->palette().active().button(); - color = QColorDialog::getColor(color); - if (color.isValid()) { - QPalette pal = btnNodeColor->palette(); - pal.setColor(QColorGroup::Button, color); - btnNodeColor->setPalette(pal); - } } //================================================================================= @@ -293,9 +203,9 @@ void SMESHGUI_Preferences_ColorDlg::DeactivateActiveDialog() // function : closeEvent() // purpose : //================================================================================= -void SMESHGUI_Preferences_ColorDlg::closeEvent (QCloseEvent*) +void SMESHGUI_Preferences_ColorDlg::closeEvent( QCloseEvent* ) { - this->ClickOnCancel(); /* same than click on cancel button */ + ClickOnCancel(); /* same than click on cancel button */ } //================================================================================= @@ -312,37 +222,14 @@ void SMESHGUI_Preferences_ColorDlg::ActivateThisDialog() // function : SetColor() // purpose : //================================================================================= -void SMESHGUI_Preferences_ColorDlg::SetColor (int type, QColor color) +void SMESHGUI_Preferences_ColorDlg::SetColor( int type, const QColor& color ) { - switch (type) { - case 1 : // fill - { - QPalette pal = btnFillColor->palette(); - pal.setColor(QColorGroup::Button, color); - btnFillColor->setPalette(pal); - break; - } - case 2 : // outline - { - QPalette pal = btnOutlineColor->palette(); - pal.setColor(QColorGroup::Button, color); - btnOutlineColor->setPalette(pal); - break; - } - case 3 : // node - { - QPalette pal = btnNodeColor->palette(); - pal.setColor(QColorGroup::Button, color); - btnNodeColor->setPalette(pal); - break; - } - case 4 : // back face - { - QPalette pal = btnBackFaceColor->palette(); - pal.setColor(QColorGroup::Button, color); - btnBackFaceColor->setPalette(pal); - break; - } + switch ( type ) { + case 1 : btnFillColor->setColor( color ); break; // fill + case 2 : btnOutlineColor->setColor( color ); break; // outline + case 3 : btnNodeColor->setColor( color ); break; // node + case 4 : btnBackFaceColor->setColor( color ); break; // back face + default: break; } } @@ -350,14 +237,15 @@ void SMESHGUI_Preferences_ColorDlg::SetColor (int type, QColor color) // function : GetColor() // purpose : //================================================================================= -QColor SMESHGUI_Preferences_ColorDlg::GetColor (int type) +QColor SMESHGUI_Preferences_ColorDlg::GetColor( int type ) { QColor color; - switch (type) { - case 1 : color = btnFillColor->palette().active().button(); break; // fill - case 2 : color = btnOutlineColor->palette().active().button(); break; // outline - case 3 : color = btnNodeColor->palette().active().button(); break; // node - case 4 : color = btnBackFaceColor->palette().active().button(); break; // back face + switch ( type ) { + case 1 : color = btnFillColor->color(); break; // fill + case 2 : color = btnOutlineColor->color(); break; // outline + case 3 : color = btnNodeColor->color(); break; // node + case 4 : color = btnBackFaceColor->color(); break; // back face + default: break; } return color; } @@ -366,12 +254,13 @@ QColor SMESHGUI_Preferences_ColorDlg::GetColor (int type) // function : SetIntValue() // purpose : //================================================================================= -void SMESHGUI_Preferences_ColorDlg::SetIntValue (int type, int value) +void SMESHGUI_Preferences_ColorDlg::SetIntValue( int type, int value ) { - switch (type) { - case 1 : SpinBox_Width->setValue(value); break; // width - case 2 : SpinBox_Nodes_Size->setValue(value); break; // nodes size = value; break; - case 3 : SpinBox_Shrink->setValue(value); break; // shrink coeff + switch ( type ) { + case 1 : SpinBox_Width->setValue( value ); break; // width + case 2 : SpinBox_Nodes_Size->setValue( value ); break; // nodes size = value; break; + case 3 : SpinBox_Shrink->setValue( value ); break; // shrink coeff + default: break; } } @@ -379,13 +268,14 @@ void SMESHGUI_Preferences_ColorDlg::SetIntValue (int type, int value) // function : GetIntValue() // purpose : //================================================================================= -int SMESHGUI_Preferences_ColorDlg::GetIntValue (int type) +int SMESHGUI_Preferences_ColorDlg::GetIntValue( int type ) { int res = 0; - switch (type) { + switch ( type ) { case 1 : res = SpinBox_Width->value(); break; // width case 2 : res = SpinBox_Nodes_Size->value(); break; // nodes size case 3 : res = SpinBox_Shrink->value(); break; // shrink coeff + default: break; } return res; } diff --git a/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.h b/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.h index 850dde89a..d37092a4d 100644 --- a/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.h +++ b/src/SMESHGUI/SMESHGUI_Preferences_ColorDlg.h @@ -1,107 +1,73 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_Preferences_ColorDlg.h +// Author : Nicolas REJNERI, Open CASCADE S.A.S. // -// File : SMESHGUI_Preferences_ColorDlg.h -// Author : Nicolas REJNERI -// Module : SMESH -// $Header$ #ifndef SMESHGUI_PREFERENCES_COLORDLG_H #define SMESHGUI_PREFERENCES_COLORDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -// SALOME Includes -//#include "SUIT_Config.h" -//#include "SUIT_Settings.h" - -// IDL Headers -#include -#include CORBA_SERVER_HEADER(SMESH_Gen) +// Qt includes +#include -// QT Includes -#include - -class QButtonGroup; -class QFrame; -class QLabel; -class QPushButton; class QSpinBox; -class QColor; class SMESHGUI; +class QtxColorButton; class SMESHGUI_EXPORT SMESHGUI_Preferences_ColorDlg : public QDialog { - Q_OBJECT - + Q_OBJECT + public: - SMESHGUI_Preferences_ColorDlg( SMESHGUI*, const char* name = 0 ); - ~SMESHGUI_Preferences_ColorDlg(); + SMESHGUI_Preferences_ColorDlg( SMESHGUI* ); + ~SMESHGUI_Preferences_ColorDlg(); - void SetColor(int type, QColor color); - QColor GetColor(int type); - void SetIntValue(int type, int value); - int GetIntValue(int type); + void SetColor( int, const QColor& ); + QColor GetColor( int ); + void SetIntValue( int, int ); + int GetIntValue( int ); -private: - void closeEvent( QCloseEvent* e ) ; - void Init(); +protected: + void closeEvent( QCloseEvent* ); private slots: -// void RadioButtonClicked(int radioButtonId); - void ClickOnOk(); - void ClickOnCancel(); - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - - void SelectFillColor(); - void SelectBackFaceColor(); - void SelectOutlineColor(); - void SelectNodeColor(); - + void ClickOnOk(); + void ClickOnCancel(); + void DeactivateActiveDialog(); + void ActivateThisDialog(); + private: - SMESH::SMESH_Gen_var myCompMesh ; - SMESHGUI* mySMESHGUI ; - - QButtonGroup* ButtonGroup1; - QLabel* TextLabel_Fill; - QPushButton* btnFillColor; - QLabel* TextLabel_Outine; - QPushButton* btnOutlineColor; - QLabel* TextLabel_Width; - QSpinBox* SpinBox_Width; - QLabel* TextLabel_BackFace; - QPushButton* btnBackFaceColor; - QLabel* TextLabel_ShrinkCoeff; - QSpinBox* SpinBox_Shrink; - QButtonGroup* ButtonGroup2; - QLabel* TextLabel_Nodes_Color; - QPushButton* btnNodeColor; - QLabel* TextLabel_Nodes_Size; - QSpinBox* SpinBox_Nodes_Size; - QButtonGroup* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; + SMESHGUI* mySMESHGUI; + + QtxColorButton* btnFillColor; + QtxColorButton* btnBackFaceColor; + QtxColorButton* btnOutlineColor; + QSpinBox* SpinBox_Width; + QSpinBox* SpinBox_Shrink; + QtxColorButton* btnNodeColor; + QSpinBox* SpinBox_Nodes_Size; }; #endif // SMESHGUI_PREFERENCES_COLORDLG_H diff --git a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx index b17a523eb..5b4cbd873 100644 --- a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.cxx @@ -1,61 +1,63 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_Preferences_ScalarBarDlg.cxx +// Author : Nicolas REJNERI, Open CASCADE S.A.S. // -// -// File : SMESHGUI_Preferences_ScalarBarDlg.cxx -// Author : Nicolas REJNERI -// Module : SMESH -// $Header$ +// SMESH includes #include "SMESHGUI_Preferences_ScalarBarDlg.h" #include "SMESHGUI.h" #include "SMESHGUI_VTKUtils.h" #include "SMESHGUI_Utils.h" -#include "SMESH_Actor.h" - -#include "SUIT_Desktop.h" -#include "SUIT_ResourceMgr.h" - -#include "LightApp_SelectionMgr.h" -#include "SALOME_ListIO.hxx" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - +#include + +// SALOME GUI includes +#include +#include + +#include +#include + +#include +#include + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// VTK includes #include #include #include @@ -64,8 +66,6 @@ #define MARGIN_SIZE 11 #define SPACING_SIZE 6 -using namespace std; - // Only one instance is allowed SMESHGUI_Preferences_ScalarBarDlg* SMESHGUI_Preferences_ScalarBarDlg::myDlg = 0; @@ -79,30 +79,15 @@ SMESHGUI_Preferences_ScalarBarDlg* SMESHGUI_Preferences_ScalarBarDlg::myDlg = 0; void SMESHGUI_Preferences_ScalarBarDlg::ScalarBarProperties( SMESHGUI* theModule ) { if (!myDlg) { - myDlg = new SMESHGUI_Preferences_ScalarBarDlg( theModule, true); + myDlg = new SMESHGUI_Preferences_ScalarBarDlg( theModule ); myDlg->show(); } else { myDlg->show(); - myDlg->setActiveWindow(); myDlg->raise(); - myDlg->setFocus(); + myDlg->activateWindow(); } } -//================================================================================================= -/*! - * SMESHGUI_Preferences_ScalarBarDlg::ScalarBarPreferences - * - * Opens "Scalar Bar Preferences" dialog box - */ -//================================================================================================= -void SMESHGUI_Preferences_ScalarBarDlg::ScalarBarPreferences( SMESHGUI* theModule ) -{ - SMESHGUI_Preferences_ScalarBarDlg* aDlg = - new SMESHGUI_Preferences_ScalarBarDlg( theModule, false); - aDlg->exec(); -} - //================================================================================================= /*! * SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg @@ -110,11 +95,10 @@ void SMESHGUI_Preferences_ScalarBarDlg::ScalarBarPreferences( SMESHGUI* theModul * Constructor */ //================================================================================================= -SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI* theModule, bool property, bool modal ) - : QDialog( SMESH::GetDesktop( theModule ), 0, modal, WStyle_Customize | WStyle_NormalBorder | - WStyle_Title | WStyle_SysMenu | WDestructiveClose ), - mySMESHGUI( theModule ), - mySelectionMgr( property ? SMESH::GetSelectionMgr( theModule ) : 0 ) +SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI* theModule ) + : QDialog( SMESH::GetDesktop( theModule ) ), + mySMESHGUI( theModule ), + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) { DEF_VER_X = 0.01; DEF_VER_Y = 0.10; @@ -124,319 +108,270 @@ SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI* DEF_HOR_Y = 0.01; DEF_HOR_H = 0.12; DEF_HOR_W = 0.60; - setName("SMESHGUI_Preferences_ScalarBarDlg"); - setCaption( property ? tr("SMESH_PROPERTIES_SCALARBAR") : tr("SMESH_PREFERENCES_SCALARBAR")); - setSizeGripEnabled(TRUE); + + setModal( false ); + setAttribute( Qt::WA_DeleteOnClose, true ); + setWindowTitle( tr("SMESH_PROPERTIES_SCALARBAR") ); + setSizeGripEnabled(true); myActor = 0; /******************************************************************************/ // Top layout - QGridLayout* aTopLayout = new QGridLayout( this ); + QVBoxLayout* aTopLayout = new QVBoxLayout( this ); aTopLayout->setSpacing( SPACING_SIZE ); aTopLayout->setMargin( MARGIN_SIZE ); - int aRow = 0; /******************************************************************************/ // Scalar range - if ( mySelectionMgr ) { - myRangeGrp = new QGroupBox ( tr( "SMESH_RANGE_SCALARBAR" ), this, "myRangeGrp" ); - myRangeGrp->setColumnLayout( 0, Qt::Vertical ); - myRangeGrp->layout()->setSpacing( 0 ); myRangeGrp->layout()->setMargin( 0 ); - QGridLayout* myRangeGrpLayout = new QGridLayout( myRangeGrp->layout() ); - myRangeGrpLayout->setAlignment( Qt::AlignTop ); - myRangeGrpLayout->setSpacing( SPACING_SIZE ); myRangeGrpLayout->setMargin( MARGIN_SIZE ); - - myMinEdit = new QLineEdit( myRangeGrp, "myMinEdit" ); - myMinEdit->setMinimumWidth( MINIMUM_WIDTH ); - myMinEdit->setValidator( new QDoubleValidator( this ) ); - - myMaxEdit = new QLineEdit( myRangeGrp, "myMaxEdit" ); - myMaxEdit->setMinimumWidth( MINIMUM_WIDTH ); - myMaxEdit->setValidator( new QDoubleValidator( this ) ); - - myRangeGrpLayout->addWidget( new QLabel( tr( "SMESH_RANGE_MIN" ), myRangeGrp, "myMinLab" ), 0, 0 ); - myRangeGrpLayout->addWidget( myMinEdit, 0, 1 ); - myRangeGrpLayout->addWidget( new QLabel( tr( "SMESH_RANGE_MAX" ), myRangeGrp, "myMaxLab" ), 0, 2 ); - myRangeGrpLayout->addWidget( myMaxEdit, 0, 3 ); - - aTopLayout->addWidget( myRangeGrp, aRow, 0 ); - aRow++; - } + myRangeGrp = new QGroupBox ( tr( "SMESH_RANGE_SCALARBAR" ), this ); + QHBoxLayout* myRangeGrpLayout = new QHBoxLayout( myRangeGrp ); + myRangeGrpLayout->setSpacing( SPACING_SIZE ); myRangeGrpLayout->setMargin( MARGIN_SIZE ); + + myMinEdit = new QLineEdit( myRangeGrp ); + myMinEdit->setMinimumWidth( MINIMUM_WIDTH ); + myMinEdit->setValidator( new QDoubleValidator( this ) ); + + myMaxEdit = new QLineEdit( myRangeGrp ); + myMaxEdit->setMinimumWidth( MINIMUM_WIDTH ); + myMaxEdit->setValidator( new QDoubleValidator( this ) ); + + myRangeGrpLayout->addWidget( new QLabel( tr( "SMESH_RANGE_MIN" ), myRangeGrp ) ); + myRangeGrpLayout->addWidget( myMinEdit ); + myRangeGrpLayout->addWidget( new QLabel( tr( "SMESH_RANGE_MAX" ), myRangeGrp ) ); + myRangeGrpLayout->addWidget( myMaxEdit ); + + aTopLayout->addWidget( myRangeGrp ); /******************************************************************************/ // Text properties - myFontGrp = new QGroupBox ( tr( "SMESH_FONT_SCALARBAR" ), this, "myFontGrp" ); - myFontGrp->setColumnLayout( 0, Qt::Vertical ); - myFontGrp->layout()->setSpacing( 0 ); myFontGrp->layout()->setMargin( 0 ); - QGridLayout* myFontGrpLayout = new QGridLayout( myFontGrp->layout() ); - myFontGrpLayout->setAlignment( Qt::AlignTop ); + myFontGrp = new QGroupBox ( tr( "SMESH_FONT_SCALARBAR" ), this ); + QGridLayout* myFontGrpLayout = new QGridLayout( myFontGrp ); myFontGrpLayout->setSpacing( SPACING_SIZE ); myFontGrpLayout->setMargin( MARGIN_SIZE ); - myTitleColorBtn = new QToolButton( myFontGrp, "myTitleColorBtn" ); - myTitleColorBtn->setMinimumWidth( 20 ); + myTitleColorBtn = new QtxColorButton( myFontGrp ); - myTitleFontCombo = new QComboBox( false, myFontGrp, "myTitleFontCombo" ); + myTitleFontCombo = new QComboBox( myFontGrp ); myTitleFontCombo->setMinimumWidth( MINIMUM_WIDTH ); myTitleFontCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myTitleFontCombo->insertItem( tr( "SMESH_FONT_ARIAL" ) ); - myTitleFontCombo->insertItem( tr( "SMESH_FONT_COURIER" ) ); - myTitleFontCombo->insertItem( tr( "SMESH_FONT_TIMES" ) ); + myTitleFontCombo->addItem( tr( "SMESH_FONT_ARIAL" ) ); + myTitleFontCombo->addItem( tr( "SMESH_FONT_COURIER" ) ); + myTitleFontCombo->addItem( tr( "SMESH_FONT_TIMES" ) ); - myTitleBoldCheck = new QCheckBox( tr( "SMESH_FONT_BOLD" ), myFontGrp, "myTitleBoldCheck" ); - myTitleItalicCheck = new QCheckBox( tr( "SMESH_FONT_ITALIC" ), myFontGrp, "myTitleItalicCheck" ); - myTitleShadowCheck = new QCheckBox( tr( "SMESH_FONT_SHADOW" ), myFontGrp, "myTitleShadowCheck" ); + myTitleBoldCheck = new QCheckBox( tr( "SMESH_FONT_BOLD" ), myFontGrp ); + myTitleItalicCheck = new QCheckBox( tr( "SMESH_FONT_ITALIC" ), myFontGrp ); + myTitleShadowCheck = new QCheckBox( tr( "SMESH_FONT_SHADOW" ), myFontGrp ); - myLabelsColorBtn = new QToolButton( myFontGrp, "myLabelsColorBtn" ); - myLabelsColorBtn->setMinimumWidth( 20 ); + myLabelsColorBtn = new QtxColorButton( myFontGrp ); - myLabelsFontCombo = new QComboBox( false, myFontGrp, "myLabelsFontCombo" ); + myLabelsFontCombo = new QComboBox( myFontGrp ); myLabelsFontCombo->setMinimumWidth( MINIMUM_WIDTH ); myLabelsFontCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myLabelsFontCombo->insertItem( tr( "SMESH_FONT_ARIAL" ) ); - myLabelsFontCombo->insertItem( tr( "SMESH_FONT_COURIER" ) ); - myLabelsFontCombo->insertItem( tr( "SMESH_FONT_TIMES" ) ); + myLabelsFontCombo->addItem( tr( "SMESH_FONT_ARIAL" ) ); + myLabelsFontCombo->addItem( tr( "SMESH_FONT_COURIER" ) ); + myLabelsFontCombo->addItem( tr( "SMESH_FONT_TIMES" ) ); - myLabelsBoldCheck = new QCheckBox( tr( "SMESH_FONT_BOLD" ), myFontGrp, "myLabelsBoldCheck" ); - myLabelsItalicCheck = new QCheckBox( tr( "SMESH_FONT_ITALIC" ), myFontGrp, "myLabelsItalicCheck" ); - myLabelsShadowCheck = new QCheckBox( tr( "SMESH_FONT_SHADOW" ), myFontGrp, "myLabelsShadowCheck" ); + myLabelsBoldCheck = new QCheckBox( tr( "SMESH_FONT_BOLD" ), myFontGrp ); + myLabelsItalicCheck = new QCheckBox( tr( "SMESH_FONT_ITALIC" ), myFontGrp ); + myLabelsShadowCheck = new QCheckBox( tr( "SMESH_FONT_SHADOW" ), myFontGrp ); - myFontGrpLayout->addWidget( new QLabel( tr( "SMESH_TITLE" ), myFontGrp, "myFontTitleLab" ), 0, 0 ); + myFontGrpLayout->addWidget( new QLabel( tr( "SMESH_TITLE" ), myFontGrp ), 0, 0 ); myFontGrpLayout->addWidget( myTitleColorBtn, 0, 1 ); myFontGrpLayout->addWidget( myTitleFontCombo, 0, 2 ); myFontGrpLayout->addWidget( myTitleBoldCheck, 0, 3 ); myFontGrpLayout->addWidget( myTitleItalicCheck, 0, 4 ); myFontGrpLayout->addWidget( myTitleShadowCheck, 0, 5 ); - myFontGrpLayout->addWidget( new QLabel( tr( "SMESH_LABELS" ), myFontGrp, "myFontLabelsLab" ), 1, 0 ); + myFontGrpLayout->addWidget( new QLabel( tr( "SMESH_LABELS" ), myFontGrp ), 1, 0 ); myFontGrpLayout->addWidget( myLabelsColorBtn, 1, 1 ); myFontGrpLayout->addWidget( myLabelsFontCombo, 1, 2 ); myFontGrpLayout->addWidget( myLabelsBoldCheck, 1, 3 ); myFontGrpLayout->addWidget( myLabelsItalicCheck, 1, 4 ); myFontGrpLayout->addWidget( myLabelsShadowCheck, 1, 5 ); - aTopLayout->addWidget( myFontGrp, aRow, 0 ); - aRow++; + aTopLayout->addWidget( myFontGrp ); /******************************************************************************/ // Labels & Colors - myLabColorGrp = new QGroupBox ( tr( "SMESH_LABELS_COLORS_SCALARBAR" ), this, "myLabColorGrp" ); - myLabColorGrp->setColumnLayout( 0, Qt::Vertical ); - myLabColorGrp->layout()->setSpacing( 0 ); myLabColorGrp->layout()->setMargin( 0 ); - QGridLayout* myLabColorGrpLayout = new QGridLayout( myLabColorGrp->layout() ); - myLabColorGrpLayout->setAlignment( Qt::AlignTop ); + myLabColorGrp = new QGroupBox ( tr( "SMESH_LABELS_COLORS_SCALARBAR" ), this ); + QHBoxLayout* myLabColorGrpLayout = new QHBoxLayout( myLabColorGrp ); myLabColorGrpLayout->setSpacing( SPACING_SIZE ); myLabColorGrpLayout->setMargin( MARGIN_SIZE ); - myColorsSpin = new QSpinBox( 2, 256, 1, myLabColorGrp, "myColorsSpin" ); + myColorsSpin = new QSpinBox( myLabColorGrp ); + myColorsSpin->setRange( 2, 256 ); + myColorsSpin->setSingleStep( 1 ); myColorsSpin->setMinimumWidth( MINIMUM_WIDTH ); myColorsSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myLabelsSpin = new QSpinBox( 2, 65, 1, myLabColorGrp, "myLabelsSpin" ); + myLabelsSpin = new QSpinBox( myLabColorGrp ); + myLabelsSpin->setRange( 2, 65 ); + myLabelsSpin->setSingleStep( 1 ); myLabelsSpin->setMinimumWidth( MINIMUM_WIDTH ); myLabelsSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myLabColorGrpLayout->addWidget( new QLabel( tr( "SMESH_NUMBEROFCOLORS" ), myLabColorGrp, "myNbColorLab" ), 0, 0 ); - myLabColorGrpLayout->addWidget( myColorsSpin, 0, 1 ); - myLabColorGrpLayout->addWidget( new QLabel( tr( "SMESH_NUMBEROFLABELS" ), myLabColorGrp, "myNbLabsLab" ), 0, 2 ); - myLabColorGrpLayout->addWidget( myLabelsSpin, 0, 3 ); + myLabColorGrpLayout->addWidget( new QLabel( tr( "SMESH_NUMBEROFCOLORS" ), myLabColorGrp ) ); + myLabColorGrpLayout->addWidget( myColorsSpin ); + myLabColorGrpLayout->addWidget( new QLabel( tr( "SMESH_NUMBEROFLABELS" ), myLabColorGrp ) ); + myLabColorGrpLayout->addWidget( myLabelsSpin ); - aTopLayout->addWidget( myLabColorGrp, aRow, 0 ); - aRow++; + aTopLayout->addWidget( myLabColorGrp ); /******************************************************************************/ // Orientation - myOrientationGrp = new QButtonGroup ( tr( "SMESH_ORIENTATION" ), this, "myOrientationGrp" ); - myOrientationGrp->setColumnLayout( 0, Qt::Vertical ); - myOrientationGrp->layout()->setSpacing( 0 ); myOrientationGrp->layout()->setMargin( 0 ); - QGridLayout* myOrientationGrpLayout = new QGridLayout( myOrientationGrp->layout() ); - myOrientationGrpLayout->setAlignment( Qt::AlignTop ); + myOrientationGrp = new QGroupBox ( tr( "SMESH_ORIENTATION" ), this ); + QButtonGroup* aOrientationGrp = new QButtonGroup( this ); + QHBoxLayout* myOrientationGrpLayout = new QHBoxLayout( myOrientationGrp ); myOrientationGrpLayout->setSpacing( SPACING_SIZE ); myOrientationGrpLayout->setMargin( MARGIN_SIZE ); - myVertRadioBtn = new QRadioButton( tr( "SMESH_VERTICAL" ), myOrientationGrp, "myVertRadioBtn" ); - myHorizRadioBtn = new QRadioButton( tr( "SMESH_HORIZONTAL" ), myOrientationGrp, "myHorizRadioBtn" ); + myVertRadioBtn = new QRadioButton( tr( "SMESH_VERTICAL" ), myOrientationGrp ); + myHorizRadioBtn = new QRadioButton( tr( "SMESH_HORIZONTAL" ), myOrientationGrp ); myVertRadioBtn->setChecked( true ); - myOrientationGrpLayout->addWidget( myVertRadioBtn, 0, 0 ); - myOrientationGrpLayout->addWidget( myHorizRadioBtn, 0, 1 ); + myOrientationGrpLayout->addWidget( myVertRadioBtn ); + myOrientationGrpLayout->addWidget( myHorizRadioBtn ); + aOrientationGrp->addButton(myVertRadioBtn); + aOrientationGrp->addButton(myHorizRadioBtn); - aTopLayout->addWidget( myOrientationGrp, aRow, 0 ); - aRow++; + aTopLayout->addWidget( myOrientationGrp ); /******************************************************************************/ // Position & Size - myOriginDimGrp = new QGroupBox (tr("SMESH_POSITION_SIZE_SCALARBAR"), this, "myOriginDimGrp"); - myOriginDimGrp->setColumnLayout(0, Qt::Vertical); - myOriginDimGrp->layout()->setSpacing( 0 ); myOriginDimGrp->layout()->setMargin( 0 ); - QGridLayout* myOriginDimGrpLayout = new QGridLayout( myOriginDimGrp->layout() ); - myOriginDimGrpLayout->setAlignment( Qt::AlignTop ); + myOriginDimGrp = new QGroupBox ( tr("SMESH_POSITION_SIZE_SCALARBAR"), this ); + QGridLayout* myOriginDimGrpLayout = new QGridLayout( myOriginDimGrp ); myOriginDimGrpLayout->setSpacing( SPACING_SIZE ); myOriginDimGrpLayout->setMargin( MARGIN_SIZE ); - myXSpin = new QtxDblSpinBox (0.0, 1.0, 0.1, myOriginDimGrp); + myXSpin = new QtxDoubleSpinBox (0.0, 1.0, 0.1, myOriginDimGrp); myXSpin->setMinimumWidth( MINIMUM_WIDTH ); myXSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myYSpin = new QtxDblSpinBox(0.0, 1.0, 0.1, myOriginDimGrp); + myYSpin = new QtxDoubleSpinBox(0.0, 1.0, 0.1, myOriginDimGrp); myYSpin->setMinimumWidth( MINIMUM_WIDTH ); myYSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myWidthSpin = new QtxDblSpinBox(0.0, 1.0, 0.1, myOriginDimGrp); + myWidthSpin = new QtxDoubleSpinBox(0.0, 1.0, 0.1, myOriginDimGrp); myWidthSpin->setMinimumWidth( MINIMUM_WIDTH ); myWidthSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myHeightSpin = new QtxDblSpinBox(0.0, 1.0, 0.1, myOriginDimGrp); + myHeightSpin = new QtxDoubleSpinBox(0.0, 1.0, 0.1, myOriginDimGrp); myHeightSpin->setMinimumWidth( MINIMUM_WIDTH ); myHeightSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myOriginDimGrpLayout->addWidget( new QLabel( tr( "SMESH_X_SCALARBAR" ), myOriginDimGrp, "myXLab" ), 0, 0 ); + myOriginDimGrpLayout->addWidget( new QLabel( tr( "SMESH_X_SCALARBAR" ), myOriginDimGrp ), 0, 0 ); myOriginDimGrpLayout->addWidget( myXSpin, 0, 1 ); - myOriginDimGrpLayout->addWidget( new QLabel( tr( "SMESH_Y_SCALARBAR" ), myOriginDimGrp, "myYLab" ), 0, 2 ); + myOriginDimGrpLayout->addWidget( new QLabel( tr( "SMESH_Y_SCALARBAR" ), myOriginDimGrp ), 0, 2 ); myOriginDimGrpLayout->addWidget( myYSpin, 0, 3 ); - myOriginDimGrpLayout->addWidget( new QLabel( tr( "SMESH_WIDTH" ), myOriginDimGrp, "myWidthLab" ), 1, 0 ); + myOriginDimGrpLayout->addWidget( new QLabel( tr( "SMESH_WIDTH" ), myOriginDimGrp ), 1, 0 ); myOriginDimGrpLayout->addWidget( myWidthSpin, 1, 1 ); - myOriginDimGrpLayout->addWidget( new QLabel( tr( "SMESH_HEIGHT" ), myOriginDimGrp, "myHeightLab" ), 1, 2 ); + myOriginDimGrpLayout->addWidget( new QLabel( tr( "SMESH_HEIGHT" ), myOriginDimGrp ), 1, 2 ); myOriginDimGrpLayout->addWidget( myHeightSpin, 1, 3 ); - aTopLayout->addWidget( myOriginDimGrp, aRow, 0 ); - aRow++; + aTopLayout->addWidget( myOriginDimGrp ); /***************************************************************/ // Common buttons - myButtonGrp = new QGroupBox( this, "myButtonGrp" ); - myButtonGrp->setColumnLayout(0, Qt::Vertical ); - myButtonGrp->layout()->setSpacing( 0 ); myButtonGrp->layout()->setMargin( 0 ); - QHBoxLayout* myButtonGrpLayout = new QHBoxLayout( myButtonGrp->layout() ); - myButtonGrpLayout->setAlignment( Qt::AlignTop ); + myButtonGrp = new QGroupBox( this ); + QHBoxLayout* myButtonGrpLayout = new QHBoxLayout( myButtonGrp ); myButtonGrpLayout->setSpacing( SPACING_SIZE ); myButtonGrpLayout->setMargin( MARGIN_SIZE ); - myOkBtn = new QPushButton( tr( "SMESH_BUT_OK" ), myButtonGrp, "myOkBtn" ); - myOkBtn->setAutoDefault( TRUE ); myOkBtn->setDefault( TRUE ); + myOkBtn = new QPushButton( tr( "SMESH_BUT_OK" ), myButtonGrp ); + myOkBtn->setAutoDefault( true ); myOkBtn->setDefault( true ); + myApplyBtn = new QPushButton( tr( "SMESH_BUT_APPLY" ), myButtonGrp ); + myApplyBtn->setAutoDefault( true ); + myCancelBtn = new QPushButton( tr( "SMESH_BUT_CLOSE" ), myButtonGrp ); + myCancelBtn->setAutoDefault( true ); + myButtonGrpLayout->addWidget( myOkBtn ); - if ( mySelectionMgr ) { - myApplyBtn = new QPushButton( tr( "SMESH_BUT_APPLY" ), myButtonGrp, "myApplyBtn" ); - myApplyBtn->setAutoDefault( TRUE ); - myButtonGrpLayout->addWidget( myApplyBtn ); - } + myButtonGrpLayout->addSpacing( 10 ); + myButtonGrpLayout->addWidget( myApplyBtn ); + myButtonGrpLayout->addSpacing( 10 ); myButtonGrpLayout->addStretch(); - myCancelBtn = new QPushButton( tr( "SMESH_BUT_CANCEL" ), myButtonGrp, "myCancelBtn" ); - if ( mySelectionMgr ) - myCancelBtn->setText( tr( "SMESH_BUT_CLOSE" ) ); - myCancelBtn->setAutoDefault( TRUE ); myButtonGrpLayout->addWidget( myCancelBtn ); - aTopLayout->addWidget( myButtonGrp, aRow, 0 ); + aTopLayout->addWidget( myButtonGrp ); /***************************************************************/ // Init // --> first init from preferences SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI ); - QColor titleColor (255, 255, 255); - if (mgr && mgr->hasValue("SMESH", "scalar_bar_title_color")) { - QStringList aTColor = - QStringList::split(":", mgr->stringValue("SMESH", "scalar_bar_title_color"), false); - titleColor = QColor((aTColor.count() > 0 ? aTColor[0].toInt() : 255), - (aTColor.count() > 1 ? aTColor[1].toInt() : 255), - (aTColor.count() > 2 ? aTColor[2].toInt() : 255)); - } - myTitleColorBtn->setPaletteBackgroundColor(titleColor); - myTitleFontCombo->setCurrentItem(0); - if (mgr && mgr->hasValue("SMESH", "scalar_bar_title_font")) { + QColor titleColor = mgr->colorValue("SMESH", "scalar_bar_title_color", + QColor(255, 255, 255)); + myTitleColorBtn->setColor(titleColor); + myTitleFontCombo->setCurrentIndex(0); + if (mgr->hasValue("SMESH", "scalar_bar_title_font")) { QFont f = mgr->fontValue( "SMESH", "scalar_bar_title_font" ); if( f.family()=="Arial" ) - myTitleFontCombo->setCurrentItem(0); + myTitleFontCombo->setCurrentIndex(0); if( f.family()=="Courier" ) - myTitleFontCombo->setCurrentItem(1); + myTitleFontCombo->setCurrentIndex(1); if( f.family()=="Times") - myTitleFontCombo->setCurrentItem(2); - + myTitleFontCombo->setCurrentIndex(2); + myTitleBoldCheck->setChecked ( f.bold() ); myTitleItalicCheck->setChecked( f.italic() ); myTitleShadowCheck->setChecked( f.underline() ); } - - QColor labelColor (255, 255, 255); - if (mgr && mgr->hasValue("SMESH", "scalar_bar_label_color")) { - QStringList aLColor = - QStringList::split(":", mgr->stringValue("SMESH", "scalar_bar_label_color"), false); - labelColor = QColor((aLColor.count() > 0 ? aLColor[0].toInt() : 255), - (aLColor.count() > 1 ? aLColor[1].toInt() : 255), - (aLColor.count() > 2 ? aLColor[2].toInt() : 255)); - } - myLabelsColorBtn->setPaletteBackgroundColor(labelColor); - myLabelsFontCombo->setCurrentItem(0); - if (mgr && mgr->hasValue("SMESH", "scalar_bar_label_font")) { + + QColor labelColor = mgr->colorValue("SMESH", "scalar_bar_label_color", + QColor(255, 255, 255)); + myLabelsColorBtn->setColor(labelColor); + myLabelsFontCombo->setCurrentIndex(0); + if (mgr->hasValue("SMESH", "scalar_bar_label_font")) { QFont f = mgr->fontValue( "SMESH", "scalar_bar_label_font" ); if (f.family() == "Arial") - myLabelsFontCombo->setCurrentItem(0); + myLabelsFontCombo->setCurrentIndex(0); if (f.family() == "Courier") - myLabelsFontCombo->setCurrentItem(1); + myLabelsFontCombo->setCurrentIndex(1); if (f.family() == "Times") - myLabelsFontCombo->setCurrentItem(2); + myLabelsFontCombo->setCurrentIndex(2); myLabelsBoldCheck ->setChecked( f.bold() ); myLabelsItalicCheck->setChecked( f.italic() ); myLabelsShadowCheck->setChecked( f.underline() ); } - int aNbColors = 64; - if (mgr && mgr->hasValue("SMESH", "scalar_bar_num_colors")) - aNbColors = mgr->integerValue("SMESH", "scalar_bar_num_colors"); + int aNbColors = mgr->integerValue("SMESH", "scalar_bar_num_colors", 64); myColorsSpin->setValue(aNbColors); - int aNbLabels = 5; - if (mgr && mgr->hasValue("SMESH", "scalar_bar_num_labels")) - aNbLabels = mgr->integerValue("SMESH", "scalar_bar_num_labels"); + int aNbLabels = mgr->integerValue("SMESH", "scalar_bar_num_labels", 5); myLabelsSpin->setValue(aNbLabels); - int aOrientation = ( mgr ? mgr->integerValue( "SMESH", "scalar_bar_orientation", 1 ) : 1 ); - bool isHoriz = ( aOrientation==1 ); - if (aOrientation == 1) + int aOrientation = mgr->integerValue( "SMESH", "scalar_bar_orientation", 1 ); + bool isHoriz = aOrientation == 1; + if (isHoriz) myHorizRadioBtn->setChecked(true); else myVertRadioBtn->setChecked(true); myIniOrientation = myVertRadioBtn->isChecked(); QString name = isHoriz ? "scalar_bar_horizontal_%1" : "scalar_bar_vertical_%1"; - if (mgr && mgr->hasValue("SMESH", name.arg( "x" ))) - myIniX = mgr->doubleValue("SMESH", name.arg( "x" )); - else - myIniX = myHorizRadioBtn->isChecked() ? DEF_HOR_X : DEF_VER_X; - if (mgr && mgr->hasValue("SMESH", name.arg( "y" ))) - myIniY = mgr->doubleValue("SMESH", name.arg( "y" )); - else - myIniY = myHorizRadioBtn->isChecked() ? DEF_HOR_Y : DEF_VER_Y; + myIniX = mgr->doubleValue("SMESH", name.arg( "x" ), + myHorizRadioBtn->isChecked() ? DEF_HOR_X : DEF_VER_X); - if (mgr && mgr->hasValue("SMESH", name.arg( "width" ))) - myIniW = mgr->doubleValue("SMESH", name.arg( "width" )); - else - myIniW = myHorizRadioBtn->isChecked() ? DEF_HOR_W : DEF_VER_W; + myIniY = mgr->doubleValue("SMESH", name.arg( "y" ), + myHorizRadioBtn->isChecked() ? DEF_HOR_Y : DEF_VER_Y); - if (mgr && mgr->hasValue("SMESH", name.arg( "height" ))) - myIniH = mgr->doubleValue("SMESH", name.arg( "height" )); - else - myIniH = myHorizRadioBtn->isChecked() ? DEF_HOR_H : DEF_VER_H; + myIniW = mgr->doubleValue("SMESH", name.arg( "width" ), + myHorizRadioBtn->isChecked() ? DEF_HOR_W : DEF_VER_W); + + myIniH = mgr->doubleValue("SMESH", name.arg( "height" ), + myHorizRadioBtn->isChecked() ? DEF_HOR_H : DEF_VER_H); setOriginAndSize(myIniX, myIniY, myIniW, myIniH); - if (mySelectionMgr) { - // --> then init from selection if necessary - onSelectionChanged(); - } + // --> then init from selection if necessary + onSelectionChanged(); /***************************************************************/ // Connect section - connect( myTitleColorBtn, SIGNAL( clicked() ), this, SLOT( onTitleColor() ) ); - connect( myLabelsColorBtn, SIGNAL( clicked() ), this, SLOT( onLabelsColor() ) ); connect( myOkBtn, SIGNAL( clicked() ), this, SLOT( onOk() ) ); + connect( myApplyBtn, SIGNAL( clicked() ), this, SLOT( onApply() ) ); connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( onCancel() ) ); connect( myXSpin, SIGNAL( valueChanged( double ) ), this, SLOT( onXYChanged() ) ); connect( myYSpin, SIGNAL( valueChanged( double ) ), this, SLOT( onXYChanged() ) ); - connect( myOrientationGrp, SIGNAL( clicked( int ) ), this, SLOT( onOrientationChanged() ) ); - if ( mySelectionMgr ) { - connect( myApplyBtn, SIGNAL( clicked() ), this, SLOT( onApply() ) ); - connect( mySelectionMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) ); - } - connect( mySMESHGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( onCancel() ) ) ; + connect( aOrientationGrp, SIGNAL( buttonClicked( int ) ), this, SLOT( onOrientationChanged() ) ); + connect( mySelectionMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) ); + connect( mySMESHGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( onCancel() ) ); } //================================================================================================= @@ -472,107 +407,59 @@ void SMESHGUI_Preferences_ScalarBarDlg::onOk() //================================================================================================= bool SMESHGUI_Preferences_ScalarBarDlg::onApply() { - if (mySelectionMgr) { - // Scalar Bar properties - if (!myActor) - return false; - vtkScalarBarActor* myScalarBarActor = myActor->GetScalarBarActor(); - - vtkTextProperty* aTitleTextPrp = myScalarBarActor->GetTitleTextProperty(); - QColor aTColor = myTitleColorBtn->paletteBackgroundColor(); - aTitleTextPrp->SetColor( aTColor.red()/255., aTColor.green()/255., aTColor.blue()/255. ); - if ( myTitleFontCombo->currentItem() == 0 ) - aTitleTextPrp->SetFontFamilyToArial(); - else if ( myTitleFontCombo->currentItem() == 1 ) - aTitleTextPrp->SetFontFamilyToCourier(); - else - aTitleTextPrp->SetFontFamilyToTimes(); - aTitleTextPrp->SetBold( myTitleBoldCheck->isChecked() ); - aTitleTextPrp->SetItalic( myTitleItalicCheck->isChecked() ); - aTitleTextPrp->SetShadow( myTitleShadowCheck->isChecked() ); - myScalarBarActor->SetTitleTextProperty( aTitleTextPrp ); - - vtkTextProperty* aLabelsTextPrp = myScalarBarActor->GetLabelTextProperty(); - QColor aLColor = myLabelsColorBtn->paletteBackgroundColor(); - aLabelsTextPrp->SetColor( aLColor.red()/255., aLColor.green()/255., aLColor.blue()/255. ); - if ( myLabelsFontCombo->currentItem() == 0 ) - aLabelsTextPrp->SetFontFamilyToArial(); - else if ( myLabelsFontCombo->currentItem() == 1 ) - aLabelsTextPrp->SetFontFamilyToCourier(); - else - aLabelsTextPrp->SetFontFamilyToTimes(); - aLabelsTextPrp->SetBold( myLabelsBoldCheck->isChecked() ); - aLabelsTextPrp->SetItalic( myLabelsItalicCheck->isChecked() ); - aLabelsTextPrp->SetShadow( myLabelsShadowCheck->isChecked() ); - myScalarBarActor->SetLabelTextProperty( aLabelsTextPrp ); - - myScalarBarActor->SetNumberOfLabels( myLabelsSpin->value() ); - myScalarBarActor->SetMaximumNumberOfColors( myColorsSpin->value() ); - - if ( myHorizRadioBtn->isChecked() ) - myScalarBarActor->SetOrientationToHorizontal(); - else - myScalarBarActor->SetOrientationToVertical(); - - myScalarBarActor->SetPosition( myXSpin->value(), myYSpin->value() ); - myScalarBarActor->SetWidth( myWidthSpin->value() ); - myScalarBarActor->SetHeight( myHeightSpin->value() ); - - double aMin = myMinEdit->text().toDouble(); - double aMax = myMaxEdit->text().toDouble(); - vtkLookupTable* myLookupTable = - static_cast(myScalarBarActor->GetLookupTable()); - myLookupTable->SetRange( aMin, aMax ); - myLookupTable->SetNumberOfTableValues(myColorsSpin->value()); - myLookupTable->Build(); - SMESH::RepaintCurrentView(); - } else { - // Scalar Bar preferences - SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI ); - if (!mgr) return false; - - QColor titleColor = myTitleColorBtn->paletteBackgroundColor(); - mgr->setValue("SMESH", "scalar_bar_title_color", titleColor ); - - QFont f; - if (myTitleFontCombo->currentItem() == 0) - f.setFamily( "Arial" ); - else if (myTitleFontCombo->currentItem() == 1) - f.setFamily( "Courier" ); - else - f.setFamily( "Times"); - - f.setBold( myTitleBoldCheck ->isChecked() ); - f.setItalic( myTitleItalicCheck->isChecked() ); - f.setUnderline( myTitleShadowCheck->isChecked() ); - mgr->setValue( "SMESH", "scalar_bar_title_font", f ); - - QColor labelColor = myLabelsColorBtn->paletteBackgroundColor(); - mgr->setValue("SMESH", "scalar_bar_label_color", labelColor ); - - if (myLabelsFontCombo->currentItem() == 0) - f.setFamily( "Arial" ); - else if ( myLabelsFontCombo->currentItem() == 1 ) - f.setFamily( "Courier"); - else - f.setFamily( "Times"); - - f.setBold( myLabelsBoldCheck ->isChecked() ); - f.setItalic( myLabelsItalicCheck->isChecked() ); - f.setUnderline( myLabelsShadowCheck->isChecked() ); - mgr->setValue( "SMESH", "scalar_bar_label_font", f ); - - mgr->setValue("SMESH", "scalar_bar_num_colors", myColorsSpin->value()); - mgr->setValue("SMESH", "scalar_bar_num_labels", myLabelsSpin->value()); - - mgr->setValue("SMESH", "scalar_bar_orientation", myHorizRadioBtn->isChecked() ? 1 : 0 ); - - QString name = myHorizRadioBtn->isChecked() ? "scalar_bar_horizontal_%1" : "scalar_bar_vertical_%1"; - mgr->setValue("SMESH", name.arg( "x" ), myXSpin->value()); - mgr->setValue("SMESH", name.arg( "y" ), myYSpin->value()); - mgr->setValue("SMESH", name.arg( "width" ), myWidthSpin->value()); - mgr->setValue("SMESH", name.arg( "height" ), myHeightSpin->value()); - } + // Scalar Bar properties + if (!myActor) + return false; + vtkScalarBarActor* myScalarBarActor = myActor->GetScalarBarActor(); + + vtkTextProperty* aTitleTextPrp = myScalarBarActor->GetTitleTextProperty(); + QColor aTColor = myTitleColorBtn->color(); + aTitleTextPrp->SetColor( aTColor.red()/255., aTColor.green()/255., aTColor.blue()/255. ); + if ( myTitleFontCombo->currentIndex() == 0 ) + aTitleTextPrp->SetFontFamilyToArial(); + else if ( myTitleFontCombo->currentIndex() == 1 ) + aTitleTextPrp->SetFontFamilyToCourier(); + else + aTitleTextPrp->SetFontFamilyToTimes(); + aTitleTextPrp->SetBold( myTitleBoldCheck->isChecked() ); + aTitleTextPrp->SetItalic( myTitleItalicCheck->isChecked() ); + aTitleTextPrp->SetShadow( myTitleShadowCheck->isChecked() ); + myScalarBarActor->SetTitleTextProperty( aTitleTextPrp ); + + vtkTextProperty* aLabelsTextPrp = myScalarBarActor->GetLabelTextProperty(); + QColor aLColor = myLabelsColorBtn->color(); + aLabelsTextPrp->SetColor( aLColor.red()/255., aLColor.green()/255., aLColor.blue()/255. ); + if ( myLabelsFontCombo->currentIndex() == 0 ) + aLabelsTextPrp->SetFontFamilyToArial(); + else if ( myLabelsFontCombo->currentIndex() == 1 ) + aLabelsTextPrp->SetFontFamilyToCourier(); + else + aLabelsTextPrp->SetFontFamilyToTimes(); + aLabelsTextPrp->SetBold( myLabelsBoldCheck->isChecked() ); + aLabelsTextPrp->SetItalic( myLabelsItalicCheck->isChecked() ); + aLabelsTextPrp->SetShadow( myLabelsShadowCheck->isChecked() ); + myScalarBarActor->SetLabelTextProperty( aLabelsTextPrp ); + + myScalarBarActor->SetNumberOfLabels( myLabelsSpin->value() ); + myScalarBarActor->SetMaximumNumberOfColors( myColorsSpin->value() ); + + if ( myHorizRadioBtn->isChecked() ) + myScalarBarActor->SetOrientationToHorizontal(); + else + myScalarBarActor->SetOrientationToVertical(); + + myScalarBarActor->SetPosition( myXSpin->value(), myYSpin->value() ); + myScalarBarActor->SetWidth( myWidthSpin->value() ); + myScalarBarActor->SetHeight( myHeightSpin->value() ); + + double aMin = myMinEdit->text().toDouble(); + double aMax = myMaxEdit->text().toDouble(); + vtkLookupTable* myLookupTable = + static_cast(myScalarBarActor->GetLookupTable()); + myLookupTable->SetRange( aMin, aMax ); + myLookupTable->SetNumberOfTableValues(myColorsSpin->value()); + myLookupTable->Build(); + SMESH::RepaintCurrentView(); return true; } @@ -588,36 +475,6 @@ void SMESHGUI_Preferences_ScalarBarDlg::onCancel() close(); } -//================================================================================================= -/*! - * SMESHGUI_Preferences_ScalarBarDlg::onTitleColor - * - * Change Title color button slot - */ -//================================================================================================= -void SMESHGUI_Preferences_ScalarBarDlg::onTitleColor() -{ - QColor aColor = myTitleColorBtn->paletteBackgroundColor(); - aColor = QColorDialog::getColor( aColor, this ); - if ( aColor.isValid() ) - myTitleColorBtn->setPaletteBackgroundColor( aColor ); -} - -//================================================================================================= -/*! - * SMESHGUI_Preferences_ScalarBarDlg::onLabelsColor - * - * Change Labels color button slot - */ -//================================================================================================= -void SMESHGUI_Preferences_ScalarBarDlg::onLabelsColor() -{ - QColor aColor = myLabelsColorBtn->paletteBackgroundColor(); - aColor = QColorDialog::getColor( aColor, this ); - if ( aColor.isValid() ) - myLabelsColorBtn->setPaletteBackgroundColor( aColor ); -} - //================================================================================================= /*! * SMESHGUI_Preferences_ScalarBarDlg::onSelectionChanged @@ -627,77 +484,75 @@ void SMESHGUI_Preferences_ScalarBarDlg::onLabelsColor() //================================================================================================= void SMESHGUI_Preferences_ScalarBarDlg::onSelectionChanged() { - if (mySelectionMgr) { - SALOME_ListIO aList; - mySelectionMgr->selectedObjects(aList); - - if (aList.Extent() == 1) { - Handle(SALOME_InteractiveObject) anIO = aList.First(); - if( anIO->hasEntry() ) { - SMESH_Actor* anActor = SMESH::FindActorByEntry(anIO->getEntry()); - if ( anActor && anActor->GetScalarBarActor() && anActor->GetControlMode() != SMESH_Actor::eNone ) { - myActor = anActor; - vtkScalarBarActor* myScalarBarActor = myActor->GetScalarBarActor(); - - if ( myScalarBarActor->GetLookupTable() ) { - vtkFloatingPointType *range = myScalarBarActor->GetLookupTable()->GetRange(); - myMinEdit->setText( QString::number( range[0],'g',12 ) ); - myMaxEdit->setText( QString::number( range[1],'g',12 ) ); - } - - vtkTextProperty* aTitleTextPrp = myScalarBarActor->GetTitleTextProperty(); - vtkFloatingPointType aTColor[3]; - aTitleTextPrp->GetColor( aTColor ); - myTitleColorBtn->setPaletteBackgroundColor( QColor( (int)( aTColor[0]*255 ), (int)( aTColor[1]*255 ), (int)( aTColor[2]*255 ) ) ); - myTitleFontCombo->setCurrentItem( aTitleTextPrp->GetFontFamily() ); - myTitleBoldCheck->setChecked( aTitleTextPrp->GetBold() ); - myTitleItalicCheck->setChecked( aTitleTextPrp->GetItalic() ); - myTitleShadowCheck->setChecked( aTitleTextPrp->GetShadow() ); - - vtkTextProperty* aLabelsTextPrp = myScalarBarActor->GetLabelTextProperty(); - vtkFloatingPointType aLColor[3]; - aLabelsTextPrp->GetColor( aLColor ); - myLabelsColorBtn->setPaletteBackgroundColor( QColor( (int)( aLColor[0]*255 ), (int)( aLColor[1]*255 ), (int)( aLColor[2]*255 ) ) ); - myLabelsFontCombo->setCurrentItem( aLabelsTextPrp->GetFontFamily() ); - myLabelsBoldCheck->setChecked( aLabelsTextPrp->GetBold() ); - myLabelsItalicCheck->setChecked( aLabelsTextPrp->GetItalic() ); - myLabelsShadowCheck->setChecked( aLabelsTextPrp->GetShadow() ); - - myLabelsSpin->setValue( myScalarBarActor->GetNumberOfLabels() ); - myColorsSpin->setValue( myScalarBarActor->GetMaximumNumberOfColors() ); - - if ( myScalarBarActor->GetOrientation() == VTK_ORIENT_VERTICAL ) - myVertRadioBtn->setChecked( true ); - else - myHorizRadioBtn->setChecked( true ); - myIniOrientation = myVertRadioBtn->isChecked(); - - myIniX = myScalarBarActor->GetPosition()[0]; - myIniY = myScalarBarActor->GetPosition()[1]; - myIniW = myScalarBarActor->GetWidth(); - myIniH = myScalarBarActor->GetHeight(); - setOriginAndSize( myIniX, myIniY, myIniW, myIniH ); - - myRangeGrp->setEnabled( true ); - myFontGrp->setEnabled( true ); - myLabColorGrp->setEnabled( true ); - myOrientationGrp->setEnabled( true ); - myOriginDimGrp->setEnabled( true ); - myOkBtn->setEnabled( true ); - myApplyBtn->setEnabled( true ); - return; + SALOME_ListIO aList; + mySelectionMgr->selectedObjects(aList); + + if (aList.Extent() == 1) { + Handle(SALOME_InteractiveObject) anIO = aList.First(); + if( anIO->hasEntry() ) { + SMESH_Actor* anActor = SMESH::FindActorByEntry(anIO->getEntry()); + if ( anActor && anActor->GetScalarBarActor() && anActor->GetControlMode() != SMESH_Actor::eNone ) { + myActor = anActor; + vtkScalarBarActor* myScalarBarActor = myActor->GetScalarBarActor(); + + if ( myScalarBarActor->GetLookupTable() ) { + vtkFloatingPointType *range = myScalarBarActor->GetLookupTable()->GetRange(); + myMinEdit->setText( QString::number( range[0],'g',12 ) ); + myMaxEdit->setText( QString::number( range[1],'g',12 ) ); } + + vtkTextProperty* aTitleTextPrp = myScalarBarActor->GetTitleTextProperty(); + vtkFloatingPointType aTColor[3]; + aTitleTextPrp->GetColor( aTColor ); + myTitleColorBtn->setColor( QColor( (int)( aTColor[0]*255 ), (int)( aTColor[1]*255 ), (int)( aTColor[2]*255 ) ) ); + myTitleFontCombo->setCurrentIndex( aTitleTextPrp->GetFontFamily() ); + myTitleBoldCheck->setChecked( aTitleTextPrp->GetBold() ); + myTitleItalicCheck->setChecked( aTitleTextPrp->GetItalic() ); + myTitleShadowCheck->setChecked( aTitleTextPrp->GetShadow() ); + + vtkTextProperty* aLabelsTextPrp = myScalarBarActor->GetLabelTextProperty(); + vtkFloatingPointType aLColor[3]; + aLabelsTextPrp->GetColor( aLColor ); + myLabelsColorBtn->setColor( QColor( (int)( aLColor[0]*255 ), (int)( aLColor[1]*255 ), (int)( aLColor[2]*255 ) ) ); + myLabelsFontCombo->setCurrentIndex( aLabelsTextPrp->GetFontFamily() ); + myLabelsBoldCheck->setChecked( aLabelsTextPrp->GetBold() ); + myLabelsItalicCheck->setChecked( aLabelsTextPrp->GetItalic() ); + myLabelsShadowCheck->setChecked( aLabelsTextPrp->GetShadow() ); + + myLabelsSpin->setValue( myScalarBarActor->GetNumberOfLabels() ); + myColorsSpin->setValue( myScalarBarActor->GetMaximumNumberOfColors() ); + + if ( myScalarBarActor->GetOrientation() == VTK_ORIENT_VERTICAL ) + myVertRadioBtn->setChecked( true ); + else + myHorizRadioBtn->setChecked( true ); + myIniOrientation = myVertRadioBtn->isChecked(); + + myIniX = myScalarBarActor->GetPosition()[0]; + myIniY = myScalarBarActor->GetPosition()[1]; + myIniW = myScalarBarActor->GetWidth(); + myIniH = myScalarBarActor->GetHeight(); + setOriginAndSize( myIniX, myIniY, myIniW, myIniH ); + + myRangeGrp->setEnabled( true ); + myFontGrp->setEnabled( true ); + myLabColorGrp->setEnabled( true ); + myOrientationGrp->setEnabled( true ); + myOriginDimGrp->setEnabled( true ); + myOkBtn->setEnabled( true ); + myApplyBtn->setEnabled( true ); + return; } } - myActor = 0; - myRangeGrp->setEnabled( false ); - myFontGrp->setEnabled( false ); - myLabColorGrp->setEnabled( false ); - myOrientationGrp->setEnabled( false ); - myOriginDimGrp->setEnabled( false ); - myOkBtn->setEnabled( false ); - myApplyBtn->setEnabled( false ); } + myActor = 0; + myRangeGrp->setEnabled( false ); + myFontGrp->setEnabled( false ); + myLabColorGrp->setEnabled( false ); + myOrientationGrp->setEnabled( false ); + myOriginDimGrp->setEnabled( false ); + myOkBtn->setEnabled( false ); + myApplyBtn->setEnabled( false ); } //================================================================================================= @@ -709,8 +564,7 @@ void SMESHGUI_Preferences_ScalarBarDlg::onSelectionChanged() //================================================================================================= void SMESHGUI_Preferences_ScalarBarDlg::closeEvent( QCloseEvent* e ) { - if ( mySelectionMgr ) // "Properties" dialog box - myDlg = 0; + myDlg = 0; QDialog::closeEvent( e ); } @@ -723,8 +577,8 @@ void SMESHGUI_Preferences_ScalarBarDlg::closeEvent( QCloseEvent* e ) //================================================================================================= void SMESHGUI_Preferences_ScalarBarDlg::onXYChanged() { - myWidthSpin->setMaxValue( 1.0 - myXSpin->value() ); - myHeightSpin->setMaxValue( 1.0 - myYSpin->value() ); + myWidthSpin->setMaximum( 1.0 - myXSpin->value() ); + myHeightSpin->setMaximum( 1.0 - myYSpin->value() ); } //================================================================================================= @@ -742,9 +596,9 @@ void SMESHGUI_Preferences_ScalarBarDlg::setOriginAndSize( const double x, blockSignals( true ); myXSpin->setValue( x ); myYSpin->setValue( y ); - myWidthSpin->setMaxValue( 1.0 ); + myWidthSpin->setMaximum( 1.0 ); myWidthSpin->setValue( w ); - myHeightSpin->setMaxValue( 1.0 ); + myHeightSpin->setMaximum( 1.0 ); myHeightSpin->setValue( h ); blockSignals( false ); onXYChanged(); @@ -759,7 +613,7 @@ void SMESHGUI_Preferences_ScalarBarDlg::setOriginAndSize( const double x, //================================================================================================= void SMESHGUI_Preferences_ScalarBarDlg::onOrientationChanged() { - this->initScalarBarFromResources(); + initScalarBarFromResources(); int aOrientation = myVertRadioBtn->isChecked(); if ( aOrientation == myIniOrientation ) diff --git a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h index 78950f7cd..f013b68bb 100644 --- a/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h +++ b/src/SMESHGUI/SMESHGUI_Preferences_ScalarBarDlg.h @@ -1,81 +1,80 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_Preferences_ScalarBarDlg.h +// Author : Nicolas REJNERI, Open CASCADE S.A.S. // -// File : SMESHGUI_Preferences_ScalarBarDlg.h -// Author : Nicolas REJNERI -// Module : SMESH -// $Header$ #ifndef SMESHGUI_PREFERENCES_SCALARBARDLG_H #define SMESHGUI_PREFERENCES_SCALARBARDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include +// Qt includes +#include -class QButtonGroup; class QCheckBox; class QComboBox; class QGroupBox; -class QLabel; class QLineEdit; class QPushButton; class QToolButton; class QRadioButton; class QSpinBox; -class SMESHGUI; - -class QtxDblSpinBox; - -class LightApp_SelectionMgr; +class SMESHGUI; class SMESH_Actor; +class QtxDoubleSpinBox; +class QtxColorButton; +class LightApp_SelectionMgr; class SMESHGUI_EXPORT SMESHGUI_Preferences_ScalarBarDlg : public QDialog { Q_OBJECT +private: + SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI* ); + + static SMESHGUI_Preferences_ScalarBarDlg* myDlg; + public: ~SMESHGUI_Preferences_ScalarBarDlg(); - static void ScalarBarPreferences( SMESHGUI* ); - static void ScalarBarProperties ( SMESHGUI* ); -protected: - SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI*, bool, bool modal = FALSE ); - static SMESHGUI_Preferences_ScalarBarDlg* myDlg; - void closeEvent( QCloseEvent* e ); - void setOriginAndSize( const double x, const double y, const double w, const double h ); - void initScalarBarFromResources(); + static void ScalarBarProperties( SMESHGUI* ); + + void closeEvent( QCloseEvent* ); + void setOriginAndSize( const double, + const double, + const double, + const double ); + void initScalarBarFromResources(); protected slots: - void onOk(); - bool onApply(); - void onCancel(); - void onTitleColor(); - void onLabelsColor(); - void onSelectionChanged(); - void onXYChanged(); - void onOrientationChanged(); + void onOk(); + bool onApply(); + void onCancel(); + void onSelectionChanged(); + void onXYChanged(); + void onOrientationChanged(); private: SMESHGUI* mySMESHGUI; @@ -83,43 +82,43 @@ private: SMESH_Actor* myActor; double myIniX, myIniY, myIniW, myIniH; int myIniOrientation; - double DEF_VER_X,DEF_VER_Y,DEF_VER_H,DEF_VER_W; - double DEF_HOR_X,DEF_HOR_Y,DEF_HOR_H,DEF_HOR_W; - - QGroupBox* myRangeGrp; - QLineEdit* myMinEdit; - QLineEdit* myMaxEdit; - - QGroupBox* myFontGrp; - QToolButton* myTitleColorBtn; - QComboBox* myTitleFontCombo; - QCheckBox* myTitleBoldCheck; - QCheckBox* myTitleItalicCheck; - QCheckBox* myTitleShadowCheck; - QToolButton* myLabelsColorBtn; - QComboBox* myLabelsFontCombo; - QCheckBox* myLabelsBoldCheck; - QCheckBox* myLabelsItalicCheck; - QCheckBox* myLabelsShadowCheck; + double DEF_VER_X, DEF_VER_Y, DEF_VER_H, DEF_VER_W; + double DEF_HOR_X, DEF_HOR_Y, DEF_HOR_H, DEF_HOR_W; + + QGroupBox* myRangeGrp; + QLineEdit* myMinEdit; + QLineEdit* myMaxEdit; + + QGroupBox* myFontGrp; + QtxColorButton* myTitleColorBtn; + QComboBox* myTitleFontCombo; + QCheckBox* myTitleBoldCheck; + QCheckBox* myTitleItalicCheck; + QCheckBox* myTitleShadowCheck; + QtxColorButton* myLabelsColorBtn; + QComboBox* myLabelsFontCombo; + QCheckBox* myLabelsBoldCheck; + QCheckBox* myLabelsItalicCheck; + QCheckBox* myLabelsShadowCheck; - QGroupBox* myLabColorGrp; - QSpinBox* myColorsSpin; - QSpinBox* myLabelsSpin; - - QButtonGroup* myOrientationGrp; - QRadioButton* myVertRadioBtn; - QRadioButton* myHorizRadioBtn; - - QGroupBox* myOriginDimGrp; - QtxDblSpinBox* myXSpin; - QtxDblSpinBox* myYSpin; - QtxDblSpinBox* myWidthSpin; - QtxDblSpinBox* myHeightSpin; - - QGroupBox* myButtonGrp; - QPushButton* myOkBtn; - QPushButton* myApplyBtn; - QPushButton* myCancelBtn; + QGroupBox* myLabColorGrp; + QSpinBox* myColorsSpin; + QSpinBox* myLabelsSpin; + + QGroupBox* myOrientationGrp; + QRadioButton* myVertRadioBtn; + QRadioButton* myHorizRadioBtn; + + QGroupBox* myOriginDimGrp; + QtxDoubleSpinBox* myXSpin; + QtxDoubleSpinBox* myYSpin; + QtxDoubleSpinBox* myWidthSpin; + QtxDoubleSpinBox* myHeightSpin; + + QGroupBox* myButtonGrp; + QPushButton* myOkBtn; + QPushButton* myApplyBtn; + QPushButton* myCancelBtn; }; #endif // SMESHGUI_PREFERENCES_SCALARBARDLG_H diff --git a/src/SMESHGUI/SMESHGUI_Preferences_SelectionDlg.cxx b/src/SMESHGUI/SMESHGUI_Preferences_SelectionDlg.cxx deleted file mode 100644 index 41d96be2d..000000000 --- a/src/SMESHGUI/SMESHGUI_Preferences_SelectionDlg.cxx +++ /dev/null @@ -1,309 +0,0 @@ -// SMESH SMESHGUI : GUI for SMESH component -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SMESHGUI_Preferences_SelectionDlg.cxx -// Author : Natalia KOPNOVA -// Module : SMESH -// $Header$ - -#include "SMESHGUI_Preferences_SelectionDlg.h" -#include "SMESHGUI.h" - -#include "SMESHGUI_Utils.h" - -#include "SUIT_Desktop.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; - -//================================================================================= -// class : SMESHGUI_LineEdit -// purpose : -//================================================================================= -SMESHGUI_LineEdit::SMESHGUI_LineEdit(QWidget* parent, const char *name) - : QLineEdit(parent, name) -{ -} - -SMESHGUI_LineEdit::SMESHGUI_LineEdit(const QString& text, QWidget* parent, const char *name) - : QLineEdit(text, parent, name) -{ -} - -void SMESHGUI_LineEdit::focusOutEvent(QFocusEvent* e) -{ - const QValidator* aVal = validator(); - QString aText = text(); - int aCurPos = cursorPosition(); - if (aVal && aVal->validate(aText, aCurPos) != QValidator::Acceptable) { - QString aValid = aText; - aVal->fixup(aValid); - if (aText != aValid) { - setText(aValid); - update(); - return; - } - } - QLineEdit::focusOutEvent(e); -} - - -//================================================================================= -// class : SMESHGUI_DoubleValidator -// purpose : -//================================================================================= -SMESHGUI_DoubleValidator::SMESHGUI_DoubleValidator(QObject * parent, const char *name) - : QDoubleValidator(parent, name) -{ -} - -SMESHGUI_DoubleValidator::SMESHGUI_DoubleValidator(double bottom, double top, int decimals, - QObject * parent, const char *name) - : QDoubleValidator(bottom, top, decimals, parent, name) -{ -} - -void SMESHGUI_DoubleValidator::fixup(QString& theText) const -{ - bool ok; - double aValue = theText.toDouble(&ok); - if (ok) { - if (aValue < bottom()) - theText = QString::number(bottom(), 'g', decimals()); - if (aValue > top()) - theText = QString::number(top(), 'g', decimals()); - } -} - - -//================================================================================= -// class : SMESHGUI_Preferences_SelectionDlg() -// purpose : -//================================================================================= -SMESHGUI_Preferences_SelectionDlg::SMESHGUI_Preferences_SelectionDlg( SMESHGUI* theModule, const char* name ) - : QDialog( SMESH::GetDesktop( theModule ), name, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ), - mySMESHGUI( theModule ) -{ - if ( !name ) setName( "SMESHGUI_Preferences_SelectionDlg" ); - setCaption( tr( "SMESH_PREF_SELECTION" ) ); - - QVBoxLayout* aMainLayout = new QVBoxLayout(this, 11, 6); - QLabel* aLabel; - - /***************************************************************/ - QGroupBox* aSelectBox = new QGroupBox(4, Qt::Horizontal, this, "selection"); - aSelectBox->setTitle(tr("SMESH_SELECTION")); - - aLabel = new QLabel(aSelectBox, "selection color label"); - aLabel->setText(tr("SMESH_OUTLINE_COLOR")); - myColor[2] = new QPushButton(aSelectBox, "outline color"); - myColor[2]->setFixedSize(QSize(25, 25)); - - aSelectBox->addSpace(0); - aSelectBox->addSpace(0); - - aLabel = new QLabel(aSelectBox, "selection color label"); - aLabel->setText(tr("SMESH_ELEMENTS_COLOR")); - myColor[1] = new QPushButton(aSelectBox, "elements color"); - myColor[1]->setFixedSize(QSize(25, 25)); - - aLabel = new QLabel(aSelectBox, "selection width label"); - aLabel->setText(tr("SMESH_WIDTH")); - myWidth[1] = new QSpinBox(0, 5, 1, aSelectBox, "selection width"); - myWidth[1]->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); - myWidth[1]->setButtonSymbols(QSpinBox::PlusMinus); - myWidth[1]->setMinimumWidth(50); - - /***************************************************************/ - QGroupBox* aPreSelectBox = new QGroupBox(1, Qt::Vertical, this, "preselection"); - aPreSelectBox->setTitle(tr("SMESH_PRESELECTION")); - - aLabel = new QLabel(aPreSelectBox, "preselection color label"); - aLabel->setText(tr("SMESH_HILIGHT_COLOR")); - myColor[0] = new QPushButton(aPreSelectBox, "preselection color"); - myColor[0]->setFixedSize(QSize(25, 25)); - - aLabel = new QLabel(aPreSelectBox, "preselection width label"); - aLabel->setText(tr("SMESH_WIDTH")); - myWidth[0] = new QSpinBox(0, 5, 1, aPreSelectBox, "preselection width"); - myWidth[0]->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); - myWidth[0]->setButtonSymbols(QSpinBox::PlusMinus); - myWidth[0]->setMinimumWidth(50); - - /***************************************************************/ - QGroupBox* aPrecisionBox = new QGroupBox(1, Qt::Vertical, this, "preselection"); - aPrecisionBox->setTitle(tr("SMESH_PRECISION")); - QDoubleValidator* aValidator = new SMESHGUI_DoubleValidator(aPrecisionBox); - aValidator->setBottom(0.001); - aValidator->setDecimals(6); - - aLabel = new QLabel(aPrecisionBox, "node tol label"); - aLabel->setText(tr("SMESH_NODES")); - myPrecision[0] = new SMESHGUI_LineEdit(aPrecisionBox, "node precision"); - myPrecision[0]->setValidator(aValidator); - - aLabel = new QLabel(aPrecisionBox, "item tol label"); - aLabel->setText(tr("SMESH_ELEMENTS")); - myPrecision[1] = new SMESHGUI_LineEdit(aPrecisionBox, "item precision"); - myPrecision[1]->setValidator(aValidator); - - /***************************************************************/ - QFrame* aButtons = new QFrame(this, "button box"); - aButtons->setFrameStyle(QFrame::Box | QFrame::Sunken); - QHBoxLayout* aBtnLayout = new QHBoxLayout(aButtons, 11, 6); - aBtnLayout->setAutoAdd(false); - - QPushButton* aOKBtn = new QPushButton(aButtons, "ok"); - aOKBtn->setText(tr("SMESH_BUT_OK")); - aOKBtn->setAutoDefault(true); - aOKBtn->setDefault(true); - QPushButton* aCloseBtn = new QPushButton(aButtons, "close"); - aCloseBtn->setText(tr("SMESH_BUT_CLOSE")); - aCloseBtn->setAutoDefault(true); - - aBtnLayout->addWidget(aOKBtn); - aBtnLayout->addStretch(); - aBtnLayout->addWidget(aCloseBtn); - - /***************************************************************/ - aMainLayout->addWidget(aSelectBox); - aMainLayout->addWidget(aPreSelectBox); - aMainLayout->addWidget(aPrecisionBox); - aMainLayout->addWidget(aButtons); - - for (int i = 0; i < 3; i++) - connect(myColor[i], SIGNAL(clicked()), this, SLOT(onSelectColor())); - - connect(aOKBtn, SIGNAL(clicked()), this, SLOT(accept())); - connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(reject())); -} - -//================================================================================= -// function : ~SMESHGUI_Preferences_SelectionDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -SMESHGUI_Preferences_SelectionDlg::~SMESHGUI_Preferences_SelectionDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - -//================================================================================= -// function : closeEvent() -// purpose : -//================================================================================= -void SMESHGUI_Preferences_SelectionDlg::closeEvent( QCloseEvent* e ) -{ - reject(); -} - -//================================================================================= -// function : onSelectColor() -// purpose : -//================================================================================= -void SMESHGUI_Preferences_SelectionDlg::onSelectColor() -{ - QPushButton* aSender = (QPushButton*)sender(); - QColor aColor = aSender->palette().active().button(); - aColor = QColorDialog::getColor(aColor, this); - if (aColor.isValid()) { - QPalette aPal = aSender->palette(); - aPal.setColor(QColorGroup::Button, aColor); - aSender->setPalette(aPal); - } -} - -//================================================================================= -// function : SetColor() -// purpose : -//================================================================================= -void SMESHGUI_Preferences_SelectionDlg::SetColor(int type, QColor color) -{ - if (type > 0 && type <= 3) { - QPalette aPal = myColor[type-1]->palette(); - aPal.setColor(QColorGroup::Button, color); - myColor[type-1]->setPalette(aPal); - } -} - -//================================================================================= -// function : GetColor() -// purpose : -//================================================================================= -QColor SMESHGUI_Preferences_SelectionDlg::GetColor(int type) -{ - QColor aColor; - if (type > 0 && type <= 3) - aColor = myColor[type-1]->palette().active().button(); - return aColor; -} - -//================================================================================= -// function : SetWidth() -// purpose : -//================================================================================= -void SMESHGUI_Preferences_SelectionDlg::SetWidth(int type, int value) -{ - if (type > 0 && type <= 2) - myWidth[type-1]->setValue(value); -} - -//================================================================================= -// function : GetWidth() -// purpose : -//================================================================================= -int SMESHGUI_Preferences_SelectionDlg::GetWidth(int type) -{ - if (type > 0 && type <= 2) - return myWidth[type-1]->value(); - return 0; -} - -//================================================================================= -// function : SetPrecision() -// purpose : -//================================================================================= -void SMESHGUI_Preferences_SelectionDlg::SetPrecision(int type, double value) -{ - if (type > 0 && type <= 2) - myPrecision[type-1]->setText(QString::number(value)); -} - -//================================================================================= -// function : GetPrecision() -// purpose : -//================================================================================= -double SMESHGUI_Preferences_SelectionDlg::GetPrecision(int type) -{ - if (type > 0 && type <= 2) - return myPrecision[type-1]->text().toDouble(); - return 0; -} diff --git a/src/SMESHGUI/SMESHGUI_Preferences_SelectionDlg.h b/src/SMESHGUI/SMESHGUI_Preferences_SelectionDlg.h deleted file mode 100644 index 96715d782..000000000 --- a/src/SMESHGUI/SMESHGUI_Preferences_SelectionDlg.h +++ /dev/null @@ -1,101 +0,0 @@ -// SMESH SMESHGUI : GUI for SMESH component -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SMESHGUI_Preferences_SelectionDlg.h -// Author : Natalia KOPNOVA -// Module : SMESH -// $Header$ - -#ifndef SMESHGUI_PREFERENCES_SELECTIONDLG_H -#define SMESHGUI_PREFERENCES_SELECTIONDLG_H - -#include "SMESH_SMESHGUI.hxx" - - -// QT Includes -#include -#include -#include - -class QPushButton; -class QSpinBox; -class QColor; -class SMESHGUI; - -class SMESHGUI_EXPORT SMESHGUI_LineEdit : public QLineEdit -{ - Q_OBJECT - - public: - SMESHGUI_LineEdit(QWidget* parent, const char* name = 0); - SMESHGUI_LineEdit(const QString& text, QWidget* parent, const char* name = 0); - - ~SMESHGUI_LineEdit() {}; - - protected: - void focusOutEvent(QFocusEvent* e); -}; - -class SMESHGUI_EXPORT SMESHGUI_DoubleValidator : public QDoubleValidator -{ - Q_OBJECT - - public: - SMESHGUI_DoubleValidator(QObject* parent, const char* name = 0); - SMESHGUI_DoubleValidator(double bottom, double top, int decimals, - QObject* parent, const char* name = 0); - - ~SMESHGUI_DoubleValidator() {}; - - void fixup(QString& text) const; -}; - -class SMESHGUI_EXPORT SMESHGUI_Preferences_SelectionDlg : public QDialog -{ - Q_OBJECT - -public: - SMESHGUI_Preferences_SelectionDlg( SMESHGUI*, const char* name = 0 ); - ~SMESHGUI_Preferences_SelectionDlg(); - - void SetColor(int type, QColor color); - QColor GetColor(int type); - void SetWidth(int type, int value); - int GetWidth(int type); - void SetPrecision(int type, double value); - double GetPrecision(int type); - -private: - void closeEvent( QCloseEvent* e ) ; - -private slots: - void onSelectColor(); - -private: - SMESHGUI* mySMESHGUI; - QPushButton* myColor[3]; - QSpinBox* myWidth[2]; - QLineEdit* myPrecision[2]; -}; - -#endif // SMESHGUI_PREFERENCES_SELECTIONDLG_H diff --git a/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx b/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx index 77d3940e8..300ab51c2 100644 --- a/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.cxx @@ -1,31 +1,29 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_RemoveElementsDlg.cxx +// Author : Nicolas REJNERI, Open CASCADE S.A.S. // -// -// File : SMESHGUI_RemoveElementsDlg.cxx -// Author : Nicolas REJNERI -// Module : SMESH -// $Header$ +// SMESH includes #include "SMESHGUI_RemoveElementsDlg.h" #include "SMESHGUI.h" @@ -34,161 +32,129 @@ #include "SMESHGUI_MeshUtils.h" #include "SMESHGUI_IdValidator.h" -#include "SMESH_Actor.h" -#include "SMDS_Mesh.hxx" +#include +#include -#include "SUIT_ResourceMgr.h" -#include "SUIT_Desktop.h" -#include "SUIT_Session.h" -#include "SUIT_MessageBox.h" +// SALOME GUI includes +#include +#include +#include +#include -#include "SVTK_Selector.h" -#include "SVTK_ViewModel.h" -#include "SVTK_ViewWindow.h" -#include "SALOME_ListIO.hxx" +#include +#include +#include -#include "SalomeApp_Tools.h" -#include "LightApp_Application.h" -#include "utilities.h" +#include +#include +#include +#include -// OCCT Includes +// OCCT includes #include -#include - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include + +// IDL includes +#include #include CORBA_SERVER_HEADER(SMESH_MeshEditor) +#define SPACING 6 +#define MARGIN 11 + //================================================================================= // class : SMESHGUI_RemoveElementsDlg() // purpose : //================================================================================= SMESHGUI_RemoveElementsDlg -::SMESHGUI_RemoveElementsDlg (SMESHGUI* theModule, - const char* name, - bool modal, - WFlags fl) - : QDialog(SMESH::GetDesktop(theModule), - name, - modal, - WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose), +::SMESHGUI_RemoveElementsDlg(SMESHGUI* theModule) + : QDialog(SMESH::GetDesktop(theModule)), mySelector(SMESH::GetViewWindow(theModule)->GetSelector()), mySelectionMgr(SMESH::GetSelectionMgr(theModule)), mySMESHGUI(theModule), myBusy(false) { - QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_REM_ELEMENT"))); - QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT"))); - - if (!name) - setName("SMESHGUI_RemoveElementsDlg"); - resize(303, 185); - setCaption(tr("SMESH_REMOVE_ELEMENTS_TITLE")); - setSizeGripEnabled(TRUE); - SMESHGUI_RemoveElementsDlgLayout = new QGridLayout(this); - SMESHGUI_RemoveElementsDlgLayout->setSpacing(6); - SMESHGUI_RemoveElementsDlgLayout->setMargin(11); - - /***************************************************************/ - GroupConstructors = new QButtonGroup(this, "GroupConstructors"); - GroupConstructors->setTitle(tr("SMESH_ELEMENTS" )); - GroupConstructors->setExclusive(TRUE); - GroupConstructors->setColumnLayout(0, Qt::Vertical); - GroupConstructors->layout()->setSpacing(0); - GroupConstructors->layout()->setMargin(0); - GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout()); - GroupConstructorsLayout->setAlignment(Qt::AlignTop); - GroupConstructorsLayout->setSpacing(6); - GroupConstructorsLayout->setMargin(11); - Constructor1 = new QRadioButton(GroupConstructors, "Constructor1"); - Constructor1->setText(tr("" )); - Constructor1->setPixmap(image0); - Constructor1->setChecked(TRUE); - Constructor1->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth())); - Constructor1->setMinimumSize(QSize(50, 0)); - GroupConstructorsLayout->addWidget(Constructor1, 0, 0); - QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - GroupConstructorsLayout->addItem(spacer, 0, 1); - SMESHGUI_RemoveElementsDlgLayout->addWidget(GroupConstructors, 0, 0); - - /***************************************************************/ - GroupButtons = new QGroupBox(this, "GroupButtons"); - GroupButtons->setGeometry(QRect(10, 10, 281, 48)); - GroupButtons->setTitle(tr("" )); - GroupButtons->setColumnLayout(0, Qt::Vertical); - GroupButtons->layout()->setSpacing(0); - GroupButtons->layout()->setMargin(0); - GroupButtonsLayout = new QGridLayout(GroupButtons->layout()); - GroupButtonsLayout->setAlignment(Qt::AlignTop); - GroupButtonsLayout->setSpacing(6); - GroupButtonsLayout->setMargin(11); - buttonHelp = new QPushButton(GroupButtons, "buttonHelp"); - buttonHelp->setText(tr("SMESH_BUT_HELP" )); - buttonHelp->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonHelp, 0, 4); - buttonCancel = new QPushButton(GroupButtons, "buttonCancel"); - buttonCancel->setText(tr("SMESH_BUT_CLOSE" )); - buttonCancel->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonCancel, 0, 3); - buttonApply = new QPushButton(GroupButtons, "buttonApply"); - buttonApply->setText(tr("SMESH_BUT_APPLY" )); - buttonApply->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonApply, 0, 1); - QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - GroupButtonsLayout->addItem(spacer_9, 0, 2); - buttonOk = new QPushButton(GroupButtons, "buttonOk"); - buttonOk->setText(tr("SMESH_BUT_OK" )); - buttonOk->setAutoDefault(TRUE); - buttonOk->setDefault(TRUE); - GroupButtonsLayout->addWidget(buttonOk, 0, 0); - SMESHGUI_RemoveElementsDlgLayout->addWidget(GroupButtons, 2, 0); - - /***************************************************************/ - GroupC1 = new QGroupBox(this, "GroupC1"); - GroupC1->setTitle(tr("SMESH_REMOVE" )); - GroupC1->setMinimumSize(QSize(0, 0)); - GroupC1->setFrameShape(QGroupBox::Box); - GroupC1->setFrameShadow(QGroupBox::Sunken); - GroupC1->setColumnLayout(0, Qt::Vertical); - GroupC1->layout()->setSpacing(0); - GroupC1->layout()->setMargin(0); - GroupC1Layout = new QGridLayout(GroupC1->layout()); - GroupC1Layout->setAlignment(Qt::AlignTop); - GroupC1Layout->setSpacing(6); - GroupC1Layout->setMargin(11); - TextLabelC1A1 = new QLabel(GroupC1, "TextLabelC1A1"); - TextLabelC1A1->setText(tr("SMESH_ID_ELEMENTS" )); - TextLabelC1A1->setMinimumSize(QSize(50, 0)); - TextLabelC1A1->setFrameShape(QLabel::NoFrame); - TextLabelC1A1->setFrameShadow(QLabel::Plain); - GroupC1Layout->addWidget(TextLabelC1A1, 0, 0); - SelectButtonC1A1 = new QPushButton(GroupC1, "SelectButtonC1A1"); - SelectButtonC1A1->setText(tr("" )); - SelectButtonC1A1->setPixmap(image1); - SelectButtonC1A1->setToggleButton(FALSE); - GroupC1Layout->addWidget(SelectButtonC1A1, 0, 1); - LineEditC1A1 = new QLineEdit(GroupC1, "LineEditC1A1"); - LineEditC1A1->setValidator(new SMESHGUI_IdValidator(this, "validator")); - GroupC1Layout->addWidget(LineEditC1A1, 0, 2); - SMESHGUI_RemoveElementsDlgLayout->addWidget(GroupC1, 1, 0); - - myHelpFileName = "removing_nodes_and_elements_page.html#removing_elements_anchor"; - - Init(); /* Initialisations */ + setModal( false ); + setAttribute( Qt::WA_DeleteOnClose, true ); + setWindowTitle(tr("SMESH_REMOVE_NODES_TITLE")); + setSizeGripEnabled(true); + + QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_REM_ELEMENT"))); + QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT"))); + + QVBoxLayout* SMESHGUI_RemoveElementsDlgLayout = new QVBoxLayout(this); + SMESHGUI_RemoveElementsDlgLayout->setSpacing(SPACING); + SMESHGUI_RemoveElementsDlgLayout->setMargin(MARGIN); + + /***************************************************************/ + GroupConstructors = new QGroupBox(tr("SMESH_ELEMENTS"), this); + QHBoxLayout* GroupConstructorsLayout = new QHBoxLayout(GroupConstructors); + GroupConstructorsLayout->setSpacing(SPACING); + GroupConstructorsLayout->setMargin(MARGIN); + + Constructor1 = new QRadioButton(GroupConstructors); + Constructor1->setIcon(image0); + Constructor1->setChecked(true); + + GroupConstructorsLayout->addWidget(Constructor1); + GroupConstructorsLayout->addStretch(); + + /***************************************************************/ + GroupC1 = new QGroupBox(tr("SMESH_REMOVE"), this); + QHBoxLayout* GroupC1Layout = new QHBoxLayout(GroupC1); + GroupC1Layout->setSpacing(SPACING); + GroupC1Layout->setMargin(MARGIN); + + TextLabelC1A1 = new QLabel(tr("SMESH_ID_ELEMENTS"), GroupC1); + SelectButtonC1A1 = new QPushButton(GroupC1); + SelectButtonC1A1->setIcon(image1); + LineEditC1A1 = new QLineEdit(GroupC1); + LineEditC1A1->setValidator(new SMESHGUI_IdValidator(this)); + + GroupC1Layout->addWidget(TextLabelC1A1); + GroupC1Layout->addWidget(SelectButtonC1A1); + GroupC1Layout->addWidget(LineEditC1A1); + + /***************************************************************/ + GroupButtons = new QGroupBox(this); + QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons); + GroupButtonsLayout->setSpacing(SPACING); + GroupButtonsLayout->setMargin(MARGIN); + + buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk->setAutoDefault(true); + buttonOk->setDefault(true); + buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); + buttonApply->setAutoDefault(true); + buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons); + buttonCancel->setAutoDefault(true); + buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons); + buttonHelp->setAutoDefault(true); + + GroupButtonsLayout->addWidget(buttonOk); + GroupButtonsLayout->addSpacing(10); + GroupButtonsLayout->addWidget(buttonApply); + GroupButtonsLayout->addSpacing(10); + GroupButtonsLayout->addStretch(); + GroupButtonsLayout->addWidget(buttonCancel); + GroupButtonsLayout->addWidget(buttonHelp); + + /***************************************************************/ + SMESHGUI_RemoveElementsDlgLayout->addWidget(GroupConstructors); + SMESHGUI_RemoveElementsDlgLayout->addWidget(GroupC1); + SMESHGUI_RemoveElementsDlgLayout->addWidget(GroupButtons); + + myHelpFileName = "removing_nodes_and_elements_page.html#removing_elements_anchor"; + + Init(); /* Initialisations */ } //================================================================================= @@ -197,7 +163,6 @@ SMESHGUI_RemoveElementsDlg //================================================================================= SMESHGUI_RemoveElementsDlg::~SMESHGUI_RemoveElementsDlg() { - // no need to delete child widgets, Qt does it all for us } //================================================================================= @@ -206,22 +171,20 @@ SMESHGUI_RemoveElementsDlg::~SMESHGUI_RemoveElementsDlg() //================================================================================= void SMESHGUI_RemoveElementsDlg::Init() { - GroupC1->show(); myConstructorId = 0; - Constructor1->setChecked(TRUE); + Constructor1->setChecked(true); myEditCurrentArgument = LineEditC1A1; - myNbOkElements = false; + myNbOkElements = 0; mySMESHGUI->SetActiveDialogBox((QDialog*)this); myActor = 0; myBusy = false; /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); - connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int))); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); connect(SelectButtonC1A1, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument())); connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); @@ -229,9 +192,7 @@ void SMESHGUI_RemoveElementsDlg::Init() /* to close dialog if study change */ connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); connect(myEditCurrentArgument, SIGNAL(textChanged(const QString&)), - SLOT(onTextChange(const QString&))); - - this->show(); /* displays Dialog */ + SLOT(onTextChange(const QString&))); if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->SetSelectionMode(CellSelection); @@ -239,14 +200,6 @@ void SMESHGUI_RemoveElementsDlg::Init() SelectionIntoArgument(); } -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void SMESHGUI_RemoveElementsDlg::ConstructorsClicked (int) -{ -} - //================================================================================= // function : ClickOnApply() // purpose : @@ -255,8 +208,9 @@ void SMESHGUI_RemoveElementsDlg::ClickOnApply() { if (mySMESHGUI->isActiveStudyLocked()) return; + if (myNbOkElements) { - QStringList aListId = QStringList::split(" ", myEditCurrentArgument->text(), false); + QStringList aListId = myEditCurrentArgument->text().split(" ", QString::SkipEmptyParts); SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array; anArrayOfIdeces->length(aListId.count()); for (int i = 0; i < aListId.count(); i++) @@ -287,10 +241,8 @@ void SMESHGUI_RemoveElementsDlg::ClickOnApply() //================================================================================= void SMESHGUI_RemoveElementsDlg::ClickOnOk() { - this->ClickOnApply(); - this->ClickOnCancel(); - - return; + ClickOnApply(); + ClickOnCancel(); } //================================================================================= @@ -305,7 +257,6 @@ void SMESHGUI_RemoveElementsDlg::ClickOnCancel() disconnect(mySelectionMgr, 0, this, 0); mySMESHGUI->ResetState(); reject(); - return; } //================================================================================= @@ -318,16 +269,17 @@ void SMESHGUI_RemoveElementsDlg::ClickOnHelp() if (app) app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); else { - QString platform; + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName)); } } @@ -335,10 +287,9 @@ void SMESHGUI_RemoveElementsDlg::ClickOnHelp() //function : onTextChange //purpose : //======================================================================= -void SMESHGUI_RemoveElementsDlg::onTextChange (const QString& theNewText) +void SMESHGUI_RemoveElementsDlg::onTextChange(const QString& theNewText) { - if (myBusy) - return; + if (myBusy) return; myBusy = true; myNbOkElements = 0; @@ -353,7 +304,7 @@ void SMESHGUI_RemoveElementsDlg::onTextChange (const QString& theNewText) TColStd_MapOfInteger newIndices; - QStringList aListId = QStringList::split(" ", theNewText, false); + QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts); for (int i = 0; i < aListId.count(); i++) { if(const SMDS_MeshElement *anElem = aMesh->FindElement(aListId[i].toInt())) { newIndices.Add(anElem->GetID()); @@ -440,19 +391,17 @@ void SMESHGUI_RemoveElementsDlg::SelectionIntoArgument() void SMESHGUI_RemoveElementsDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) + switch (myConstructorId) { + case 0: /* default constructor */ { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus(); - myEditCurrentArgument = LineEditC1A1; - } - SelectionIntoArgument(); - break; + if(send == SelectButtonC1A1) { + LineEditC1A1->setFocus(); + myEditCurrentArgument = LineEditC1A1; } + SelectionIntoArgument(); + break; } - return; + } } //================================================================================= @@ -486,7 +435,7 @@ void SMESHGUI_RemoveElementsDlg::ActivateThisDialog() mySMESHGUI->SetActiveDialogBox((QDialog*)this); // ?? if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->SetSelectionMode(NodeSelection); + aViewWindow->SetSelectionMode(CellSelection); SelectionIntoArgument(); // ?? } @@ -495,7 +444,7 @@ void SMESHGUI_RemoveElementsDlg::ActivateThisDialog() // function : enterEvent() // purpose : //================================================================================= -void SMESHGUI_RemoveElementsDlg::enterEvent (QEvent*) +void SMESHGUI_RemoveElementsDlg::enterEvent(QEvent*) { if (!GroupConstructors->isEnabled()) ActivateThisDialog(); @@ -505,18 +454,17 @@ void SMESHGUI_RemoveElementsDlg::enterEvent (QEvent*) // function : closeEvent() // purpose : //================================================================================= -void SMESHGUI_RemoveElementsDlg::closeEvent (QCloseEvent*) +void SMESHGUI_RemoveElementsDlg::closeEvent(QCloseEvent*) { /* same than click on cancel button */ - this->ClickOnCancel(); - return; + ClickOnCancel(); } //======================================================================= //function : hideEvent //purpose : caused by ESC key //======================================================================= -void SMESHGUI_RemoveElementsDlg::hideEvent (QHideEvent * e) +void SMESHGUI_RemoveElementsDlg::hideEvent( QHideEvent* ) { if (!isMinimized()) ClickOnCancel(); @@ -532,9 +480,8 @@ void SMESHGUI_RemoveElementsDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) - { - e->accept(); - ClickOnHelp(); - } + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + ClickOnHelp(); + } } diff --git a/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.h b/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.h index d4f2a90ed..3dfd477ea 100644 --- a/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.h +++ b/src/SMESHGUI/SMESHGUI_RemoveElementsDlg.h @@ -1,46 +1,41 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_RemoveElementsDlg.h +// Author : Nicolas REJNERI, Open CASCADE S.A.S. // -// File : SMESHGUI_RemoveElementsDlg.h -// Author : Nicolas REJNERI -// Module : SMESH -// $Header$ -#ifndef DIALOGBOX_REMOVE_ELEMENTS_H -#define DIALOGBOX_REMOVE_ELEMENTS_H +#ifndef SMESHGUI_REMOVEELEMENTSDLG_H +#define SMESHGUI_REMOVEELEMENTSDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include "LightApp_SelectionMgr.h" +// Qt includes +#include -// QT Includes -#include -#include +// IDL includes +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; class QGroupBox; class QLabel; class QLineEdit; @@ -50,11 +45,7 @@ class QRadioButton; class SMESHGUI; class SMESH_Actor; class SVTK_Selector; -class SVTK_ViewWindow; - -// IDL Headers -#include -#include CORBA_SERVER_HEADER(SMESH_Mesh) +class LightApp_SelectionMgr; //================================================================================= // class : SMESHGUI_RemoveElementsDlg @@ -62,67 +53,55 @@ class SVTK_ViewWindow; //================================================================================= class SMESHGUI_EXPORT SMESHGUI_RemoveElementsDlg : public QDialog { - Q_OBJECT + Q_OBJECT public: - SMESHGUI_RemoveElementsDlg(SMESHGUI* theModule, - const char* name = 0, - bool modal = FALSE, - WFlags fl = 0); - ~SMESHGUI_RemoveElementsDlg(); + SMESHGUI_RemoveElementsDlg( SMESHGUI* ); + ~SMESHGUI_RemoveElementsDlg(); private: - - void Init() ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - void hideEvent ( QHideEvent * ); /* ESC key */ - void keyPressEvent( QKeyEvent* e ); - - LightApp_SelectionMgr* mySelectionMgr; - SVTK_Selector* mySelector; - SMESHGUI* mySMESHGUI; - - int myNbOkElements; /* to check when arguments is defined */ - int myConstructorId; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - bool myBusy; - SMESH::SMESH_Mesh_var myMesh; - SMESH_Actor* myActor; - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QPushButton* buttonHelp; - QGroupBox* GroupC1; - QLabel* TextLabelC1A1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - - QString myHelpFileName; + void Init(); + void closeEvent( QCloseEvent* ); + void enterEvent( QEvent* ); /* mouse enter the QWidget */ + void hideEvent( QHideEvent* ); /* ESC key */ + void keyPressEvent( QKeyEvent* ); + + LightApp_SelectionMgr* mySelectionMgr; + SVTK_Selector* mySelector; + SMESHGUI* mySMESHGUI; + + int myNbOkElements; /* to check when arguments is defined */ + int myConstructorId; /* Current constructor id = radio button id */ + QLineEdit* myEditCurrentArgument; /* Current LineEdit */ + + bool myBusy; + SMESH::SMESH_Mesh_var myMesh; + SMESH_Actor* myActor; + + QGroupBox* GroupConstructors; + QRadioButton* Constructor1; + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QPushButton* buttonApply; + QPushButton* buttonHelp; + QGroupBox* GroupC1; + QLabel* TextLabelC1A1; + QPushButton* SelectButtonC1A1; + QLineEdit* LineEditC1A1; + + QString myHelpFileName; private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void ClickOnHelp(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void onTextChange(const QString&); - -protected: - QGridLayout* SMESHGUI_RemoveElementsDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void ClickOnHelp(); + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void DeactivateActiveDialog(); + void ActivateThisDialog(); + void onTextChange( const QString& ); }; -#endif // DIALOGBOX_REMOVE_ELEMENTS_H +#endif // SMESHGUI_REMOVEELEMENTSDLG_H diff --git a/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx b/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx index 1ceff864d..c12333923 100644 --- a/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.cxx @@ -1,31 +1,29 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_RemoveNodesDlg.cxx +// Author : Nicolas REJNERI, Open CASCADE S.A.S. // -// -// File : SMESHGUI_RemoveNodesDlg.cxx -// Author : Nicolas REJNERI -// Module : SMESH -// $Header$ +// SMESH includes #include "SMESHGUI_RemoveNodesDlg.h" #include "SMESHGUI.h" @@ -34,161 +32,129 @@ #include "SMESHGUI_MeshUtils.h" #include "SMESHGUI_IdValidator.h" -#include "SMESH_Actor.h" -#include "SMDS_Mesh.hxx" - -#include "SUIT_ResourceMgr.h" -#include "SUIT_Desktop.h" -#include "SUIT_Session.h" -#include "SUIT_MessageBox.h" +#include +#include -#include "LightApp_Application.h" +// SALOME GUI includes +#include +#include +#include +#include -#include "SVTK_Selector.h" -#include "SVTK_ViewModel.h" -#include "SVTK_ViewWindow.h" -#include "SALOME_ListIO.hxx" +#include +#include +#include -#include "utilities.h" +#include +#include +#include +#include -// OCCT Includes +// OCCT includes #include -#include - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include + +// IDL includes +#include #include CORBA_SERVER_HEADER(SMESH_MeshEditor) +#define SPACING 6 +#define MARGIN 11 + //================================================================================= // class : SMESHGUI_RemoveNodesDlg() // purpose : //================================================================================= SMESHGUI_RemoveNodesDlg -::SMESHGUI_RemoveNodesDlg(SMESHGUI* theModule, - const char* name, - bool modal, - WFlags fl) - : QDialog(SMESH::GetDesktop(theModule), - name, - modal, - WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose), +::SMESHGUI_RemoveNodesDlg(SMESHGUI* theModule) + : QDialog(SMESH::GetDesktop(theModule)), mySelector(SMESH::GetViewWindow(theModule)->GetSelector()), mySelectionMgr(SMESH::GetSelectionMgr(theModule)), mySMESHGUI(theModule), myBusy(false) { - QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_REM_NODE"))); - QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT"))); - - if (!name) - setName("SMESHGUI_RemoveNodesDlg"); - resize(303, 185); - setCaption(tr("SMESH_REMOVE_NODES_TITLE" )); - setSizeGripEnabled(TRUE); - SMESHGUI_RemoveNodesDlgLayout = new QGridLayout(this); - SMESHGUI_RemoveNodesDlgLayout->setSpacing(6); - SMESHGUI_RemoveNodesDlgLayout->setMargin(11); - - /***************************************************************/ - GroupConstructors = new QButtonGroup(this, "GroupConstructors"); - GroupConstructors->setTitle(tr("SMESH_NODES" )); - GroupConstructors->setExclusive(TRUE); - GroupConstructors->setColumnLayout(0, Qt::Vertical); - GroupConstructors->layout()->setSpacing(0); - GroupConstructors->layout()->setMargin(0); - GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout()); - GroupConstructorsLayout->setAlignment(Qt::AlignTop); - GroupConstructorsLayout->setSpacing(6); - GroupConstructorsLayout->setMargin(11); - Constructor1 = new QRadioButton(GroupConstructors, "Constructor1"); - Constructor1->setText(tr("" )); - Constructor1->setPixmap(image0); - Constructor1->setChecked(TRUE); - Constructor1->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth())); - Constructor1->setMinimumSize(QSize(50, 0)); - GroupConstructorsLayout->addWidget(Constructor1, 0, 0); - QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - GroupConstructorsLayout->addItem(spacer, 0, 1); - SMESHGUI_RemoveNodesDlgLayout->addWidget(GroupConstructors, 0, 0); - - /***************************************************************/ - GroupButtons = new QGroupBox(this, "GroupButtons"); - GroupButtons->setGeometry(QRect(10, 10, 281, 48)); - GroupButtons->setTitle(tr("" )); - GroupButtons->setColumnLayout(0, Qt::Vertical); - GroupButtons->layout()->setSpacing(0); - GroupButtons->layout()->setMargin(0); - GroupButtonsLayout = new QGridLayout(GroupButtons->layout()); - GroupButtonsLayout->setAlignment(Qt::AlignTop); - GroupButtonsLayout->setSpacing(6); - GroupButtonsLayout->setMargin(11); - buttonHelp = new QPushButton(GroupButtons, "buttonHelp"); - buttonHelp->setText(tr("SMESH_BUT_HELP" )); - buttonHelp->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonHelp, 0, 4); - buttonCancel = new QPushButton(GroupButtons, "buttonCancel"); - buttonCancel->setText(tr("SMESH_BUT_CLOSE" )); - buttonCancel->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonCancel, 0, 3); - buttonApply = new QPushButton(GroupButtons, "buttonApply"); - buttonApply->setText(tr("SMESH_BUT_APPLY" )); - buttonApply->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonApply, 0, 1); - QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - GroupButtonsLayout->addItem(spacer_9, 0, 2); - buttonOk = new QPushButton(GroupButtons, "buttonOk"); - buttonOk->setText(tr("SMESH_BUT_OK" )); - buttonOk->setAutoDefault(TRUE); - buttonOk->setDefault(TRUE); - GroupButtonsLayout->addWidget(buttonOk, 0, 0); - SMESHGUI_RemoveNodesDlgLayout->addWidget(GroupButtons, 2, 0); - - /***************************************************************/ - GroupC1 = new QGroupBox(this, "GroupC1"); - GroupC1->setTitle(tr("SMESH_REMOVE" )); - GroupC1->setMinimumSize(QSize(0, 0)); - GroupC1->setFrameShape(QGroupBox::Box); - GroupC1->setFrameShadow(QGroupBox::Sunken); - GroupC1->setColumnLayout(0, Qt::Vertical); - GroupC1->layout()->setSpacing(0); - GroupC1->layout()->setMargin(0); - GroupC1Layout = new QGridLayout(GroupC1->layout()); - GroupC1Layout->setAlignment(Qt::AlignTop); - GroupC1Layout->setSpacing(6); - GroupC1Layout->setMargin(11); - TextLabelC1A1 = new QLabel(GroupC1, "TextLabelC1A1"); - TextLabelC1A1->setText(tr("SMESH_ID_NODES" )); - TextLabelC1A1->setMinimumSize(QSize(50, 0)); - TextLabelC1A1->setFrameShape(QLabel::NoFrame); - TextLabelC1A1->setFrameShadow(QLabel::Plain); - GroupC1Layout->addWidget(TextLabelC1A1, 0, 0); - SelectButtonC1A1 = new QPushButton(GroupC1, "SelectButtonC1A1"); - SelectButtonC1A1->setText(tr("" )); - SelectButtonC1A1->setPixmap(image1); - SelectButtonC1A1->setToggleButton(FALSE); - GroupC1Layout->addWidget(SelectButtonC1A1, 0, 1); - LineEditC1A1 = new QLineEdit(GroupC1, "LineEditC1A1"); - LineEditC1A1->setValidator(new SMESHGUI_IdValidator(this, "validator")); - GroupC1Layout->addWidget(LineEditC1A1, 0, 2); - SMESHGUI_RemoveNodesDlgLayout->addWidget(GroupC1, 1, 0); - - myHelpFileName = "removing_nodes_and_elements_page.html#removing_nodes_anchor"; - - Init(); /* Initialisations */ + setModal( false ); + setAttribute( Qt::WA_DeleteOnClose, true ); + setWindowTitle(tr("SMESH_REMOVE_NODES_TITLE")); + setSizeGripEnabled(true); + + QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_REM_NODE"))); + QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT"))); + + QVBoxLayout* SMESHGUI_RemoveNodesDlgLayout = new QVBoxLayout(this); + SMESHGUI_RemoveNodesDlgLayout->setSpacing(SPACING); + SMESHGUI_RemoveNodesDlgLayout->setMargin(MARGIN); + + /***************************************************************/ + GroupConstructors = new QGroupBox(tr("SMESH_NODES"), this); + QHBoxLayout* GroupConstructorsLayout = new QHBoxLayout(GroupConstructors); + GroupConstructorsLayout->setSpacing(SPACING); + GroupConstructorsLayout->setMargin(MARGIN); + + Constructor1 = new QRadioButton(GroupConstructors); + Constructor1->setIcon(image0); + Constructor1->setChecked(true); + + GroupConstructorsLayout->addWidget(Constructor1); + GroupConstructorsLayout->addStretch(); + + /***************************************************************/ + GroupC1 = new QGroupBox(tr("SMESH_REMOVE"), this); + QHBoxLayout* GroupC1Layout = new QHBoxLayout(GroupC1); + GroupC1Layout->setSpacing(SPACING); + GroupC1Layout->setMargin(MARGIN); + + TextLabelC1A1 = new QLabel(tr("SMESH_ID_NODES"), GroupC1); + SelectButtonC1A1 = new QPushButton(GroupC1); + SelectButtonC1A1->setIcon(image1); + LineEditC1A1 = new QLineEdit(GroupC1); + LineEditC1A1->setValidator(new SMESHGUI_IdValidator(this)); + + GroupC1Layout->addWidget(TextLabelC1A1); + GroupC1Layout->addWidget(SelectButtonC1A1); + GroupC1Layout->addWidget(LineEditC1A1); + + /***************************************************************/ + GroupButtons = new QGroupBox(this); + QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons); + GroupButtonsLayout->setSpacing(SPACING); + GroupButtonsLayout->setMargin(MARGIN); + + buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk->setAutoDefault(true); + buttonOk->setDefault(true); + buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); + buttonApply->setAutoDefault(true); + buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons); + buttonCancel->setAutoDefault(true); + buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons); + buttonHelp->setAutoDefault(true); + + GroupButtonsLayout->addWidget(buttonOk); + GroupButtonsLayout->addSpacing(10); + GroupButtonsLayout->addWidget(buttonApply); + GroupButtonsLayout->addSpacing(10); + GroupButtonsLayout->addStretch(); + GroupButtonsLayout->addWidget(buttonCancel); + GroupButtonsLayout->addWidget(buttonHelp); + + /***************************************************************/ + SMESHGUI_RemoveNodesDlgLayout->addWidget(GroupConstructors); + SMESHGUI_RemoveNodesDlgLayout->addWidget(GroupC1); + SMESHGUI_RemoveNodesDlgLayout->addWidget(GroupButtons); + + myHelpFileName = "removing_nodes_and_elements_page.html#removing_nodes_anchor"; + + Init(); /* Initialisations */ } //================================================================================= @@ -197,7 +163,6 @@ SMESHGUI_RemoveNodesDlg //================================================================================= SMESHGUI_RemoveNodesDlg::~SMESHGUI_RemoveNodesDlg() { - // no need to delete child widgets, Qt does it all for us } //================================================================================= @@ -206,9 +171,8 @@ SMESHGUI_RemoveNodesDlg::~SMESHGUI_RemoveNodesDlg() //================================================================================= void SMESHGUI_RemoveNodesDlg::Init() { - GroupC1->show(); myConstructorId = 0; - Constructor1->setChecked(TRUE); + Constructor1->setChecked(true); myEditCurrentArgument = LineEditC1A1; myNbOkNodes = 0; @@ -217,11 +181,10 @@ void SMESHGUI_RemoveNodesDlg::Init() myBusy = false; /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); - connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int))); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); connect(SelectButtonC1A1, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument())); connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); @@ -231,8 +194,6 @@ void SMESHGUI_RemoveNodesDlg::Init() connect(myEditCurrentArgument, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&))); - this->show(); /* displays Dialog */ - SMESH::SetPointRepresentation(true); if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) @@ -241,14 +202,6 @@ void SMESHGUI_RemoveNodesDlg::Init() SelectionIntoArgument(); } -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void SMESHGUI_RemoveNodesDlg::ConstructorsClicked (int) -{ -} - //================================================================================= // function : ClickOnApply() // purpose : @@ -259,7 +212,7 @@ void SMESHGUI_RemoveNodesDlg::ClickOnApply() return; if (myNbOkNodes) { - QStringList aListId = QStringList::split(" ", myEditCurrentArgument->text(), false); + QStringList aListId = myEditCurrentArgument->text().split(" ", QString::SkipEmptyParts); SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array; anArrayOfIdeces->length(aListId.count()); for (int i = 0; i < aListId.count(); i++) @@ -269,7 +222,11 @@ void SMESHGUI_RemoveNodesDlg::ClickOnApply() try { SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); aResult = aMeshEditor->RemoveNodes(anArrayOfIdeces.inout()); - } catch(...) { + } catch (const SALOME::SALOME_Exception& S_ex) { + SalomeApp_Tools::QtCatchCorbaException(S_ex); + myEditCurrentArgument->clear(); + } catch (...){ + myEditCurrentArgument->clear(); } if (aResult) { @@ -317,16 +274,17 @@ void SMESHGUI_RemoveNodesDlg::ClickOnHelp() if (app) app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); else { - QString platform; + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName)); } } @@ -334,7 +292,7 @@ void SMESHGUI_RemoveNodesDlg::ClickOnHelp() //function : onTextChange //purpose : //======================================================================= -void SMESHGUI_RemoveNodesDlg::onTextChange (const QString& theNewText) +void SMESHGUI_RemoveNodesDlg::onTextChange(const QString& theNewText) { if (myBusy) return; myBusy = true; @@ -351,7 +309,7 @@ void SMESHGUI_RemoveNodesDlg::onTextChange (const QString& theNewText) TColStd_MapOfInteger newIndices; - QStringList aListId = QStringList::split(" ", theNewText, false); + QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts); for (int i = 0; i < aListId.count(); i++) { if (const SMDS_MeshNode *aNode = aMesh->FindNode(aListId[i].toInt())) { newIndices.Add(aNode->GetID()); @@ -438,19 +396,17 @@ void SMESHGUI_RemoveNodesDlg::SelectionIntoArgument() void SMESHGUI_RemoveNodesDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) + switch (myConstructorId) { + case 0: /* default constructor */ { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus(); - myEditCurrentArgument = LineEditC1A1; - } - SelectionIntoArgument(); - break; + if(send == SelectButtonC1A1) { + LineEditC1A1->setFocus(); + myEditCurrentArgument = LineEditC1A1; } + SelectionIntoArgument(); + break; } - return; + } } //================================================================================= @@ -494,7 +450,7 @@ void SMESHGUI_RemoveNodesDlg::ActivateThisDialog() // function : enterEvent() // purpose : //================================================================================= -void SMESHGUI_RemoveNodesDlg::enterEvent (QEvent*) +void SMESHGUI_RemoveNodesDlg::enterEvent(QEvent*) { if (!GroupConstructors->isEnabled()) ActivateThisDialog(); @@ -504,18 +460,17 @@ void SMESHGUI_RemoveNodesDlg::enterEvent (QEvent*) // function : closeEvent() // purpose : //================================================================================= -void SMESHGUI_RemoveNodesDlg::closeEvent (QCloseEvent*) +void SMESHGUI_RemoveNodesDlg::closeEvent(QCloseEvent*) { /* same than click on cancel button */ - this->ClickOnCancel(); - return; + ClickOnCancel(); } //======================================================================= //function : hideEvent //purpose : caused by ESC key //======================================================================= -void SMESHGUI_RemoveNodesDlg::hideEvent (QHideEvent * e) +void SMESHGUI_RemoveNodesDlg::hideEvent( QHideEvent* ) { if (!isMinimized()) ClickOnCancel(); @@ -531,9 +486,8 @@ void SMESHGUI_RemoveNodesDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) - { - e->accept(); - ClickOnHelp(); - } + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + ClickOnHelp(); + } } diff --git a/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.h b/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.h index add873a3a..9e4f2f2c6 100644 --- a/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.h +++ b/src/SMESHGUI/SMESHGUI_RemoveNodesDlg.h @@ -1,49 +1,41 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_RemoveNodesDlg.h +// Author : Nicolas REJNERI, Open CASCADE S.A.S. // -// File : SMESHGUI_RemoveNodesDlg.h -// Author : Nicolas REJNERI -// Module : SMESH -// $Header$ -#ifndef DIALOGBOX_REMOVE_NODES_H -#define DIALOGBOX_REMOVE_NODES_H +#ifndef SMESHGUI_REMOVENODESDLG_H +#define SMESHGUI_REMOVENODESDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include "LightApp_SelectionMgr.h" +// Qt includes +#include -// QT Includes -#include -#include - -// Open CASCADE Includes -#include +// IDL includes +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; class QGroupBox; class QLabel; class QLineEdit; @@ -53,11 +45,7 @@ class QRadioButton; class SMESHGUI; class SMESH_Actor; class SVTK_Selector; -class SVTK_ViewWindow; - -// IDL Headers -#include -#include CORBA_SERVER_HEADER(SMESH_Mesh) +class LightApp_SelectionMgr; //================================================================================= // class : SMESHGUI_RemoveNodesDlg @@ -65,67 +53,55 @@ class SVTK_ViewWindow; //================================================================================= class SMESHGUI_EXPORT SMESHGUI_RemoveNodesDlg : public QDialog { - Q_OBJECT + Q_OBJECT public: - SMESHGUI_RemoveNodesDlg(SMESHGUI* theModule, - const char* name = 0, - bool modal = FALSE, - WFlags fl = 0); - ~SMESHGUI_RemoveNodesDlg(); + SMESHGUI_RemoveNodesDlg( SMESHGUI* ); + ~SMESHGUI_RemoveNodesDlg(); private: - - void Init() ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - void hideEvent ( QHideEvent * ); /* ESC key */ - void keyPressEvent( QKeyEvent* e ); - - LightApp_SelectionMgr* mySelectionMgr; - SVTK_Selector* mySelector; - SMESHGUI* mySMESHGUI; - - int myNbOkNodes; /* to check when arguments is defined */ - int myConstructorId; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - bool myBusy; - SMESH::SMESH_Mesh_var myMesh; - SMESH_Actor* myActor; - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QPushButton* buttonHelp; - QGroupBox* GroupC1; - QLabel* TextLabelC1A1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - - QString myHelpFileName; - + void Init(); + void closeEvent( QCloseEvent* ); + void enterEvent( QEvent* ); /* mouse enter the QWidget */ + void hideEvent( QHideEvent* ); /* ESC key */ + void keyPressEvent( QKeyEvent* ); + + LightApp_SelectionMgr* mySelectionMgr; + SVTK_Selector* mySelector; + SMESHGUI* mySMESHGUI; + + int myNbOkNodes; /* to check when arguments is defined */ + int myConstructorId; /* Current constructor id = radio button id */ + QLineEdit* myEditCurrentArgument; /* Current LineEdit */ + + bool myBusy; + SMESH::SMESH_Mesh_var myMesh; + SMESH_Actor* myActor; + + QGroupBox* GroupConstructors; + QRadioButton* Constructor1; + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QPushButton* buttonApply; + QPushButton* buttonHelp; + QGroupBox* GroupC1; + QLabel* TextLabelC1A1; + QPushButton* SelectButtonC1A1; + QLineEdit* LineEditC1A1; + + QString myHelpFileName; + private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void ClickOnHelp(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void onTextChange(const QString&); - -protected: - QGridLayout* SMESHGUI_RemoveNodesDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void ClickOnHelp(); + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void DeactivateActiveDialog(); + void ActivateThisDialog(); + void onTextChange( const QString& ); }; -#endif // DIALOGBOX_REMOVE_NODES_H +#endif // SMESHGUI_REMOVENODESDLG_H diff --git a/src/SMESHGUI/SMESHGUI_RenumberingDlg.cxx b/src/SMESHGUI/SMESHGUI_RenumberingDlg.cxx index b1cdd6b59..4dc3f240d 100644 --- a/src/SMESHGUI/SMESHGUI_RenumberingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RenumberingDlg.cxx @@ -1,189 +1,159 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_RenumberingDlg.cxx +// Author : Michael ZORIN, Open CASCADE S.A.S. // -// -// File : SMESHGUI_RenumberingDlg.cxx -// Author : Nicolas REJNERI -// Module : SMESH -// $Header$ +// SMESH includes #include "SMESHGUI_RenumberingDlg.h" #include "SMESHGUI.h" #include "SMESHGUI_Utils.h" #include "SMESHGUI_VTKUtils.h" -#include "SMESH_Actor.h" -#include "SMESH_TypeFilter.hxx" -#include "SMDS_Mesh.hxx" - -#include "SUIT_Desktop.h" -#include "SUIT_Session.h" -#include "SUIT_MessageBox.h" - -#include "LightApp_Application.h" - -#include "SALOME_ListIO.hxx" - -#include "utilities.h" - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; - +#include +#include + +// SALOME GUI includes +#include +#include +#include +#include + +#include +#include + +#include + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// IDL includes +#include #include CORBA_SERVER_HEADER(SMESH_MeshEditor) +#define SPACING 6 +#define MARGIN 11 + //================================================================================= // class : SMESHGUI_RenumberingDlg() // purpose : //================================================================================= -SMESHGUI_RenumberingDlg::SMESHGUI_RenumberingDlg( SMESHGUI* theModule, const char* name, - const int unit, bool modal, WFlags fl) - : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | - WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose), - mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) +SMESHGUI_RenumberingDlg::SMESHGUI_RenumberingDlg( SMESHGUI* theModule, const int unit) + : QDialog( SMESH::GetDesktop( theModule ) ), + mySMESHGUI( theModule ), + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) { myUnit = unit; - if (!name) - setName("SMESHGUI_RenumberingDlg"); - resize(303, 185); + setModal(false); + setAttribute(Qt::WA_DeleteOnClose, true); + setWindowTitle(unit == 0 ? + tr("SMESH_RENUMBERING_NODES_TITLE") : + tr("SMESH_RENUMBERING_ELEMENTS_TITLE")); + setSizeGripEnabled(true); - QPixmap image0; - QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("SMESH",tr("ICON_SELECT"))); + SUIT_ResourceMgr* resMgr = SMESH::GetResourceMgr( mySMESHGUI ); + QPixmap image0(resMgr->loadPixmap("SMESH", unit == 0 ? + tr("ICON_DLG_RENUMBERING_NODES") : + tr("ICON_DLG_RENUMBERING_ELEMENTS"))); + QPixmap image1(resMgr->loadPixmap("SMESH",tr("ICON_SELECT"))); - if (unit == 0) { - image0 = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("SMESH",tr("ICON_DLG_RENUMBERING_NODES"))); - setCaption(tr("SMESH_RENUMBERING_NODES_TITLE" )); - } - else if (unit == 1) { - image0 = QPixmap(SUIT_Session::session()->resourceMgr()->loadPixmap("SMESH",tr("ICON_DLG_RENUMBERING_ELEMENTS"))); - setCaption(tr("SMESH_RENUMBERING_ELEMENTS_TITLE" )); - } + QVBoxLayout* SMESHGUI_RenumberingDlgLayout = new QVBoxLayout(this); + SMESHGUI_RenumberingDlgLayout->setSpacing(SPACING); + SMESHGUI_RenumberingDlgLayout->setMargin(MARGIN); + + /***************************************************************/ + QGroupBox* GroupConstructors = new QGroupBox(unit == 0 ? + tr("SMESH_NODES") : + tr("SMESH_ELEMENTS"), + this); + myHelpFileName = unit == 0 ? + "renumbering_nodes_and_elements_page.html#renumbering_nodes_anchor" : + "renumbering_nodes_and_elements_page.html#renumbering_elements_anchor"; + + QHBoxLayout* GroupConstructorsLayout = new QHBoxLayout(GroupConstructors); + GroupConstructorsLayout->setSpacing(SPACING); + GroupConstructorsLayout->setMargin(MARGIN); + + Constructor1 = new QRadioButton(GroupConstructors); + Constructor1->setIcon(image0); + Constructor1->setChecked(true); - setSizeGripEnabled(TRUE); - SMESHGUI_RenumberingDlgLayout = new QGridLayout(this); - SMESHGUI_RenumberingDlgLayout->setSpacing(6); - SMESHGUI_RenumberingDlgLayout->setMargin(11); + GroupConstructorsLayout->addWidget(Constructor1); + GroupConstructorsLayout->addStretch(); /***************************************************************/ - GroupConstructors = new QButtonGroup(this, "GroupConstructors"); - if (unit == 0) { - GroupConstructors->setTitle(tr("SMESH_NODES" )); - myHelpFileName = "renumbering_nodes_and_elements_page.html#renumbering_nodes_anchor"; - } - else if (unit == 1) { - GroupConstructors->setTitle(tr("SMESH_ELEMENTS" )); - myHelpFileName = "renumbering_nodes_and_elements_page.html#renumbering_elements_anchor"; - } - GroupConstructors->setExclusive(TRUE); - GroupConstructors->setColumnLayout(0, Qt::Vertical); - GroupConstructors->layout()->setSpacing(0); - GroupConstructors->layout()->setMargin(0); - GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout()); - GroupConstructorsLayout->setAlignment(Qt::AlignTop); - GroupConstructorsLayout->setSpacing(6); - GroupConstructorsLayout->setMargin(11); - Constructor1 = new QRadioButton(GroupConstructors, "Constructor1"); - Constructor1->setText(tr("" )); - Constructor1->setPixmap(image0); - Constructor1->setChecked(TRUE); - Constructor1->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth())); - Constructor1->setMinimumSize(QSize(50, 0)); - GroupConstructorsLayout->addWidget(Constructor1, 0, 0); - QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - GroupConstructorsLayout->addItem(spacer, 0, 1); - SMESHGUI_RenumberingDlgLayout->addWidget(GroupConstructors, 0, 0); + GroupMesh = new QGroupBox(tr("SMESH_RENUMBERING"), this); + QHBoxLayout* GroupMeshLayout = new QHBoxLayout(GroupMesh); + GroupMeshLayout->setMargin(MARGIN); + GroupMeshLayout->setSpacing(SPACING); + + TextLabelMesh = new QLabel(tr("SMESH_MESH"), GroupMesh); + SelectButton = new QPushButton(GroupMesh); + SelectButton->setIcon(image1); + LineEditMesh = new QLineEdit(GroupMesh); + LineEditMesh->setReadOnly(true); + + GroupMeshLayout->addWidget(TextLabelMesh); + GroupMeshLayout->addWidget(SelectButton); + GroupMeshLayout->addWidget(LineEditMesh); /***************************************************************/ - GroupButtons = new QGroupBox(this, "GroupButtons"); - GroupButtons->setGeometry(QRect(10, 10, 281, 48)); - GroupButtons->setTitle(tr("" )); - GroupButtons->setColumnLayout(0, Qt::Vertical); - GroupButtons->layout()->setSpacing(0); - GroupButtons->layout()->setMargin(0); - GroupButtonsLayout = new QGridLayout(GroupButtons->layout()); - GroupButtonsLayout->setAlignment(Qt::AlignTop); - GroupButtonsLayout->setSpacing(6); - GroupButtonsLayout->setMargin(11); - buttonHelp = new QPushButton(GroupButtons, "buttonHelp"); - buttonHelp->setText(tr("SMESH_BUT_HELP" )); - buttonHelp->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonHelp, 0, 4); - buttonCancel = new QPushButton(GroupButtons, "buttonCancel"); - buttonCancel->setText(tr("SMESH_BUT_CLOSE" )); - buttonCancel->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonCancel, 0, 3); - buttonApply = new QPushButton(GroupButtons, "buttonApply"); - buttonApply->setText(tr("SMESH_BUT_APPLY" )); - buttonApply->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonApply, 0, 1); - QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - GroupButtonsLayout->addItem(spacer_9, 0, 2); - buttonOk = new QPushButton(GroupButtons, "buttonOk"); - buttonOk->setText(tr("SMESH_BUT_OK" )); - buttonOk->setAutoDefault(TRUE); - buttonOk->setDefault(TRUE); - GroupButtonsLayout->addWidget(buttonOk, 0, 0); - SMESHGUI_RenumberingDlgLayout->addWidget(GroupButtons, 2, 0); + GroupButtons = new QGroupBox(this); + QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons); + GroupButtonsLayout->setSpacing(SPACING); + GroupButtonsLayout->setMargin(MARGIN); + + buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk->setAutoDefault(true); + buttonOk->setDefault(true); + buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); + buttonApply->setAutoDefault(true); + buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons); + buttonCancel->setAutoDefault(true); + buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons); + buttonHelp->setAutoDefault(true); + + GroupButtonsLayout->addWidget(buttonOk); + GroupButtonsLayout->addSpacing(10); + GroupButtonsLayout->addWidget(buttonApply); + GroupButtonsLayout->addSpacing(10); + GroupButtonsLayout->addStretch(); + GroupButtonsLayout->addWidget(buttonCancel); + GroupButtonsLayout->addWidget(buttonHelp); /***************************************************************/ - GroupMesh = new QGroupBox(this, "GroupMesh"); - GroupMesh->setTitle(tr("SMESH_RENUMBERING" )); - GroupMesh->setMinimumSize(QSize(0, 0)); - GroupMesh->setFrameShape(QGroupBox::Box); - GroupMesh->setFrameShadow(QGroupBox::Sunken); - GroupMesh->setColumnLayout(0, Qt::Vertical); - GroupMesh->layout()->setSpacing(0); - GroupMesh->layout()->setMargin(0); - GroupMeshLayout = new QGridLayout(GroupMesh->layout()); - GroupMeshLayout->setAlignment(Qt::AlignTop); - GroupMeshLayout->setSpacing(6); - GroupMeshLayout->setMargin(11); - TextLabelMesh = new QLabel(GroupMesh, "TextLabelMesh"); - TextLabelMesh->setText(tr("SMESH_MESH")); - TextLabelMesh->setMinimumSize(QSize(50, 0)); - TextLabelMesh->setFrameShape(QLabel::NoFrame); - TextLabelMesh->setFrameShadow(QLabel::Plain); - GroupMeshLayout->addWidget(TextLabelMesh, 0, 0); - SelectButton = new QPushButton(GroupMesh, "SelectButton"); - SelectButton->setText(tr("" )); - SelectButton->setPixmap(image1); - SelectButton->setToggleButton(FALSE); - GroupMeshLayout->addWidget(SelectButton, 0, 1); - LineEditMesh = new QLineEdit(GroupMesh, "LineEditMesh"); - LineEditMesh->setReadOnly(true); - GroupMeshLayout->addWidget(LineEditMesh, 0, 2); - SMESHGUI_RenumberingDlgLayout->addWidget(GroupMesh, 1, 0); + SMESHGUI_RenumberingDlgLayout->addWidget(GroupConstructors); + SMESHGUI_RenumberingDlgLayout->addWidget(GroupMesh); + SMESHGUI_RenumberingDlgLayout->addWidget(GroupButtons); Init(); /* Initialisations */ } @@ -194,7 +164,6 @@ SMESHGUI_RenumberingDlg::SMESHGUI_RenumberingDlg( SMESHGUI* theModule, const cha //================================================================================= SMESHGUI_RenumberingDlg::~SMESHGUI_RenumberingDlg() { - // no need to delete child widgets, Qt does it all for us } //================================================================================= @@ -203,9 +172,8 @@ SMESHGUI_RenumberingDlg::~SMESHGUI_RenumberingDlg() //================================================================================= void SMESHGUI_RenumberingDlg::Init() { - GroupMesh->show(); myConstructorId = 0; - Constructor1->setChecked(TRUE); + Constructor1->setChecked(true); mySMESHGUI->SetActiveDialogBox((QDialog*)this); myMesh = SMESH::SMESH_Mesh::_nil(); @@ -213,11 +181,10 @@ void SMESHGUI_RenumberingDlg::Init() myMeshFilter = new SMESH_TypeFilter (MESH); /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); - connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int))); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); connect(SelectButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument())); connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); @@ -225,8 +192,6 @@ void SMESHGUI_RenumberingDlg::Init() /* to close dialog if study change */ connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); - this->show(); /* displays Dialog */ - myEditCurrentArgument = LineEditMesh; LineEditMesh->setFocus(); mySelectionMgr->clearFilters(); @@ -235,14 +200,6 @@ void SMESHGUI_RenumberingDlg::Init() SelectionIntoArgument(); } -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void SMESHGUI_RenumberingDlg::ConstructorsClicked (int) -{ -} - //================================================================================= // function : ClickOnApply() // purpose : @@ -252,41 +209,38 @@ void SMESHGUI_RenumberingDlg::ClickOnApply() if (mySMESHGUI->isActiveStudyLocked()) return; - if (!myMesh->_is_nil()) - { - try - { - SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); - SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh); - bool isUnitsLabeled = false; - - if (myUnit == 0 && anActor) { - isUnitsLabeled = anActor->GetPointsLabeled(); - if (isUnitsLabeled) anActor->SetPointsLabeled(false); - } - else if (myUnit == 1 && anActor) { - isUnitsLabeled = anActor->GetCellsLabeled(); - if (isUnitsLabeled) anActor->SetCellsLabeled(false); - } - - QApplication::setOverrideCursor(Qt::waitCursor); - if (myUnit == 0) { - aMeshEditor->RenumberNodes(); - if (isUnitsLabeled && anActor) anActor->SetPointsLabeled(true); - } - else if (myUnit == 1) { - aMeshEditor->RenumberElements(); - if (isUnitsLabeled && anActor) anActor->SetCellsLabeled(true); - } - QApplication::restoreOverrideCursor(); - } - catch(...) - { - } - - //mySelectionMgr->clearSelected(); - SMESH::UpdateView(); + if (!myMesh->_is_nil()) { + try { + SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); + SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh); + bool isUnitsLabeled = false; + + if (myUnit == 0 && anActor) { + isUnitsLabeled = anActor->GetPointsLabeled(); + if (isUnitsLabeled) anActor->SetPointsLabeled(false); + } + else if (myUnit == 1 && anActor) { + isUnitsLabeled = anActor->GetCellsLabeled(); + if (isUnitsLabeled) anActor->SetCellsLabeled(false); + } + + QApplication::setOverrideCursor(Qt::WaitCursor); + if (myUnit == 0) { + aMeshEditor->RenumberNodes(); + if (isUnitsLabeled && anActor) anActor->SetPointsLabeled(true); + } + else if (myUnit == 1) { + aMeshEditor->RenumberElements(); + if (isUnitsLabeled && anActor) anActor->SetCellsLabeled(true); + } + QApplication::restoreOverrideCursor(); + } + catch(...) { } + + //mySelectionMgr->clearSelected(); + SMESH::UpdateView(); + } } //================================================================================= @@ -322,16 +276,17 @@ void SMESHGUI_RenumberingDlg::ClickOnHelp() if (app) app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); else { - QString platform; + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName)); } } @@ -440,7 +395,7 @@ void SMESHGUI_RenumberingDlg::enterEvent(QEvent* e) void SMESHGUI_RenumberingDlg::closeEvent(QCloseEvent* e) { /* same than click on cancel button */ - this->ClickOnCancel(); + ClickOnCancel(); } //======================================================================= @@ -463,9 +418,8 @@ void SMESHGUI_RenumberingDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) - { - e->accept(); - ClickOnHelp(); - } + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + ClickOnHelp(); + } } diff --git a/src/SMESHGUI/SMESHGUI_RenumberingDlg.h b/src/SMESHGUI/SMESHGUI_RenumberingDlg.h index 80338c6bc..5f547aaad 100644 --- a/src/SMESHGUI/SMESHGUI_RenumberingDlg.h +++ b/src/SMESHGUI/SMESHGUI_RenumberingDlg.h @@ -1,57 +1,49 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_RenumberingDlg.h +// Author : Michael ZORIN, Open CASCADE S.A.S. // -// File : SMESHGUI_RenumberingDlg.h -// Author : Michael ZORIN -// Module : SMESH -// $Header: -#ifndef DIALOGBOX_RENUMBERING_H -#define DIALOGBOX_RENUMBERING_H +#ifndef SMESHGUI_RENUMBERINGDLG_H +#define SMESHGUI_RENUMBERINGDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include "LightApp_SelectionMgr.h" -//#include "SMESH_TypeFilter.hxx" -#include "SUIT_SelectionFilter.h" - -// QT Includes -#include +// Qt includes +#include -// Open CASCADE Includes +// IDL includes +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) -class QGridLayout; -class QButtonGroup; class QGroupBox; class QLabel; class QLineEdit; class QPushButton; class QRadioButton; class SMESHGUI; - -// IDL Headers -#include -#include CORBA_SERVER_HEADER(SMESH_Mesh) +class LightApp_SelectionMgr; +class SUIT_SelectionFilter; //================================================================================= // class : SMESHGUI_RenumberingDlg @@ -59,64 +51,52 @@ class SMESHGUI; //================================================================================= class SMESHGUI_EXPORT SMESHGUI_RenumberingDlg : public QDialog { - Q_OBJECT + Q_OBJECT public: - SMESHGUI_RenumberingDlg( SMESHGUI*, - const char* name = 0, - const int unit = 0, - bool modal = FALSE, - WFlags fl = 0); - ~SMESHGUI_RenumberingDlg(); + SMESHGUI_RenumberingDlg( SMESHGUI*, const int = 0 ); + ~SMESHGUI_RenumberingDlg(); private: - void Init(); - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - void hideEvent ( QHideEvent * ); /* ESC key */ - void keyPressEvent( QKeyEvent* e ); - - SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ - LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ - int myConstructorId; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - - int myUnit; - SMESH::SMESH_Mesh_var myMesh; - //Handle(SMESH_TypeFilter) myMeshFilter; - SUIT_SelectionFilter* myMeshFilter; - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QPushButton* buttonHelp; - QGroupBox* GroupMesh; - QLabel* TextLabelMesh; - QPushButton* SelectButton; - QLineEdit* LineEditMesh; - - QString myHelpFileName; + void Init(); + void closeEvent( QCloseEvent* ); + void enterEvent( QEvent* ); /* mouse enter the QWidget */ + void hideEvent( QHideEvent* ); /* ESC key */ + void keyPressEvent( QKeyEvent* ); + + SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ + LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ + int myConstructorId; /* Current constructor id = radio button id */ + QLineEdit* myEditCurrentArgument; /* Current LineEdit */ + + int myUnit; + SMESH::SMESH_Mesh_var myMesh; + //Handle(SMESH_TypeFilter) myMeshFilter; + SUIT_SelectionFilter* myMeshFilter; + + QGroupBox* GroupConstructors; + QRadioButton* Constructor1; + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QPushButton* buttonApply; + QPushButton* buttonHelp; + QGroupBox* GroupMesh; + QLabel* TextLabelMesh; + QPushButton* SelectButton; + QLineEdit* LineEditMesh; + + QString myHelpFileName; private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void ClickOnHelp(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - -protected: - QGridLayout* SMESHGUI_RenumberingDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupMeshLayout; + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void ClickOnHelp(); + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void DeactivateActiveDialog(); + void ActivateThisDialog(); }; -#endif // DIALOGBOX_RENUMBERING_H +#endif // SMESHGUI_RENUMBERINGDLG_H diff --git a/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx b/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx index c10a0898b..108a5f9eb 100644 --- a/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx @@ -1,31 +1,29 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_RevolutionDlg.cxx +// Author : Michael ZORIN, Open CASCADE S.A.S. // -// -// File : SMESHGUI_RevolutionDlg.cxx -// Author : Michael ZORIN -// Module : SMESH -// $Header: +// SMESH includes #include "SMESHGUI_RevolutionDlg.h" #include "SMESHGUI.h" @@ -35,268 +33,214 @@ #include "SMESHGUI_MeshUtils.h" #include "SMESHGUI_IdValidator.h" -#include "SMESH_Actor.h" -#include "SMESH_TypeFilter.hxx" -#include "SMESH_LogicalFilter.hxx" -#include "SMDS_Mesh.hxx" - -#include "SUIT_ResourceMgr.h" -#include "SUIT_Session.h" -#include "SUIT_MessageBox.h" +#include +#include +#include +#include -#include "LightApp_Application.h" +// SALOME GUI includes +#include +#include +#include +#include -#include "SVTK_ViewModel.h" -#include "SVTK_ViewWindow.h" -#include "SVTK_Selector.h" -#include "SVTK_Selection.h" -#include "SALOME_ListIO.hxx" +#include +#include -#include "utilities.h" +#include +#include +#include -// OCCT Includes +// OCCT includes #include -#include - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// IDL Headers -#include "SALOMEconfig.h" + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// IDL includes +#include #include CORBA_SERVER_HEADER(SMESH_Group) #include CORBA_SERVER_HEADER(SMESH_MeshEditor) -using namespace std; +#define SPACING 6 +#define MARGIN 11 //================================================================================= // class : SMESHGUI_RevolutionDlg() // purpose : //================================================================================= -SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule, const char* name, - bool modal, WFlags fl) - : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | - WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose), - mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) +SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule ) + : QDialog( SMESH::GetDesktop( theModule ) ), + mySMESHGUI( theModule ), + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) { SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI ); QPixmap image0 ( mgr->loadPixmap("SMESH", tr("ICON_DLG_EDGE"))); QPixmap image1 ( mgr->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE"))); QPixmap image2 ( mgr->loadPixmap("SMESH", tr("ICON_SELECT"))); - if (!name) - setName("SMESHGUI_RevolutionDlg"); - resize(303, 185); - setCaption(tr("REVOLUTION_AROUND_AXIS")); - setSizeGripEnabled(TRUE); - SMESHGUI_RevolutionDlgLayout = new QGridLayout(this); - SMESHGUI_RevolutionDlgLayout->setSpacing(6); - SMESHGUI_RevolutionDlgLayout->setMargin(11); + setModal(false); + setAttribute(Qt::WA_DeleteOnClose, true); + setWindowTitle(tr("REVOLUTION_AROUND_AXIS")); + setSizeGripEnabled(true); + + QVBoxLayout* SMESHGUI_RevolutionDlgLayout = new QVBoxLayout(this); + SMESHGUI_RevolutionDlgLayout->setSpacing(SPACING); + SMESHGUI_RevolutionDlgLayout->setMargin(MARGIN); /***************************************************************/ - GroupConstructors = new QButtonGroup(this, "GroupConstructors"); - GroupConstructors->setTitle(tr("SMESH_REVOLUTION" )); - GroupConstructors->setExclusive(TRUE); - GroupConstructors->setColumnLayout(0, Qt::Vertical); - GroupConstructors->layout()->setSpacing(0); - GroupConstructors->layout()->setMargin(0); - GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout()); - GroupConstructorsLayout->setAlignment(Qt::AlignTop); - GroupConstructorsLayout->setSpacing(6); - GroupConstructorsLayout->setMargin(11); - RadioButton1= new QRadioButton(GroupConstructors, "RadioButton1"); - RadioButton1->setText(tr("" )); - RadioButton1->setPixmap(image0); - GroupConstructorsLayout->addWidget(RadioButton1, 0, 0); - RadioButton2= new QRadioButton(GroupConstructors, "RadioButton2"); - RadioButton2->setText(tr("" )); - RadioButton2->setPixmap(image1); - GroupConstructorsLayout->addWidget(RadioButton2, 0, 2); - SMESHGUI_RevolutionDlgLayout->addWidget(GroupConstructors, 0, 0); + ConstructorsBox = new QGroupBox(tr("SMESH_REVOLUTION"), this); + GroupConstructors = new QButtonGroup(this); + QHBoxLayout* ConstructorsBoxLayout = new QHBoxLayout(ConstructorsBox); + ConstructorsBoxLayout->setSpacing(SPACING); + ConstructorsBoxLayout->setMargin(MARGIN); + + RadioButton1 = new QRadioButton(ConstructorsBox); + RadioButton1->setIcon(image0); + RadioButton2 = new QRadioButton(ConstructorsBox); + RadioButton2->setIcon(image1); + + ConstructorsBoxLayout->addWidget(RadioButton1); + ConstructorsBoxLayout->addWidget(RadioButton2); + GroupConstructors->addButton(RadioButton1, 0); + GroupConstructors->addButton(RadioButton2, 1); /***************************************************************/ - GroupButtons = new QGroupBox(this, "GroupButtons"); - GroupButtons->setGeometry(QRect(10, 10, 281, 48)); - GroupButtons->setTitle(tr("" )); - GroupButtons->setColumnLayout(0, Qt::Vertical); - GroupButtons->layout()->setSpacing(0); - GroupButtons->layout()->setMargin(0); - GroupButtonsLayout = new QGridLayout(GroupButtons->layout()); - GroupButtonsLayout->setAlignment(Qt::AlignTop); - GroupButtonsLayout->setSpacing(6); - GroupButtonsLayout->setMargin(11); - buttonHelp = new QPushButton(GroupButtons, "buttonHelp"); - buttonHelp->setText(tr("SMESH_BUT_HELP" )); - buttonHelp->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonHelp, 0, 4); - buttonCancel = new QPushButton(GroupButtons, "buttonCancel"); - buttonCancel->setText(tr("SMESH_BUT_CLOSE" )); - buttonCancel->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonCancel, 0, 3); - buttonApply = new QPushButton(GroupButtons, "buttonApply"); - buttonApply->setText(tr("SMESH_BUT_APPLY" )); - buttonApply->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonApply, 0, 1); - QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - GroupButtonsLayout->addItem(spacer_9, 0, 2); - buttonOk = new QPushButton(GroupButtons, "buttonOk"); - buttonOk->setText(tr("SMESH_BUT_OK" )); - buttonOk->setAutoDefault(TRUE); - buttonOk->setDefault(TRUE); - GroupButtonsLayout->addWidget(buttonOk, 0, 0); - SMESHGUI_RevolutionDlgLayout->addWidget(GroupButtons, 2, 0); - - /***************************************************************/ - GroupArguments = new QGroupBox(this, "GroupArguments"); - GroupArguments->setTitle(tr("REVOLUTION_1D")); - GroupArguments->setColumnLayout(0, Qt::Vertical); - GroupArguments->layout()->setSpacing(0); - GroupArguments->layout()->setMargin(0); - GroupArgumentsLayout = new QGridLayout(GroupArguments->layout()); - GroupArgumentsLayout->setAlignment(Qt::AlignTop); - GroupArgumentsLayout->setSpacing(6); - GroupArgumentsLayout->setMargin(11); + GroupArguments = new QGroupBox(tr("REVOLUTION_1D"), this); + QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments); + GroupArgumentsLayout->setSpacing(SPACING); + GroupArgumentsLayout->setMargin(MARGIN); // Controls for elements selection - TextLabelElements = new QLabel(GroupArguments, "TextLabelElements"); - TextLabelElements->setText(tr("SMESH_ID_ELEMENTS" )); - TextLabelElements->setFixedWidth(74); - GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0); - - SelectElementsButton = new QPushButton(GroupArguments, "SelectElementsButton"); - SelectElementsButton->setText(tr("" )); - SelectElementsButton->setPixmap(image2); - SelectElementsButton->setToggleButton(FALSE); - GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1); + TextLabelElements = new QLabel(tr("SMESH_ID_ELEMENTS"), GroupArguments); + + SelectElementsButton = new QPushButton(GroupArguments); + SelectElementsButton->setIcon(image2); - LineEditElements = new QLineEdit(GroupArguments, "LineEditElements"); - LineEditElements->setValidator(new SMESHGUI_IdValidator(this, "validator")); - GroupArgumentsLayout->addWidget(LineEditElements, 0, 2); + LineEditElements = new QLineEdit(GroupArguments); + LineEditElements->setValidator(new SMESHGUI_IdValidator(this)); // Control for the whole mesh selection - CheckBoxMesh = new QCheckBox(GroupArguments, "CheckBoxMesh"); - CheckBoxMesh->setText(tr("SMESH_SELECT_WHOLE_MESH" )); - GroupArgumentsLayout->addMultiCellWidget(CheckBoxMesh, 1, 1, 0, 3); + CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments); // Controls for axis defining - GroupAxis = new QGroupBox(GroupArguments, "GroupAxis"); - GroupAxis->setTitle(tr("SMESH_AXIS")); - GroupAxis->setColumnLayout(0, Qt::Vertical); - GroupAxis->layout()->setSpacing(0); - GroupAxis->layout()->setMargin(0); - QGridLayout* GroupAxisLayout = new QGridLayout(GroupAxis->layout()); - GroupAxisLayout->setAlignment(Qt::AlignTop); - GroupAxisLayout->setSpacing(6); - GroupAxisLayout->setMargin(11); - - TextLabelPoint = new QLabel(GroupAxis, "TextLabelPoint"); - TextLabelPoint->setText(tr("SMESH_POINT")); - GroupAxisLayout->addWidget(TextLabelPoint, 0, 0); - - SelectPointButton = new QPushButton(GroupAxis, "SelectPointButton"); - SelectPointButton->setPixmap(image2); - GroupAxisLayout->addWidget(SelectPointButton, 0, 1); - - TextLabelX = new QLabel(GroupAxis, "TextLabelX"); - TextLabelX->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); - TextLabelX->setText(tr("SMESH_X")); - GroupAxisLayout->addWidget(TextLabelX, 0, 2); - - SpinBox_X = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_X"); - GroupAxisLayout->addWidget(SpinBox_X, 0, 3); - - TextLabelY = new QLabel(GroupAxis, "TextLabelY"); - TextLabelY->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); - TextLabelY->setText(tr("SMESH_Y")); - GroupAxisLayout->addWidget(TextLabelY, 0, 4); - - SpinBox_Y = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_Y"); - GroupAxisLayout->addWidget(SpinBox_Y, 0, 5); - - TextLabelZ = new QLabel(GroupAxis, "TextLabelZ"); - TextLabelZ->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); - TextLabelZ->setText(tr("SMESH_Z")); - GroupAxisLayout->addWidget(TextLabelZ, 0, 6); - - SpinBox_Z = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_Z"); - GroupAxisLayout->addWidget(SpinBox_Z, 0, 7); - - TextLabelVector = new QLabel(GroupAxis, "TextLabelVector"); - TextLabelVector->setText(tr("SMESH_VECTOR")); - GroupAxisLayout->addWidget(TextLabelVector, 1, 0); - - SelectVectorButton = new QPushButton(GroupAxis, "SelectVectorButton"); - SelectVectorButton->setPixmap(image2); + GroupAxis = new QGroupBox(tr("SMESH_AXIS"), GroupArguments); + QGridLayout* GroupAxisLayout = new QGridLayout(GroupAxis); + GroupAxisLayout->setSpacing(SPACING); + GroupAxisLayout->setMargin(MARGIN); + + TextLabelPoint = new QLabel(tr("SMESH_POINT"), GroupAxis); + SelectPointButton = new QPushButton(GroupAxis); + SelectPointButton->setIcon(image2); + + TextLabelX = new QLabel(tr("SMESH_X"), GroupAxis); + SpinBox_X = new SMESHGUI_SpinBox(GroupAxis); + + TextLabelY = new QLabel(tr("SMESH_Y"), GroupAxis); + SpinBox_Y = new SMESHGUI_SpinBox(GroupAxis); + + TextLabelZ = new QLabel(tr("SMESH_Z"), GroupAxis); + SpinBox_Z = new SMESHGUI_SpinBox(GroupAxis); + + TextLabelVector = new QLabel(tr("SMESH_VECTOR"), GroupAxis); + SelectVectorButton = new QPushButton(GroupAxis); + SelectVectorButton->setIcon(image2); + + TextLabelDX = new QLabel(tr("SMESH_DX"), GroupAxis); + SpinBox_DX = new SMESHGUI_SpinBox(GroupAxis); + + TextLabelDY = new QLabel(tr("SMESH_DY"), GroupAxis); + SpinBox_DY = new SMESHGUI_SpinBox(GroupAxis); + + TextLabelDZ = new QLabel(tr("SMESH_DZ"), GroupAxis); + SpinBox_DZ = new SMESHGUI_SpinBox(GroupAxis); + + GroupAxisLayout->addWidget(TextLabelPoint, 0, 0); + GroupAxisLayout->addWidget(SelectPointButton, 0, 1); + GroupAxisLayout->addWidget(TextLabelX, 0, 2); + GroupAxisLayout->addWidget(SpinBox_X, 0, 3); + GroupAxisLayout->addWidget(TextLabelY, 0, 4); + GroupAxisLayout->addWidget(SpinBox_Y, 0, 5); + GroupAxisLayout->addWidget(TextLabelZ, 0, 6); + GroupAxisLayout->addWidget(SpinBox_Z, 0, 7); + GroupAxisLayout->addWidget(TextLabelVector, 1, 0); GroupAxisLayout->addWidget(SelectVectorButton, 1, 1); - - TextLabelDX = new QLabel(GroupAxis, "TextLabelDX"); - TextLabelDX->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); - TextLabelDX->setText(tr("SMESH_DX")); - GroupAxisLayout->addWidget(TextLabelDX, 1, 2); - - SpinBox_DX = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_DX"); - GroupAxisLayout->addWidget(SpinBox_DX, 1, 3); - - TextLabelDY = new QLabel(GroupAxis, "TextLabelDY"); - TextLabelDY->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); - TextLabelDY->setText(tr("SMESH_DY")); - GroupAxisLayout->addWidget(TextLabelDY, 1, 4); - - SpinBox_DY = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_DY"); - GroupAxisLayout->addWidget(SpinBox_DY, 1, 5); - - TextLabelDZ = new QLabel(GroupAxis, "TextLabelDZ"); - TextLabelDZ->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); - TextLabelDZ->setText(tr("SMESH_DZ")); - GroupAxisLayout->addWidget(TextLabelDZ, 1, 6); - - SpinBox_DZ = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_DZ"); - GroupAxisLayout->addWidget(SpinBox_DZ, 1, 7); - - GroupArgumentsLayout->addMultiCellWidget(GroupAxis, 2, 2, 0, 3); + GroupAxisLayout->addWidget(TextLabelDX, 1, 2); + GroupAxisLayout->addWidget(SpinBox_DX, 1, 3); + GroupAxisLayout->addWidget(TextLabelDY, 1, 4); + GroupAxisLayout->addWidget(SpinBox_DY, 1, 5); + GroupAxisLayout->addWidget(TextLabelDZ, 1, 6); + GroupAxisLayout->addWidget(SpinBox_DZ, 1, 7); // Controls for angle defining - TextLabelAngle = new QLabel(GroupArguments, "TextLabelAngle"); - TextLabelAngle->setText(tr("SMESH_ANGLE" )); - GroupArgumentsLayout->addMultiCellWidget(TextLabelAngle, 3, 3, 0, 1); - - SpinBox_Angle = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Angle"); - GroupArgumentsLayout->addWidget(SpinBox_Angle, 3, 2); + TextLabelAngle = new QLabel(tr("SMESH_ANGLE"), GroupArguments); + SpinBox_Angle = new SMESHGUI_SpinBox(GroupArguments); // Controls for nb. steps defining - TextLabelNbSteps = new QLabel(GroupArguments, "TextLabelNbSteps"); - TextLabelNbSteps->setText(tr("SMESH_NUMBEROFSTEPS" )); - GroupArgumentsLayout->addMultiCellWidget(TextLabelNbSteps, 4, 4, 0, 1); - - SpinBox_NbSteps = new QSpinBox(GroupArguments, "SpinBox_NbSteps"); - GroupArgumentsLayout->addWidget(SpinBox_NbSteps, 4, 2); + TextLabelNbSteps = new QLabel(tr("SMESH_NUMBEROFSTEPS"), GroupArguments); + SpinBox_NbSteps = new QSpinBox(GroupArguments); // Controls for tolerance defining - TextLabelTolerance = new QLabel(GroupArguments, "TextLabelTolerance"); - TextLabelTolerance->setText(tr("SMESH_TOLERANCE")); - GroupArgumentsLayout->addMultiCellWidget(TextLabelTolerance, 5, 5, 0, 1); - - SpinBox_Tolerance = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Tolerance"); - GroupArgumentsLayout->addWidget(SpinBox_Tolerance, 5, 2); + TextLabelTolerance = new QLabel(tr("SMESH_TOLERANCE"), GroupArguments); + SpinBox_Tolerance = new SMESHGUI_SpinBox(GroupArguments); // CheckBox for groups generation MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments); MakeGroupsCheck->setChecked(true); - GroupArgumentsLayout->addMultiCellWidget(MakeGroupsCheck, 6, 6, 0, 3); + GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0); + GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1); + GroupArgumentsLayout->addWidget(LineEditElements, 0, 2); + GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 3); + GroupArgumentsLayout->addWidget(GroupAxis, 2, 0, 1, 3); + GroupArgumentsLayout->addWidget(TextLabelAngle, 3, 0, 1, 2); + GroupArgumentsLayout->addWidget(SpinBox_Angle, 3, 2); + GroupArgumentsLayout->addWidget(TextLabelNbSteps, 4, 0, 1, 2); + GroupArgumentsLayout->addWidget(SpinBox_NbSteps, 4, 2); + GroupArgumentsLayout->addWidget(TextLabelTolerance, 5, 0, 1, 2); + GroupArgumentsLayout->addWidget(SpinBox_Tolerance, 5, 2); + GroupArgumentsLayout->addWidget(MakeGroupsCheck, 6, 0, 1, 3); - SMESHGUI_RevolutionDlgLayout->addWidget(GroupArguments, 1, 0); + /***************************************************************/ + GroupButtons = new QGroupBox(this); + QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons); + GroupButtonsLayout->setSpacing(SPACING); + GroupButtonsLayout->setMargin(MARGIN); + + buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk->setAutoDefault(true); + buttonOk->setDefault(true); + buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); + buttonApply->setAutoDefault(true); + buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons); + buttonCancel->setAutoDefault(true); + buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons); + buttonHelp->setAutoDefault(true); + + GroupButtonsLayout->addWidget(buttonOk); + GroupButtonsLayout->addSpacing(10); + GroupButtonsLayout->addWidget(buttonApply); + GroupButtonsLayout->addSpacing(10); + GroupButtonsLayout->addStretch(); + GroupButtonsLayout->addWidget(buttonCancel); + GroupButtonsLayout->addWidget(buttonHelp); + + /***************************************************************/ + SMESHGUI_RevolutionDlgLayout->addWidget(ConstructorsBox); + SMESHGUI_RevolutionDlgLayout->addWidget(GroupArguments); + SMESHGUI_RevolutionDlgLayout->addWidget(GroupButtons); /* Initialisations */ SpinBox_X->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); @@ -308,14 +252,11 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule, const char* SpinBox_Angle->RangeStepAndValidator(COORD_MIN, COORD_MAX, 5.0, 3); - QIntValidator* anIntValidator = new QIntValidator(SpinBox_NbSteps); - SpinBox_NbSteps->setValidator(anIntValidator); SpinBox_NbSteps->setRange(1, 999999); SpinBox_Tolerance->RangeStepAndValidator(0.0, COORD_MAX, 0.1, 6); - GroupArguments->show(); - RadioButton1->setChecked(TRUE); + RadioButton1->setChecked(true); mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); @@ -325,7 +266,7 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule, const char* SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH); SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter (GROUP); - QPtrList aListOfFilters; + QList aListOfFilters; if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter); if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter); @@ -337,15 +278,15 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule, const char* Init(); /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); - connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int))); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); + connect(GroupConstructors, SIGNAL(buttonClicked(int)), SLOT(ConstructorsClicked(int))); - connect(SelectElementsButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument())); - connect(SelectPointButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument())); - connect(SelectVectorButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument())); + connect(SelectElementsButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(SelectPointButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(SelectVectorButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged())); connect(SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged())); @@ -358,11 +299,8 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule, const char* connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&))); connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool))); - this->show(); /* displays Dialog */ - ConstructorsClicked(0); SelectionIntoArgument(); - resize(0,0); // ?? } //================================================================================= @@ -461,7 +399,7 @@ void SMESHGUI_RevolutionDlg::ClickOnApply() return; if (myNbOkElements && IsAxisOk()) { - QStringList aListElementsId = QStringList::split(" ", myElementsId, false); + QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts); SMESH::long_array_var anElementsId = new SMESH::long_array; @@ -484,7 +422,7 @@ void SMESHGUI_RevolutionDlg::ClickOnApply() try { SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); - QApplication::setOverrideCursor(Qt::waitCursor); + QApplication::setOverrideCursor(Qt::WaitCursor); if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) SMESH::ListOfGroups_var groups = @@ -542,16 +480,17 @@ void SMESHGUI_RevolutionDlg::ClickOnHelp() if (app) app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); else { - QString platform; + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName)); } } @@ -583,7 +522,7 @@ void SMESHGUI_RevolutionDlg::onTextChange (const QString& theNewText) TColStd_MapOfInteger newIndices; - QStringList aListId = QStringList::split(" ", theNewText, false); + QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts); for (int i = 0; i < aListId.count(); i++) { const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt()); @@ -832,8 +771,8 @@ void SMESHGUI_RevolutionDlg::SetEditCurrentArgument() //================================================================================= void SMESHGUI_RevolutionDlg::DeactivateActiveDialog() { - if (GroupConstructors->isEnabled()) { - GroupConstructors->setEnabled(false); + if (ConstructorsBox->isEnabled()) { + ConstructorsBox->setEnabled(false); GroupArguments->setEnabled(false); GroupButtons->setEnabled(false); mySMESHGUI->ResetState(); @@ -849,7 +788,7 @@ void SMESHGUI_RevolutionDlg::ActivateThisDialog() { /* Emit a signal to deactivate the active dialog */ mySMESHGUI->EmitSignalDeactivateDialog(); - GroupConstructors->setEnabled(true); + ConstructorsBox->setEnabled(true); GroupArguments->setEnabled(true); GroupButtons->setEnabled(true); @@ -865,7 +804,7 @@ void SMESHGUI_RevolutionDlg::ActivateThisDialog() //================================================================================= void SMESHGUI_RevolutionDlg::enterEvent (QEvent*) { - if (!GroupConstructors->isEnabled()) + if (!ConstructorsBox->isEnabled()) ActivateThisDialog(); } @@ -876,7 +815,7 @@ void SMESHGUI_RevolutionDlg::enterEvent (QEvent*) void SMESHGUI_RevolutionDlg::closeEvent (QCloseEvent*) { /* same than click on cancel button */ - this->ClickOnCancel(); + ClickOnCancel(); } //======================================================================= @@ -939,9 +878,7 @@ void SMESHGUI_RevolutionDlg::onSelectMesh (bool toSelectMesh) //================================================================================= int SMESHGUI_RevolutionDlg::GetConstructorId() { - if (GroupConstructors != NULL && GroupConstructors->selected() != NULL) - return GroupConstructors->id(GroupConstructors->selected()); - return -1; + return GroupConstructors->checkedId(); } //================================================================================= @@ -980,9 +917,8 @@ void SMESHGUI_RevolutionDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) - { - e->accept(); - ClickOnHelp(); - } + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + ClickOnHelp(); + } } diff --git a/src/SMESHGUI/SMESHGUI_RevolutionDlg.h b/src/SMESHGUI/SMESHGUI_RevolutionDlg.h index 389c380a1..3e2ed3a71 100644 --- a/src/SMESHGUI/SMESHGUI_RevolutionDlg.h +++ b/src/SMESHGUI/SMESHGUI_RevolutionDlg.h @@ -1,44 +1,41 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_RevolutionDlg.h +// Author : Michael ZORIN, Open CASCADE S.A.S. // -// File : SMESHGUI_RevolutionDlg.h -// Author : Michael ZORIN -// Module : SMESH -// $Header: -#ifndef DIALOGBOX_REVOLUTION_H -#define DIALOGBOX_REVOLUTION_H +#ifndef SMESHGUI_REVOLUTIONDLG_H +#define SMESHGUI_REVOLUTIONDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include "LightApp_SelectionMgr.h" - -#include "SMESH_LogicalFilter.hxx" +// Qt includes +#include -// QT Includes -#include +// IDL includes +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) -class QGridLayout; class QButtonGroup; class QGroupBox; class QLabel; @@ -50,15 +47,9 @@ class QSpinBox; class SMESHGUI_SpinBox; class SMESHGUI; class SMESH_Actor; -class SMESHGUI_SpinBox; -class SVTK_ViewWindow; class SVTK_Selector; - - -// IDL Headers -#include -#include CORBA_SERVER_HEADER(SMESH_Mesh) - +class LightApp_SelectionMgr; +class SMESH_LogicalFilter; //================================================================================= // class : SMESHGUI_RevolutionDlg @@ -66,98 +57,89 @@ class SVTK_Selector; //================================================================================= class SMESHGUI_EXPORT SMESHGUI_RevolutionDlg : public QDialog { - Q_OBJECT + Q_OBJECT public: - SMESHGUI_RevolutionDlg (SMESHGUI*, - const char* name = 0, - bool modal = FALSE, - WFlags fl = 0); - ~SMESHGUI_RevolutionDlg(); + SMESHGUI_RevolutionDlg( SMESHGUI* ); + ~SMESHGUI_RevolutionDlg(); private: - void Init (bool ResetControls = true); - void closeEvent (QCloseEvent*); - void enterEvent (QEvent*); /* mouse enter the QWidget */ - void hideEvent (QHideEvent*); /* ESC key */ - void keyPressEvent(QKeyEvent*); - int GetConstructorId(); - bool IsAxisOk(); - - SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ - LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ - int myNbOkElements; /* to check when elements are defined */ - QString myElementsId; - QWidget* myEditCurrentArgument; /* Current argument */ - SVTK_Selector* mySelector; - - bool myBusy; - SMESH::SMESH_Mesh_var myMesh; - SMESH_Actor* myActor; - SMESH_LogicalFilter* myMeshOrSubMeshOrGroupFilter; - - QButtonGroup* GroupConstructors; - QRadioButton* RadioButton1; - QRadioButton* RadioButton2; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QPushButton* buttonHelp; - QGroupBox* GroupArguments; - QGroupBox* GroupAxis; - QLabel* TextLabelElements; - QPushButton* SelectElementsButton; - QLineEdit* LineEditElements; - QCheckBox* CheckBoxMesh; - QCheckBox* MakeGroupsCheck; - - QLabel* TextLabelPoint; - QPushButton* SelectPointButton; - QLabel* TextLabelX; - SMESHGUI_SpinBox* SpinBox_X; - QLabel* TextLabelY; - SMESHGUI_SpinBox* SpinBox_Y; - QLabel* TextLabelZ; - SMESHGUI_SpinBox* SpinBox_Z; - QLabel* TextLabelVector; - QPushButton* SelectVectorButton; - QLabel* TextLabelDX; - SMESHGUI_SpinBox* SpinBox_DX; - QLabel* TextLabelDY; - SMESHGUI_SpinBox* SpinBox_DY; - QLabel* TextLabelDZ; - SMESHGUI_SpinBox* SpinBox_DZ; - - QLabel* TextLabelAngle; - SMESHGUI_SpinBox* SpinBox_Angle; - QLabel* TextLabelNbSteps; - QSpinBox* SpinBox_NbSteps; - QLabel* TextLabelTolerance; - SMESHGUI_SpinBox* SpinBox_Tolerance; - - QString myHelpFileName; - + void Init( bool = true); + void closeEvent( QCloseEvent* ); + void enterEvent( QEvent* ); /* mouse enter the QWidget */ + void hideEvent( QHideEvent* ); /* ESC key */ + void keyPressEvent( QKeyEvent* ); + int GetConstructorId(); + bool IsAxisOk(); + + SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ + LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ + int myNbOkElements; /* to check when elements are defined */ + QString myElementsId; + QWidget* myEditCurrentArgument; /* Current argument */ + SVTK_Selector* mySelector; + + bool myBusy; + SMESH::SMESH_Mesh_var myMesh; + SMESH_Actor* myActor; + SMESH_LogicalFilter* myMeshOrSubMeshOrGroupFilter; + + QGroupBox* ConstructorsBox; + QButtonGroup* GroupConstructors; + QRadioButton* RadioButton1; + QRadioButton* RadioButton2; + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QPushButton* buttonApply; + QPushButton* buttonHelp; + QGroupBox* GroupArguments; + QGroupBox* GroupAxis; + QLabel* TextLabelElements; + QPushButton* SelectElementsButton; + QLineEdit* LineEditElements; + QCheckBox* CheckBoxMesh; + QCheckBox* MakeGroupsCheck; + + QLabel* TextLabelPoint; + QPushButton* SelectPointButton; + QLabel* TextLabelX; + SMESHGUI_SpinBox* SpinBox_X; + QLabel* TextLabelY; + SMESHGUI_SpinBox* SpinBox_Y; + QLabel* TextLabelZ; + SMESHGUI_SpinBox* SpinBox_Z; + QLabel* TextLabelVector; + QPushButton* SelectVectorButton; + QLabel* TextLabelDX; + SMESHGUI_SpinBox* SpinBox_DX; + QLabel* TextLabelDY; + SMESHGUI_SpinBox* SpinBox_DY; + QLabel* TextLabelDZ; + SMESHGUI_SpinBox* SpinBox_DZ; + + QLabel* TextLabelAngle; + SMESHGUI_SpinBox* SpinBox_Angle; + QLabel* TextLabelNbSteps; + QSpinBox* SpinBox_NbSteps; + QLabel* TextLabelTolerance; + SMESHGUI_SpinBox* SpinBox_Tolerance; + + QString myHelpFileName; + private slots: - - void ConstructorsClicked (int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void ClickOnHelp(); - void SetEditCurrentArgument(); - void SelectionIntoArgument(); - void DeactivateActiveDialog(); - void ActivateThisDialog(); - void onTextChange (const QString&); - void onSelectMesh (bool toSelectMesh); - void onVectorChanged(); - -protected: - QGridLayout* SMESHGUI_RevolutionDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupArgumentsLayout; + void ConstructorsClicked( int ); + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void ClickOnHelp(); + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void DeactivateActiveDialog(); + void ActivateThisDialog(); + void onTextChange( const QString& ); + void onSelectMesh( bool ); + void onVectorChanged(); }; -#endif // DIALOGBOX_REVOLUTION_H +#endif // SMESHGUI_REVOLUTIONDLG_H diff --git a/src/SMESHGUI/SMESHGUI_RotationDlg.cxx b/src/SMESHGUI/SMESHGUI_RotationDlg.cxx index d587855d3..d0ec0fb7a 100644 --- a/src/SMESHGUI/SMESHGUI_RotationDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RotationDlg.cxx @@ -1,31 +1,29 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_RotationDlg.cxx +// Author : Michael ZORIN, Open CASCADE S.A.S. // -// -// File : SMESHGUI_RotationDlg.cxx -// Author : Michael ZORIN -// Module : SMESH -// $Header: +// SMESH includes #include "SMESHGUI_RotationDlg.h" #include "SMESHGUI.h" @@ -35,269 +33,215 @@ #include "SMESHGUI_MeshUtils.h" #include "SMESHGUI_IdValidator.h" -#include "SMESH_Actor.h" -#include "SMESH_TypeFilter.hxx" -#include "SMESH_LogicalFilter.hxx" -#include "SMDS_Mesh.hxx" +#include +#include +#include +#include -#include "SUIT_Desktop.h" -#include "SUIT_Session.h" -#include "SUIT_MessageBox.h" +// SALOME GUI includes +#include +#include +#include +#include -#include "LightApp_Application.h" +#include +#include -#include "SVTK_ViewModel.h" -#include "SVTK_ViewWindow.h" -#include "SVTK_Selector.h" -#include "SVTK_Selection.h" -#include "SALOME_ListIO.hxx" -#include "SALOMEDSClient_SObject.hxx" +#include +#include +#include -#include "utilities.h" +// SALOME KERNEL includes +#include -// OCCT Includes +// OCCT includes #include -#include - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// IDL Headers -#include "SALOMEconfig.h" + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// IDL includes +#include #include CORBA_SERVER_HEADER(SMESH_Group) #include CORBA_SERVER_HEADER(SMESH_MeshEditor) -using namespace std; - enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action type +#define SPACING 8 +#define MARGIN 11 + //================================================================================= // class : SMESHGUI_RotationDlg() // purpose : //================================================================================= -SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule, const char* name, - bool modal, WFlags fl) - : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | - WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose), - mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) +SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule ) + : QDialog( SMESH::GetDesktop( theModule ) ), + mySMESHGUI( theModule ), + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) { QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_MESH_ROTATION"))); QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT"))); - if (!name) - setName("SMESHGUI_RotationDlg"); - resize(303, 185); - setCaption(tr("SMESH_ROTATION_TITLE")); - setSizeGripEnabled(TRUE); - SMESHGUI_RotationDlgLayout = new QGridLayout(this); - SMESHGUI_RotationDlgLayout->setSpacing(6); - SMESHGUI_RotationDlgLayout->setMargin(11); + setModal(false); + setAttribute(Qt::WA_DeleteOnClose, true); + setWindowTitle(tr("SMESH_ROTATION_TITLE")); + setSizeGripEnabled(true); - /***************************************************************/ - GroupConstructors = new QButtonGroup(this, "GroupConstructors"); - GroupConstructors->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)5, - (QSizePolicy::SizeType)0, 0, 0, - GroupConstructors->sizePolicy().hasHeightForWidth())); - GroupConstructors->setTitle(tr("SMESH_ROTATION")); - GroupConstructors->setExclusive(TRUE); - GroupConstructors->setColumnLayout(0, Qt::Vertical); - GroupConstructors->layout()->setSpacing(0); - GroupConstructors->layout()->setMargin(0); - GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout()); - GroupConstructorsLayout->setAlignment(Qt::AlignTop); - GroupConstructorsLayout->setSpacing(6); - GroupConstructorsLayout->setMargin(11); - RadioButton1= new QRadioButton(GroupConstructors, "RadioButton1"); - RadioButton1->setText(tr("" )); - RadioButton1->setPixmap(image0); - RadioButton1->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)1, - (QSizePolicy::SizeType)0, - RadioButton1->sizePolicy().hasHeightForWidth())); - RadioButton1->setMinimumSize(QSize(50, 0)); - GroupConstructorsLayout->addWidget(RadioButton1, 0, 0); - QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - GroupConstructorsLayout->addItem(spacer, 0, 1); - SMESHGUI_RotationDlgLayout->addWidget(GroupConstructors, 0, 0); + QVBoxLayout* SMESHGUI_RotationDlgLayout = new QVBoxLayout(this); + SMESHGUI_RotationDlgLayout->setSpacing(SPACING); + SMESHGUI_RotationDlgLayout->setMargin(MARGIN); /***************************************************************/ - GroupButtons = new QGroupBox(this, "GroupButtons"); - GroupButtons->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)7, - (QSizePolicy::SizeType)0, 0, 0, - GroupButtons->sizePolicy().hasHeightForWidth())); - GroupButtons->setGeometry(QRect(10, 10, 281, 48)); - GroupButtons->setTitle(tr("" )); - GroupButtons->setColumnLayout(0, Qt::Vertical); - GroupButtons->layout()->setSpacing(0); - GroupButtons->layout()->setMargin(0); - GroupButtonsLayout = new QGridLayout(GroupButtons->layout()); - GroupButtonsLayout->setAlignment(Qt::AlignTop); - GroupButtonsLayout->setSpacing(6); - GroupButtonsLayout->setMargin(11); - buttonHelp = new QPushButton(GroupButtons, "buttonHelp"); - buttonHelp->setText(tr("SMESH_BUT_HELP" )); - buttonHelp->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonHelp, 0, 4); - buttonCancel = new QPushButton(GroupButtons, "buttonCancel"); - buttonCancel->setText(tr("SMESH_BUT_CLOSE")); - buttonCancel->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonCancel, 0, 3); - buttonApply = new QPushButton(GroupButtons, "buttonApply"); - buttonApply->setText(tr("SMESH_BUT_APPLY")); - buttonApply->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonApply, 0, 1); - QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - GroupButtonsLayout->addItem(spacer_9, 0, 2); - buttonOk = new QPushButton(GroupButtons, "buttonOk"); - buttonOk->setText(tr("SMESH_BUT_OK")); - buttonOk->setAutoDefault(TRUE); - buttonOk->setDefault(TRUE); - GroupButtonsLayout->addWidget(buttonOk, 0, 0); - SMESHGUI_RotationDlgLayout->addWidget(GroupButtons, 2, 0); + GroupConstructors = new QGroupBox(tr("SMESH_ROTATION"), this); + QHBoxLayout* GroupConstructorsLayout = new QHBoxLayout(GroupConstructors); + GroupConstructorsLayout->setSpacing(SPACING); + GroupConstructorsLayout->setMargin(MARGIN); + + RadioButton1= new QRadioButton(GroupConstructors); + RadioButton1->setIcon(image0); + + GroupConstructorsLayout->addWidget(RadioButton1); + GroupConstructorsLayout->addStretch(); /***************************************************************/ - GroupArguments = new QGroupBox(this, "GroupArguments"); - GroupArguments->setTitle(tr("SMESH_ARGUMENTS")); - GroupArguments->setColumnLayout(0, Qt::Vertical); - GroupArguments->layout()->setSpacing(0); - GroupArguments->layout()->setMargin(0); - GroupArgumentsLayout = new QGridLayout(GroupArguments->layout()); - GroupArgumentsLayout->setAlignment(Qt::AlignTop); - GroupArgumentsLayout->setSpacing(6); - GroupArgumentsLayout->setMargin(11); + GroupArguments = new QGroupBox(tr("SMESH_ARGUMENTS"), this); + QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments); + GroupArgumentsLayout->setSpacing(SPACING); + GroupArgumentsLayout->setMargin(MARGIN); // Controls for elements selection - TextLabelElements = new QLabel(GroupArguments, "TextLabelElements"); - TextLabelElements->setText(tr("SMESH_ID_ELEMENTS" )); - //TextLabelElements->setFixedWidth(74); - GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0); - - SelectElementsButton = new QPushButton(GroupArguments, "SelectElementsButton"); - SelectElementsButton->setText(tr("" )); - SelectElementsButton->setPixmap(image1); - SelectElementsButton->setToggleButton(FALSE); - GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1); - - LineEditElements = new QLineEdit(GroupArguments, "LineEditElements"); - LineEditElements->setValidator(new SMESHGUI_IdValidator(this, "validator")); - GroupArgumentsLayout->addMultiCellWidget(LineEditElements, 0, 0, 2, 3); + TextLabelElements = new QLabel(tr("SMESH_ID_ELEMENTS"), GroupArguments); + SelectElementsButton = new QPushButton(GroupArguments); + SelectElementsButton->setIcon(image1); + LineEditElements = new QLineEdit(GroupArguments); + LineEditElements->setValidator(new SMESHGUI_IdValidator(this)); // Control for the whole mesh selection - CheckBoxMesh = new QCheckBox(GroupArguments, "CheckBoxMesh"); - CheckBoxMesh->setText(tr("SMESH_SELECT_WHOLE_MESH" )); - GroupArgumentsLayout->addMultiCellWidget(CheckBoxMesh, 1, 1, 0, 3); + CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments); // Controls for axis defining - GroupAxis = new QGroupBox(GroupArguments, "GroupAxis"); - GroupAxis->setTitle(tr("SMESH_AXIS")); - GroupAxis->setColumnLayout(0, Qt::Vertical); - GroupAxis->layout()->setSpacing(0); - GroupAxis->layout()->setMargin(0); - QGridLayout* GroupAxisLayout = new QGridLayout(GroupAxis->layout()); - GroupAxisLayout->setAlignment(Qt::AlignTop); - GroupAxisLayout->setSpacing(6); - GroupAxisLayout->setMargin(11); - - TextLabelPoint = new QLabel(GroupAxis, "TextLabelPoint"); - TextLabelPoint->setText(tr("SMESH_POINT")); - GroupAxisLayout->addWidget(TextLabelPoint, 0, 0); - - SelectPointButton = new QPushButton(GroupAxis, "SelectPointButton"); - SelectPointButton->setPixmap(image1); - GroupAxisLayout->addWidget(SelectPointButton, 0, 1); - - TextLabelX = new QLabel(GroupAxis, "TextLabelX"); - TextLabelX->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); - TextLabelX->setText(tr("SMESH_X")); - GroupAxisLayout->addWidget(TextLabelX, 0, 2); - - SpinBox_X = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_X"); - GroupAxisLayout->addWidget(SpinBox_X, 0, 3); - - TextLabelY = new QLabel(GroupAxis, "TextLabelY"); - TextLabelY->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); - TextLabelY->setText(tr("SMESH_Y")); - GroupAxisLayout->addWidget(TextLabelY, 0, 4); - - SpinBox_Y = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_Y"); - GroupAxisLayout->addWidget(SpinBox_Y, 0, 5); - - TextLabelZ = new QLabel(GroupAxis, "TextLabelZ"); - TextLabelZ->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); - TextLabelZ->setText(tr("SMESH_Z")); - GroupAxisLayout->addWidget(TextLabelZ, 0, 6); - - SpinBox_Z = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_Z"); - GroupAxisLayout->addWidget(SpinBox_Z, 0, 7); - - TextLabelVector = new QLabel(GroupAxis, "TextLabelVector"); - TextLabelVector->setText(tr("SMESH_VECTOR")); - GroupAxisLayout->addWidget(TextLabelVector, 1, 0); - - SelectVectorButton = new QPushButton(GroupAxis, "SelectVectorButton"); - SelectVectorButton->setPixmap(image1); + GroupAxis = new QGroupBox(tr("SMESH_AXIS"), GroupArguments); + QGridLayout* GroupAxisLayout = new QGridLayout(GroupAxis); + GroupAxisLayout->setSpacing(SPACING); + GroupAxisLayout->setMargin(MARGIN); + + TextLabelPoint = new QLabel(tr("SMESH_POINT"), GroupAxis); + SelectPointButton = new QPushButton(GroupAxis); + SelectPointButton->setIcon(image1); + + TextLabelX = new QLabel(tr("SMESH_X"), GroupAxis); + SpinBox_X = new SMESHGUI_SpinBox(GroupAxis); + TextLabelY = new QLabel(tr("SMESH_Y"), GroupAxis); + SpinBox_Y = new SMESHGUI_SpinBox(GroupAxis); + TextLabelZ = new QLabel(tr("SMESH_Z"), GroupAxis); + SpinBox_Z = new SMESHGUI_SpinBox(GroupAxis); + + TextLabelVector = new QLabel(tr("SMESH_VECTOR"), GroupAxis); + SelectVectorButton = new QPushButton(GroupAxis); + SelectVectorButton->setIcon(image1); + + TextLabelDX = new QLabel(tr("SMESH_DX"), GroupAxis); + SpinBox_DX = new SMESHGUI_SpinBox(GroupAxis); + TextLabelDY = new QLabel(tr("SMESH_DY"), GroupAxis); + SpinBox_DY = new SMESHGUI_SpinBox(GroupAxis); + TextLabelDZ = new QLabel(tr("SMESH_DZ"), GroupAxis); + SpinBox_DZ = new SMESHGUI_SpinBox(GroupAxis); + + GroupAxisLayout->addWidget(TextLabelPoint, 0, 0); + GroupAxisLayout->addWidget(SelectPointButton, 0, 1); + GroupAxisLayout->addWidget(TextLabelX, 0, 2); + GroupAxisLayout->addWidget(SpinBox_X, 0, 3); + GroupAxisLayout->addWidget(TextLabelY, 0, 4); + GroupAxisLayout->addWidget(SpinBox_Y, 0, 5); + GroupAxisLayout->addWidget(TextLabelZ, 0, 6); + GroupAxisLayout->addWidget(SpinBox_Z, 0, 7); + GroupAxisLayout->addWidget(TextLabelVector, 1, 0); GroupAxisLayout->addWidget(SelectVectorButton, 1, 1); - - TextLabelDX = new QLabel(GroupAxis, "TextLabelDX"); - TextLabelDX->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); - TextLabelDX->setText(tr("SMESH_DX")); - GroupAxisLayout->addWidget(TextLabelDX, 1, 2); - - SpinBox_DX = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_DX"); - GroupAxisLayout->addWidget(SpinBox_DX, 1, 3); - - TextLabelDY = new QLabel(GroupAxis, "TextLabelDY"); - TextLabelDY->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); - TextLabelDY->setText(tr("SMESH_DY")); - GroupAxisLayout->addWidget(TextLabelDY, 1, 4); - - SpinBox_DY = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_DY"); - GroupAxisLayout->addWidget(SpinBox_DY, 1, 5); - - TextLabelDZ = new QLabel(GroupAxis, "TextLabelDZ"); - TextLabelDZ->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); - TextLabelDZ->setText(tr("SMESH_DZ")); - GroupAxisLayout->addWidget(TextLabelDZ, 1, 6); - - SpinBox_DZ = new SMESHGUI_SpinBox(GroupAxis, "SpinBox_DZ"); - GroupAxisLayout->addWidget(SpinBox_DZ, 1, 7); - - GroupArgumentsLayout->addMultiCellWidget(GroupAxis, 2, 2, 0, 3); + GroupAxisLayout->addWidget(TextLabelDX, 1, 2); + GroupAxisLayout->addWidget(SpinBox_DX, 1, 3); + GroupAxisLayout->addWidget(TextLabelDY, 1, 4); + GroupAxisLayout->addWidget(SpinBox_DY, 1, 5); + GroupAxisLayout->addWidget(TextLabelDZ, 1, 6); + GroupAxisLayout->addWidget(SpinBox_DZ, 1, 7); // Controls for angle defining - TextLabelAngle = new QLabel(GroupArguments, "TextLabelAngle"); - TextLabelAngle->setText(tr("SMESH_ANGLE")); - GroupArgumentsLayout->addMultiCellWidget(TextLabelAngle, 3, 3, 0, 2); - - SpinBox_Angle = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_Angle"); - GroupArgumentsLayout->addWidget(SpinBox_Angle, 3, 2); + TextLabelAngle = new QLabel(tr("SMESH_ANGLE"), GroupArguments); + SpinBox_Angle = new SMESHGUI_SpinBox(GroupArguments); // action switch - ActionGroup = new QButtonGroup(1, Qt::Horizontal, GroupArguments, "ActionGroup"); - ActionGroup->setExclusive(true); - ActionGroup->insert(new QRadioButton(tr("SMESH_MOVE_ELEMENTS"),ActionGroup), MOVE_ELEMS_BUTTON); - ActionGroup->insert(new QRadioButton(tr("SMESH_COPY_ELEMENTS"),ActionGroup), COPY_ELEMS_BUTTON); - ActionGroup->insert(new QRadioButton(tr("SMESH_CREATE_MESH" ),ActionGroup), MAKE_MESH_BUTTON); - GroupArgumentsLayout->addMultiCellWidget(ActionGroup, 4, 6, 0, 2); + ActionBox = new QGroupBox(tr("ACTION"), GroupArguments); + ActionGroup = new QButtonGroup(GroupArguments); + QVBoxLayout* ActionBoxLayout = new QVBoxLayout(ActionBox); + ActionBoxLayout->setSpacing(SPACING); + ActionBoxLayout->setMargin(MARGIN); + + QRadioButton* aMoveElements = new QRadioButton(tr("SMESH_MOVE_ELEMENTS"), ActionBox); + QRadioButton* aCopyElements = new QRadioButton(tr("SMESH_COPY_ELEMENTS"), ActionBox); + QRadioButton* aCreateMesh = new QRadioButton(tr("SMESH_CREATE_MESH"), ActionBox); + + ActionBoxLayout->addWidget(aMoveElements); + ActionBoxLayout->addWidget(aCopyElements); + ActionBoxLayout->addWidget(aCreateMesh); + ActionGroup->addButton(aMoveElements, MOVE_ELEMS_BUTTON); + ActionGroup->addButton(aCopyElements, COPY_ELEMS_BUTTON); + ActionGroup->addButton(aCreateMesh, MAKE_MESH_BUTTON); // CheckBox for groups generation MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments); - GroupArgumentsLayout->addWidget(MakeGroupsCheck, 5, 3); // Name of a mesh to create - LineEditNewMesh = new QLineEdit(GroupArguments, "LineEditNewMesh"); - GroupArgumentsLayout->addWidget(LineEditNewMesh, 6, 3); + LineEditNewMesh = new QLineEdit(GroupArguments); + + GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0); + GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1); + GroupArgumentsLayout->addWidget(LineEditElements, 0, 2, 1, 2); + GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 4); + GroupArgumentsLayout->addWidget(GroupAxis, 2, 0, 1, 4); + GroupArgumentsLayout->addWidget(TextLabelAngle, 3, 0, 1, 2); + GroupArgumentsLayout->addWidget(SpinBox_Angle, 3, 2); + GroupArgumentsLayout->addWidget(ActionBox, 4, 0, 3, 3); + GroupArgumentsLayout->addWidget(MakeGroupsCheck, 5, 3); + GroupArgumentsLayout->addWidget(LineEditNewMesh, 6, 3); + + /***************************************************************/ + GroupButtons = new QGroupBox(this); + QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons); + GroupButtonsLayout->setSpacing(SPACING); + GroupButtonsLayout->setMargin(MARGIN); + + buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk->setAutoDefault(true); + buttonOk->setDefault(true); + buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); + buttonApply->setAutoDefault(true); + buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons); + buttonCancel->setAutoDefault(true); + buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons); + buttonHelp->setAutoDefault(true); + + GroupButtonsLayout->addWidget(buttonOk); + GroupButtonsLayout->addSpacing(10); + GroupButtonsLayout->addWidget(buttonApply); + GroupButtonsLayout->addSpacing(10); + GroupButtonsLayout->addStretch(); + GroupButtonsLayout->addWidget(buttonCancel); + GroupButtonsLayout->addWidget(buttonHelp); - SMESHGUI_RotationDlgLayout->addWidget(GroupArguments, 1, 0); + /***************************************************************/ + SMESHGUI_RotationDlgLayout->addWidget(GroupConstructors); + SMESHGUI_RotationDlgLayout->addWidget(GroupArguments); + SMESHGUI_RotationDlgLayout->addWidget(GroupButtons); /* Initialisations */ SpinBox_X->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); @@ -309,9 +253,8 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule, const char* nam SpinBox_Angle->RangeStepAndValidator(-360.0, +360.0, 5.0, 3); - GroupArguments->show(); myConstructorId = 0; - RadioButton1->setChecked(TRUE); + RadioButton1->setChecked(true); mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); @@ -321,7 +264,7 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule, const char* nam SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH); SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter (GROUP); - QPtrList aListOfFilters; + QList aListOfFilters; if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter); if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter); @@ -337,7 +280,6 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule, const char* nam connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); - connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int))); connect(SelectElementsButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument())); connect(SelectPointButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument())); @@ -353,14 +295,9 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule, const char* nam connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&))); connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool))); - connect(ActionGroup, SIGNAL(clicked(int)), SLOT(onActionClicked(int))); + connect(ActionGroup, SIGNAL(buttonClicked(int)), SLOT(onActionClicked(int))); - this->show(); /* displays Dialog */ - - ConstructorsClicked(0); - //SelectionIntoArgument(); onActionClicked(MOVE_ELEMS_BUTTON); - resize(0,0); // ?? } //================================================================================= @@ -369,7 +306,6 @@ SMESHGUI_RotationDlg::SMESHGUI_RotationDlg( SMESHGUI* theModule, const char* nam //================================================================================= SMESHGUI_RotationDlg::~SMESHGUI_RotationDlg() { - // no need to delete child widgets, Qt does it all for us } //================================================================================= @@ -401,7 +337,7 @@ void SMESHGUI_RotationDlg::Init (bool ResetControls) SpinBox_Angle->SetValue(45); - ((QRadioButton*) ActionGroup->find( MOVE_ELEMS_BUTTON ))->setChecked(TRUE); + ActionGroup->button( MOVE_ELEMS_BUTTON )->setChecked(true); CheckBoxMesh->setChecked(false); // MakeGroupsCheck->setChecked(false); // MakeGroupsCheck->setEnabled(false); @@ -411,14 +347,6 @@ void SMESHGUI_RotationDlg::Init (bool ResetControls) onSelectMesh(CheckBoxMesh->isChecked()); } -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void SMESHGUI_RotationDlg::ConstructorsClicked (int constructorId) -{ -} - //================================================================================= // function : ClickOnApply() // purpose : @@ -429,7 +357,7 @@ void SMESHGUI_RotationDlg::ClickOnApply() return; if (myNbOkElements && IsAxisOk()) { - QStringList aListElementsId = QStringList::split(" ", myElementsId, false); + QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts); SMESH::long_array_var anElementsId = new SMESH::long_array; @@ -447,11 +375,11 @@ void SMESHGUI_RotationDlg::ClickOnApply() anAxis.vz = SpinBox_DZ->GetValue(); double anAngle = (SpinBox_Angle->GetValue())*PI/180; - int actionButton = ActionGroup->id( ActionGroup->selected() ); + int actionButton = ActionGroup->checkedId(); bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ); try { SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); - QApplication::setOverrideCursor(Qt::waitCursor); + QApplication::setOverrideCursor(Qt::WaitCursor); switch ( actionButton ) { case MOVE_ELEMS_BUTTON: aMeshEditor->Rotate(anElementsId, anAxis, anAngle, false); @@ -466,7 +394,7 @@ void SMESHGUI_RotationDlg::ClickOnApply() case MAKE_MESH_BUTTON: SMESH::SMESH_Mesh_var mesh = aMeshEditor->RotateMakeMesh(anElementsId, anAxis, anAngle, makeGroups, - LineEditNewMesh->text().latin1()); + LineEditNewMesh->text().toLatin1().data()); } QApplication::restoreOverrideCursor(); } catch (...) { @@ -477,7 +405,6 @@ void SMESHGUI_RotationDlg::ClickOnApply() actionButton == MAKE_MESH_BUTTON ) mySMESHGUI->updateObjBrowser(true); // new groups may appear Init(false); - //ConstructorsClicked(GetConstructorId()); SelectionIntoArgument(); } } @@ -518,16 +445,17 @@ void SMESHGUI_RotationDlg::ClickOnHelp() if (app) app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); else { - QString platform; + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName)); } } @@ -559,7 +487,7 @@ void SMESHGUI_RotationDlg::onTextChange (const QString& theNewText) TColStd_MapOfInteger newIndices; - QStringList aListId = QStringList::split(" ", theNewText, false); + QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts); for (int i = 0; i < aListId.count(); i++) { const SMDS_MeshElement * e = aMesh->FindElement(aListId[ i ].toInt()); if (e) @@ -636,7 +564,7 @@ void SMESHGUI_RotationDlg::SelectionIntoArgument() MakeGroupsCheck->setChecked(false); MakeGroupsCheck->setEnabled(false); } - else if ( ActionGroup->id( ActionGroup->selected() ) != MOVE_ELEMS_BUTTON ) { + else if ( ActionGroup->checkedId() != MOVE_ELEMS_BUTTON ) { MakeGroupsCheck->setEnabled(true); } if (CheckBoxMesh->isChecked()) { @@ -830,7 +758,7 @@ void SMESHGUI_RotationDlg::enterEvent (QEvent*) void SMESHGUI_RotationDlg::closeEvent (QCloseEvent*) { /* same than click on cancel button */ - this->ClickOnCancel(); + ClickOnCancel(); } //================================================================================= @@ -951,10 +879,10 @@ void SMESHGUI_RotationDlg::setNewMeshName() } else { _PTR(SObject) meshSO = SMESH::FindSObject( myMesh ); - name = meshSO->GetName(); + name = meshSO->GetName().c_str(); } if ( !name.isEmpty() ) - LineEditNewMesh->setText( SMESH::UniqueMeshName( name.latin1(), "rotated")); + LineEditNewMesh->setText( SMESH::UniqueMeshName( name, "rotated")); } } @@ -968,9 +896,8 @@ void SMESHGUI_RotationDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) - { - e->accept(); - ClickOnHelp(); - } + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + ClickOnHelp(); + } } diff --git a/src/SMESHGUI/SMESHGUI_RotationDlg.h b/src/SMESHGUI/SMESHGUI_RotationDlg.h index 51a5e141a..fe311fffb 100644 --- a/src/SMESHGUI/SMESHGUI_RotationDlg.h +++ b/src/SMESHGUI/SMESHGUI_RotationDlg.h @@ -1,44 +1,41 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_RotationDlg.h +// Author : Michael ZORIN, Open CASCADE S.A.S. // -// File : SMESHGUI_RotationDlg.h -// Author : Michael ZORIN -// Module : SMESH -// $Header: -#ifndef DIALOGBOX_ROTATION_H -#define DIALOGBOX_ROTATION_H +#ifndef SMESHGUI_ROTATIONDLG_H +#define SMESHGUI_ROTATIONDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include "LightApp_SelectionMgr.h" - -#include "SMESH_LogicalFilter.hxx" +// Qt includes +#include -// QT Includes -#include +// IDL includes +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) -class QGridLayout; class QButtonGroup; class QGroupBox; class QLabel; @@ -46,18 +43,12 @@ class QLineEdit; class QPushButton; class QRadioButton; class QCheckBox; -class SMESHGUI_SpinBox; class SMESHGUI; class SMESH_Actor; class SMESHGUI_SpinBox; -class SVTK_ViewWindow; class SVTK_Selector; - - -// IDL Headers -#include -#include CORBA_SERVER_HEADER(SMESH_Mesh) - +class LightApp_SelectionMgr; +class SMESH_LogicalFilter; //================================================================================= // class : SMESHGUI_RotationDlg @@ -65,98 +56,88 @@ class SVTK_Selector; //================================================================================= class SMESHGUI_EXPORT SMESHGUI_RotationDlg : public QDialog { - Q_OBJECT + Q_OBJECT public: - SMESHGUI_RotationDlg( SMESHGUI*, - const char* name = 0, - bool modal = FALSE, - WFlags fl = 0); - ~SMESHGUI_RotationDlg(); + SMESHGUI_RotationDlg( SMESHGUI* ); + ~SMESHGUI_RotationDlg(); private: - void Init (bool ResetControls = true); - void closeEvent (QCloseEvent*); - void enterEvent (QEvent*); /* mouse enter the QWidget */ - void hideEvent (QHideEvent*); /* ESC key */ - void keyPressEvent(QKeyEvent*); - bool IsAxisOk(); - void setNewMeshName(); - - SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ - LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ - int myNbOkElements; /* to check when elements are defined */ - QString myElementsId; - SVTK_Selector* mySelector; - - QWidget* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId; - bool myBusy; - SMESH::SMESH_Mesh_var myMesh; - SMESH_Actor* myActor; - SMESH_LogicalFilter* myMeshOrSubMeshOrGroupFilter; - - QButtonGroup* GroupConstructors; - QRadioButton* RadioButton1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QPushButton* buttonHelp; - QGroupBox* GroupArguments; - QGroupBox* GroupAxis; - QLabel* TextLabelElements; - QPushButton* SelectElementsButton; - QLineEdit* LineEditElements; - QCheckBox* CheckBoxMesh; - - QLabel* TextLabelPoint; - QPushButton* SelectPointButton; - QLabel* TextLabelX; - SMESHGUI_SpinBox* SpinBox_X; - QLabel* TextLabelY; - SMESHGUI_SpinBox* SpinBox_Y; - QLabel* TextLabelZ; - SMESHGUI_SpinBox* SpinBox_Z; - QLabel* TextLabelVector; - QPushButton* SelectVectorButton; - QLabel* TextLabelDX; - SMESHGUI_SpinBox* SpinBox_DX; - QLabel* TextLabelDY; - SMESHGUI_SpinBox* SpinBox_DY; - QLabel* TextLabelDZ; - SMESHGUI_SpinBox* SpinBox_DZ; - - QLabel* TextLabelAngle; - SMESHGUI_SpinBox* SpinBox_Angle; - //QCheckBox* CheckBoxCopy; - QButtonGroup* ActionGroup; - QCheckBox* MakeGroupsCheck; - QLineEdit* LineEditNewMesh; - - QString myHelpFileName; + void Init( bool = true ); + void closeEvent( QCloseEvent* ); + void enterEvent( QEvent* ); /* mouse enter the QWidget */ + void hideEvent( QHideEvent* ); /* ESC key */ + void keyPressEvent( QKeyEvent* ); + bool IsAxisOk(); + void setNewMeshName(); + + SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ + LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ + int myNbOkElements; /* to check when elements are defined */ + QString myElementsId; + SVTK_Selector* mySelector; + + QWidget* myEditCurrentArgument; /* Current LineEdit */ + int myConstructorId; + bool myBusy; + SMESH::SMESH_Mesh_var myMesh; + SMESH_Actor* myActor; + SMESH_LogicalFilter* myMeshOrSubMeshOrGroupFilter; + + QGroupBox* GroupConstructors; + QRadioButton* RadioButton1; + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QPushButton* buttonApply; + QPushButton* buttonHelp; + QGroupBox* GroupArguments; + QGroupBox* GroupAxis; + QLabel* TextLabelElements; + QPushButton* SelectElementsButton; + QLineEdit* LineEditElements; + QCheckBox* CheckBoxMesh; + + QLabel* TextLabelPoint; + QPushButton* SelectPointButton; + QLabel* TextLabelX; + SMESHGUI_SpinBox* SpinBox_X; + QLabel* TextLabelY; + SMESHGUI_SpinBox* SpinBox_Y; + QLabel* TextLabelZ; + SMESHGUI_SpinBox* SpinBox_Z; + QLabel* TextLabelVector; + QPushButton* SelectVectorButton; + QLabel* TextLabelDX; + SMESHGUI_SpinBox* SpinBox_DX; + QLabel* TextLabelDY; + SMESHGUI_SpinBox* SpinBox_DY; + QLabel* TextLabelDZ; + SMESHGUI_SpinBox* SpinBox_DZ; + + QLabel* TextLabelAngle; + SMESHGUI_SpinBox* SpinBox_Angle; + //QCheckBox* CheckBoxCopy; + QGroupBox* ActionBox; + QButtonGroup* ActionGroup; + QCheckBox* MakeGroupsCheck; + QLineEdit* LineEditNewMesh; + + QString myHelpFileName; private slots: - - void ConstructorsClicked (int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void ClickOnHelp(); - void SetEditCurrentArgument(); - void SelectionIntoArgument(); - void DeactivateActiveDialog(); - void ActivateThisDialog(); - void onTextChange (const QString&); - void onSelectMesh (bool toSelectMesh); - void onVectorChanged(); - void onActionClicked(int button); - -protected: - QGridLayout* SMESHGUI_RotationDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupArgumentsLayout; + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void ClickOnHelp(); + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void DeactivateActiveDialog(); + void ActivateThisDialog(); + void onTextChange( const QString& ); + void onSelectMesh( bool ); + void onVectorChanged(); + void onActionClicked( int ); }; -#endif // DIALOGBOX_ROTATION_H +#endif // SMESHGUI_ROTATIONDLG_H diff --git a/src/SMESHGUI/SMESHGUI_SMESHGenUtils.cxx b/src/SMESHGUI/SMESHGUI_SMESHGenUtils.cxx deleted file mode 100644 index b215ee1d7..000000000 --- a/src/SMESHGUI/SMESHGUI_SMESHGenUtils.cxx +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com - - -#include "QAD_Desktop.h" - -#include "SMESHGUI_SMESHGenUtils.h" - -#include "SALOMEconfig.h" -#include CORBA_CLIENT_HEADER(SALOMEDS) - -namespace SMESH -{ - - SMESH::SMESH_Gen_var GetSMESHGen() - { - static SMESH::SMESH_Gen_var aSMESHGen; - if(CORBA::is_nil(aSMESHGen)){ - if(QAD_Desktop* aDesktop = QAD_Application::getDesktop()){ - Engines::Component_var aComponent = aDesktop->getEngine("FactoryServer","SMESH"); - aSMESHGen = SMESH::SMESH_Gen::_narrow(aComponent); - } - } - return aSMESHGen; - } - -} diff --git a/src/SMESHGUI/SMESHGUI_SMESHGenUtils.h b/src/SMESHGUI/SMESHGUI_SMESHGenUtils.h deleted file mode 100644 index 8f7c2a075..000000000 --- a/src/SMESHGUI/SMESHGUI_SMESHGenUtils.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com - -#ifndef SMESHGUI_SMESHGenUtils_HeaderFile -#define SMESHGUI_SMESHGenUtils_HeaderFile - -#include "SALOMEconfig.h" -#include CORBA_SERVER_HEADER(SMESH_Gen) - - -namespace SMESH -{ - - SMESH::SMESH_Gen_var GetSMESHGen(); - -} - - -#endif diff --git a/src/SMESHGUI/SMESHGUI_Selection.cxx b/src/SMESHGUI/SMESHGUI_Selection.cxx index 9791ebebd..6f6151218 100644 --- a/src/SMESHGUI/SMESHGUI_Selection.cxx +++ b/src/SMESHGUI/SMESHGUI_Selection.cxx @@ -1,41 +1,45 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// SMESH SMESHGUI_Selection +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// +// // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either +// License as published by the Free Software Foundation; either // version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_Selection.cxx +// Author : Alexander SOLOVYOV, Open CASCADE S.A.S. +// +// SMESH includes #include "SMESHGUI_Selection.h" + #include "SMESHGUI_Utils.h" #include "SMESHGUI_VTKUtils.h" -#include "SMESHGUI_MeshUtils.h" #include "SMESHGUI_GEOMGenUtils.h" -#include "SMESH_Type.h" -#include "SMESH_Actor.h" - -#include "LightApp_SelectionMgr.h" -#include "SalomeApp_Study.h" -#include "LightApp_VTKSelector.h" +#include +#include -#include "SUIT_Session.h" - -#include "SVTK_RenderWindowInteractor.h" -#include "SVTK_ViewWindow.h" +// SALOME GUI includes +#include +#include +#include +// IDL includes +#include #include CORBA_CLIENT_HEADER(SMESH_Gen) #include CORBA_CLIENT_HEADER(SMESH_Mesh) #include CORBA_CLIENT_HEADER(SMESH_Group) @@ -44,27 +48,9 @@ //function : SMESHGUI_Selection //purpose : //======================================================================= -SMESHGUI_Selection::SMESHGUI_Selection() -: LightApp_Selection() -{ -} - -//======================================================================= -//function : ~SMESHGUI_Selection -//purpose : -//======================================================================= -SMESHGUI_Selection::~SMESHGUI_Selection() +SMESHGUI_Selection::SMESHGUI_Selection( const QString& client, LightApp_SelectionMgr* mgr ) +: LightApp_Selection( client, mgr ) { -} - -//======================================================================= -//function : init -//purpose : -//======================================================================= -void SMESHGUI_Selection::init( const QString& client, LightApp_SelectionMgr* mgr ) -{ - LightApp_Selection::init( client, mgr ); - if( mgr && study() ) { SalomeApp_Study* aSStudy = dynamic_cast(study()); @@ -77,6 +63,14 @@ void SMESHGUI_Selection::init( const QString& client, LightApp_SelectionMgr* mgr } } +//======================================================================= +//function : ~SMESHGUI_Selection +//purpose : +//======================================================================= +SMESHGUI_Selection::~SMESHGUI_Selection() +{ +} + //======================================================================= //function : processOwner //purpose : @@ -92,34 +86,29 @@ void SMESHGUI_Selection::processOwner( const LightApp_DataOwner* ow ) } //======================================================================= -//function : param +//function : parameter //purpose : //======================================================================= -QtxValue SMESHGUI_Selection::param( const int ind, const QString& p ) const +QVariant SMESHGUI_Selection::parameter( const int ind, const QString& p ) const { - QtxValue val; - if ( p=="client" ) val = QtxValue( globalParam( p ) ); - else if ( p=="type" ) val = QtxValue( myTypes[ind] ); - else if ( p=="elemTypes" ) val = QtxValue( elemTypes( ind ) ); - else if ( p=="isAutoColor" ) val = QtxValue( isAutoColor( ind ) ); - else if ( p=="numberOfNodes" ) val = QtxValue( numberOfNodes( ind ) ); - else if ( p=="labeledTypes" ) val = QtxValue( labeledTypes( ind ) ); - else if ( p=="shrinkMode" ) val = QtxValue( shrinkMode( ind ) ); - else if ( p=="entityMode" ) val = QtxValue( entityMode( ind ) ); - else if ( p=="controlMode" ) val = QtxValue( controlMode( ind ) ); - else if ( p=="displayMode" ) val = QtxValue( displayMode( ind ) ); - else if ( p=="isComputable" ) val = QtxValue( isComputable( ind ) ); - else if ( p=="hasReference" ) val = QtxValue( hasReference( ind ) ); -// else if ( p=="isVisible" ) val = QtxValue( isVisible( ind ) ); - - // printf( "--> param() : [%s] = %s (%s)\n", p.latin1(), val.toString().latin1(), val.typeName() ); - //if ( val.type() == QVariant::List ) - //cout << "size: " << val.toList().count() << endl; + QVariant val; + if ( p=="client" ) val = QVariant( LightApp_Selection::parameter( p ) ); + else if ( p=="type" ) val = QVariant( myTypes[ind] ); + else if ( p=="elemTypes" ) val = QVariant( elemTypes( ind ) ); + else if ( p=="isAutoColor" ) val = QVariant( isAutoColor( ind ) ); + else if ( p=="numberOfNodes" ) val = QVariant( numberOfNodes( ind ) ); + else if ( p=="labeledTypes" ) val = QVariant( labeledTypes( ind ) ); + else if ( p=="shrinkMode" ) val = QVariant( shrinkMode( ind ) ); + else if ( p=="entityMode" ) val = QVariant( entityMode( ind ) ); + else if ( p=="controlMode" ) val = QVariant( controlMode( ind ) ); + else if ( p=="displayMode" ) val = QVariant( displayMode( ind ) ); + else if ( p=="isComputable" ) val = QVariant( isComputable( ind ) ); + else if ( p=="hasReference" ) val = QVariant( hasReference( ind ) ); if( val.isValid() ) return val; else - return LightApp_Selection::param( ind, p ); + return LightApp_Selection::parameter( ind, p ); } //======================================================================= @@ -130,7 +119,7 @@ QtxValue SMESHGUI_Selection::param( const int ind, const QString& p ) const SMESH_Actor* SMESHGUI_Selection::getActor( int ind ) const { if( ind >= 0 && ind < count() ) - return ((QPtrList&)myActors).at( ind ); + return myActors.at( ind ); else return 0; } @@ -140,9 +129,9 @@ SMESH_Actor* SMESHGUI_Selection::getActor( int ind ) const //purpose : may return {'Edge' 'Face' 'Volume'} at most //======================================================================= -QValueList SMESHGUI_Selection::elemTypes( int ind ) const +QList SMESHGUI_Selection::elemTypes( int ind ) const { - QValueList types; + QList types; SMESH_Actor* actor = getActor( ind ); if ( actor ) { TVisualObjPtr object = actor->GetObject(); @@ -160,9 +149,9 @@ QValueList SMESHGUI_Selection::elemTypes( int ind ) const //purpose : may return {'Point' 'Cell'} at most //======================================================================= -QValueList SMESHGUI_Selection::labeledTypes( int ind ) const +QList SMESHGUI_Selection::labeledTypes( int ind ) const { - QValueList types; + QList types; SMESH_Actor* actor = getActor( ind ); if ( actor ) { if ( actor->GetPointsLabeled()) types.append( "Point" ); @@ -184,7 +173,7 @@ QString SMESHGUI_Selection::displayMode( int ind ) const case SMESH_Actor::eEdge: return "eEdge"; case SMESH_Actor::eSurface: return "eSurface"; case SMESH_Actor::ePoint: return "ePoint"; - default:; + default: break; } } return "Unknown"; @@ -211,9 +200,9 @@ QString SMESHGUI_Selection::shrinkMode( int ind ) const //purpose : may return {'Edge' 'Face' 'Volume'} at most //======================================================================= -QValueList SMESHGUI_Selection::entityMode( int ind ) const +QList SMESHGUI_Selection::entityMode( int ind ) const { - QValueList types; + QList types; SMESH_Actor* actor = getActor( ind ); if ( actor ) { unsigned int aMode = actor->GetEntityMode(); @@ -263,7 +252,7 @@ bool SMESHGUI_Selection::isAutoColor( int ind ) const { if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" ) { - _PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).latin1() ); + _PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() ); CORBA::Object_var obj = SMESH::SObjectToObject( sobj, SMESH::GetActiveStudyDocument() ); if ( ! CORBA::is_nil( obj )) { @@ -284,7 +273,7 @@ int SMESHGUI_Selection::numberOfNodes( int ind ) const { if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" ) { - _PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).latin1() ); + _PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() ); CORBA::Object_var obj = SMESH::SObjectToObject( sobj, SMESH::GetActiveStudyDocument() ); if ( ! CORBA::is_nil( obj )) { @@ -316,7 +305,7 @@ QVariant SMESHGUI_Selection::isComputable( int ind ) const if ( !io.IsNull() ) { SMESH::SMESH_Mesh_var mesh = SMESH::GetMeshByIO(io); // m,sm,gr->m if ( !mesh->_is_nil() ) {*/ - _PTR(SObject) so = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).latin1() ); + _PTR(SObject) so = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() ); //FindSObject( mesh ); if ( so ) { CORBA::Object_var obj = SMESH::SObjectToObject(so, SMESH::GetActiveStudyDocument()); @@ -325,24 +314,24 @@ QVariant SMESHGUI_Selection::isComputable( int ind ) const if (!mesh->_is_nil()){ if(mesh->HasShapeToMesh()) { GEOM::GEOM_Object_var shape = SMESH::GetShapeOnMeshOrSubMesh( so ); - return QVariant( !shape->_is_nil(), 0 ); + return QVariant( !shape->_is_nil() ); } else { - return QVariant(!mesh->NbFaces()==0, 0); + return QVariant(!mesh->NbFaces()==0); } } else { GEOM::GEOM_Object_var shape = SMESH::GetShapeOnMeshOrSubMesh( so ); - return QVariant( !shape->_is_nil(), 0 ); + return QVariant( !shape->_is_nil() ); } } } // } // } } - return QVariant( false, 0 ); + return QVariant( false ); } //======================================================================= @@ -352,7 +341,7 @@ QVariant SMESHGUI_Selection::isComputable( int ind ) const QVariant SMESHGUI_Selection::hasReference( int ind ) const { - return QVariant( isReference( ind ), 0 ); + return QVariant( isReference( ind ) ); } //======================================================================= @@ -365,13 +354,13 @@ QVariant SMESHGUI_Selection::isVisible( int ind ) const if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" ) { QString ent = entry( ind ); - SMESH_Actor* actor = SMESH::FindActorByEntry( ent.latin1() ); + SMESH_Actor* actor = SMESH::FindActorByEntry( ent.toLatin1().data() ); if ( actor && actor->hasIO() ) { if(SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView()) - return QVariant( aViewWindow->isVisible( actor->getIO() ), 0 ); + return QVariant( aViewWindow->isVisible( actor->getIO() ) ); } } - return QVariant( false, 0 ); + return QVariant( false ); } //======================================================================= @@ -381,7 +370,7 @@ QVariant SMESHGUI_Selection::isVisible( int ind ) const int SMESHGUI_Selection::type( const QString& entry, _PTR(Study) study ) { - _PTR(SObject) obj (study->FindObjectID(entry.latin1())); + _PTR(SObject) obj (study->FindObjectID(entry.toLatin1().data())); if( !obj ) return -1; diff --git a/src/SMESHGUI/SMESHGUI_Selection.h b/src/SMESHGUI/SMESHGUI_Selection.h index 440c8d4bd..ac12c8166 100644 --- a/src/SMESHGUI/SMESHGUI_Selection.h +++ b/src/SMESHGUI/SMESHGUI_Selection.h @@ -1,77 +1,77 @@ -// SMESH SMESHGUI_Selection +// SMESH SMESHGUI_Selection // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_Selection.h +// Author : Alexander SOLOVYOV, Open CASCADE S.A.S. // -// -// File : SMESHGUI_Selection.h -// Author : Alexander SOLOVYOV -// Module : SMESH -// $Header$ -#ifndef SMESHGUI_SELECTION_HeaderFile -#define SMESHGUI_SELECTION_HeaderFile +#ifndef SMESHGUI_SELECTION_H +#define SMESHGUI_SELECTION_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include "LightApp_Selection.h" -#include "SALOMEDSClient_definitions.hxx" +// SALOME GUI includes +#include + +// SALOME KERNEL includes +#include class LightApp_SelectionMgr; -class SALOMEDSClient_Study; class LightApp_DataOwner; +class SALOMEDSClient_Study; class SMESH_Actor; class SMESHGUI_EXPORT SMESHGUI_Selection : public LightApp_Selection { public: - SMESHGUI_Selection(); + SMESHGUI_Selection( const QString&, LightApp_SelectionMgr* ); virtual ~SMESHGUI_Selection(); - virtual void init( const QString&, LightApp_SelectionMgr* ); - virtual QtxValue param( const int , const QString& paramName ) const; - virtual void processOwner( const LightApp_DataOwner* ); + virtual QVariant parameter( const int, const QString& ) const; + virtual void processOwner( const LightApp_DataOwner* ); // got from object, not from actor - virtual bool isAutoColor( int ind ) const; - virtual int numberOfNodes( int ind ) const; - virtual QVariant isComputable( int ind ) const; - virtual QVariant hasReference( int ind ) const; - virtual QVariant isVisible( int ind ) const; + virtual bool isAutoColor( int ) const; + virtual int numberOfNodes( int ) const; + virtual QVariant isComputable( int ) const; + virtual QVariant hasReference( int ) const; + virtual QVariant isVisible( int ) const; // parameters got from actor return nothing if an actor is not visible - virtual QValueList elemTypes( int ind ) const; - virtual QValueList labeledTypes( int ind ) const; - virtual QString displayMode( int ind ) const; - virtual QString shrinkMode( int ind ) const; - virtual QValueList entityMode( int ind ) const; - virtual QString controlMode( int ind ) const; + virtual QList elemTypes( int ) const; + virtual QList labeledTypes( int ) const; + virtual QString displayMode( int ) const; + virtual QString shrinkMode( int ) const; + virtual QList entityMode( int ) const; + virtual QString controlMode( int ) const; - SMESH_Actor* getActor( int ind ) const; + SMESH_Actor* getActor( int ) const; - static int type( const QString&, _PTR(Study) ); - static QString typeName( const int type); + static int type( const QString&, _PTR(Study) ); + static QString typeName( const int ); private: - QStringList myTypes; - QPtrList myActors; + QStringList myTypes; + QList myActors; }; -#endif +#endif // SMESHGUI_SELECTION_H diff --git a/src/SMESHGUI/SMESHGUI_SelectionOp.cxx b/src/SMESHGUI/SMESHGUI_SelectionOp.cxx index 2e620f71c..9bb99a77b 100644 --- a/src/SMESHGUI/SMESHGUI_SelectionOp.cxx +++ b/src/SMESHGUI/SMESHGUI_SelectionOp.cxx @@ -1,50 +1,51 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_SelectionOp.cxx +// Author : Alexander SOLOVYOV, Open CASCADE S.A.S. // -// File : SMESHGUI_SelectionOp.cxx -// Author : Alexander SOLOVYOV -// Module : SMESH - -#include -#include -#include -#include -#include + +// SMESH includes +#include "SMESHGUI_SelectionOp.h" + +#include "SMESHGUI.h" +#include "SMESHGUI_VTKUtils.h" +#include "SMESHGUI_MeshUtils.h" +#include "SMESHGUI_Selection.h" + +#include +#include +#include + +// SALOME GUI includes #include #include #include -#include #include #include -#include -#include -#include -#include +#include +#include -#include CORBA_SERVER_HEADER(GEOM_Gen) +// SALOME KERNEL includes #include -#include - /* Class : SMESHGUI_SelectionOp Description : Base operation for all operations using object selection in viewer or objectbrowser @@ -101,10 +102,10 @@ void SMESHGUI_SelectionOp::removeCustomFilters() LightApp_SelectionMgr* mgr = selectionMgr(); Filters::const_iterator anIt = myFilters.begin(), aLast = myFilters.end(); - for (; anIt != aLast; anIt++) { - if (anIt.data()) { - if (mgr) mgr->removeFilter(anIt.data()); - delete anIt.data(); + for ( ; anIt != aLast; anIt++) { + if (anIt.value()) { + if (mgr) mgr->removeFilter(anIt.value()); + delete anIt.value(); } } @@ -309,7 +310,7 @@ int SMESHGUI_SelectionOp::typeById( const QString& str, const EntityType objtype if( t<0 ) { //try to get GEOM type - _PTR( SObject ) sobj = st->FindObjectID( str.latin1() ); + _PTR( SObject ) sobj = st->FindObjectID( str.toLatin1().data() ); if( sobj ) { GEOM::GEOM_Object_var obj = GEOM::GEOM_Object::_narrow( @@ -324,14 +325,14 @@ int SMESHGUI_SelectionOp::typeById( const QString& str, const EntityType objtype } else { - int pos = str.find( idChar() ); + int pos = str.indexOf( idChar() ); QString entry = str.left( pos ), _id = str.mid( pos+1 ); bool ok; int id = _id.toInt( &ok ); if( ok ) { - _PTR( SObject ) sobj = st->FindObjectID( entry.latin1() ); + _PTR( SObject ) sobj = st->FindObjectID( entry.toLatin1().data() ); SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow( dynamic_cast( sobj.get() )->GetObject() ); SMESH::SMESH_subMesh_var submesh = SMESH::SMESH_subMesh::_narrow( @@ -525,7 +526,7 @@ void SMESHGUI_SelectionOp::extractIds( const QStringList& ids, IdList& list, con for( ; anIt!=aLast; anIt++ ) { id_str = *anIt; - int pos = idchar=='\0' ? -1 : id_str.find( idchar ); + int pos = idchar=='\0' ? -1 : id_str.indexOf( idchar ); int id = -1; if( idchar=='\0' || pos>=0 ) { diff --git a/src/SMESHGUI/SMESHGUI_SelectionOp.h b/src/SMESHGUI/SMESHGUI_SelectionOp.h index 2165d14f7..7b2e438d3 100644 --- a/src/SMESHGUI/SMESHGUI_SelectionOp.h +++ b/src/SMESHGUI/SMESHGUI_SelectionOp.h @@ -1,42 +1,42 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_SelectionOp.h +// Author : Alexander SOLOVYOV, Open CASCADE S.A.S. // -// File : SMESHGUI_SelectionOp.h -// Author : Alexander SOLOVYOV -// Module : SMESH - -#ifndef SMESHGUI_SelectionOp_H -#define SMESHGUI_SelectionOp_H +#ifndef SMESHGUI_SELECTIONOP_H +#define SMESHGUI_SELECTIONOP_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include -#include +#include "SMESHGUI_Operation.h" +#include "SMESHGUI_Dialog.h" + +// SALOME GUI includes #include #include +// IDL includes #include -#include CORBA_SERVER_HEADER(SMESH_Gen) - +#include CORBA_SERVER_HEADER(SMESH_Mesh) class SUIT_SelectionFilter; class TColStd_MapOfInteger; @@ -54,13 +54,13 @@ class SMESHGUI_EXPORT SMESHGUI_SelectionOp : public SMESHGUI_Operation Q_OBJECT public: - typedef QValueList IdList; //! List of node or element ids + typedef QList IdList; //! List of node or element ids public: SMESHGUI_SelectionOp( const Selection_Mode = ActorSelection ); virtual ~SMESHGUI_SelectionOp(); - static void extractIds( const QStringList&, IdList&, const QChar ); + static void extractIds( const QStringList&, IdList&, const QChar ); protected: typedef enum @@ -92,58 +92,59 @@ protected: virtual SUIT_SelectionFilter* createFilter( const int ) const; //! Remove only filters set by this operation (they are in map myFilters ) - void removeCustomFilters(); + void removeCustomFilters(); //! Return what selection mode is set in VTK viewer - Selection_Mode selectionMode() const; + Selection_Mode selectionMode() const; //! Set selection mode in VTK viewer - void setSelectionMode( const Selection_Mode ); + void setSelectionMode( const Selection_Mode ); //! Hilight object in VTK viewer - void highlight( const Handle( SALOME_InteractiveObject )&, - const bool, const bool = true ); + void highlight( const Handle( SALOME_InteractiveObject )&, + const bool, const bool = true ); //! Select some nodes or elements in VTK - void addOrRemoveIndex( const Handle( SALOME_InteractiveObject )&, - const TColStd_MapOfInteger&, const bool ); + void addOrRemoveIndex( const Handle( SALOME_InteractiveObject )&, + const TColStd_MapOfInteger&, const bool ); - SVTK_ViewWindow* viewWindow() const; - SVTK_Selector* selector() const; + SVTK_ViewWindow* viewWindow() const; + SVTK_Selector* selector() const; //! Get names, types and ids of selected objects - virtual void selected( QStringList&, SMESHGUI_Dialog::TypesList&, QStringList& ) const; + virtual void selected( QStringList&, + SMESHGUI_Dialog::TypesList&, QStringList& ) const; //! Find type by id - virtual int typeById( const QString&, const EntityType ) const; + virtual int typeById( const QString&, const EntityType ) const; //! Char using to divide and in string id representation. By default, '#' - virtual QChar idChar() const; + virtual QChar idChar() const; //! Try to find in certain object selection widget selected node or element ids and return it - void selectedIds( const int, IdList& ) const; + void selectedIds( const int, IdList& ) const; //! Find in QStringList correct node or element ids representation and append integer(id) to IdList - void extractIds( const QStringList&, IdList& ) const; + void extractIds( const QStringList&, IdList& ) const; //! Return selected mesh if selection mode isn't ActorSelection and only one object is selected - SMESH::SMESH_Mesh_var mesh() const; + SMESH::SMESH_Mesh_var mesh() const; //! Return actor according to selected mesh if selection mode isn't ActorSelection - SMESH_Actor* actor() const; + SMESH_Actor* actor() const; protected slots: //! Installs filter corresponding to certain object selection widget - virtual void onActivateObject( int ); + virtual void onActivateObject( int ); //! Removes filter corresponding to certain object selection widget - virtual void onDeactivateObject( int ); + virtual void onDeactivateObject( int ); /*! * Empty default implementation. In successors it may be used for more advanced selection checking. * This slot is connected to signal when the selection changed in some object selection widget */ - virtual void onSelectionChanged( int ); + virtual void onSelectionChanged( int ); /*! Default implementation allowing user to edit selected ids "by hands". In order to run default mechanism, you must set for some @@ -152,7 +153,7 @@ protected slots: to this slot Warning: this mechanism can process only integer ids, NOT MESH OR GROUP NAMES!!! */ - virtual void onTextChanged( int, const QStringList& ); + virtual void onTextChanged( int, const QStringList& ); private: typedef QMap Filters; @@ -162,4 +163,4 @@ private: Selection_Mode myDefSelectionMode, myOldSelectionMode; }; -#endif +#endif // SMESHGUI_SELECTIONOP_H diff --git a/src/SMESHGUI/SMESHGUI_SewingDlg.cxx b/src/SMESHGUI/SMESHGUI_SewingDlg.cxx index a6ae00781..cec3e4265 100644 --- a/src/SMESHGUI/SMESHGUI_SewingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SewingDlg.cxx @@ -1,31 +1,29 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_SewingDlg.cxx +// Author : Michael ZORIN, Open CASCADE S.A.S. // -// -// File : SMESHGUI_SewingDlg.cxx -// Author : Michael ZORIN -// Module : SMESH -// $Header: +// SMESH includes #include "SMESHGUI_SewingDlg.h" #include "SMESHGUI.h" @@ -34,55 +32,54 @@ #include "SMESHGUI_MeshUtils.h" #include "SMESHGUI_IdValidator.h" -#include "SMESH_Actor.h" -#include "SMDS_Mesh.hxx" - -#include "SUIT_Session.h" -#include "SUIT_ResourceMgr.h" -#include "SUIT_Desktop.h" -#include "SUIT_MessageBox.h" +#include +#include -#include "LightApp_Application.h" +// SALOME GUI includes +#include +#include +#include +#include -#include "SVTK_ViewModel.h" -#include "SVTK_ViewWindow.h" -#include "SVTK_Selector.h" -#include "SVTK_Selection.h" -#include "SALOME_ListIO.hxx" +#include +#include -#include "utilities.h" +#include +#include +#include -// OCCT Includes +// OCCT includes #include -#include - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// IDL includes +#include #include CORBA_SERVER_HEADER(SMESH_MeshEditor) -using namespace std; - +#define SPACING 6 +#define MARGIN 11 //================================================================================= // class : SMESHGUI_SewingDlg() // purpose : //================================================================================= -SMESHGUI_SewingDlg::SMESHGUI_SewingDlg( SMESHGUI* theModule, const char* name, - bool modal, WFlags fl) - : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | - WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose), - mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) +SMESHGUI_SewingDlg::SMESHGUI_SewingDlg( SMESHGUI* theModule ) + : QDialog( SMESH::GetDesktop( theModule ) ), + mySMESHGUI( theModule ), + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) { SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI ); QPixmap image0 (mgr->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_FREEBORDERS"))); @@ -91,207 +88,162 @@ SMESHGUI_SewingDlg::SMESHGUI_SewingDlg( SMESHGUI* theModule, const char* name, QPixmap image3 (mgr->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_SIDEELEMENTS"))); QPixmap image4 (mgr->loadPixmap("SMESH", tr("ICON_SELECT"))); - if (!name) - setName("SMESHGUI_SewingDlg"); - resize(303, 185); - setCaption(tr("SMESH_SEWING")); - setSizeGripEnabled(TRUE); - SMESHGUI_SewingDlgLayout = new QGridLayout(this); - SMESHGUI_SewingDlgLayout->setSpacing(6); - SMESHGUI_SewingDlgLayout->setMargin(11); + setModal(false); + setAttribute(Qt::WA_DeleteOnClose, true); + setWindowTitle(tr("SMESH_SEWING")); + setSizeGripEnabled(true); - /***************************************************************/ - GroupConstructors = new QButtonGroup(this, "GroupConstructors"); - GroupConstructors->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)5, - (QSizePolicy::SizeType)0, 0, 0, - GroupConstructors->sizePolicy().hasHeightForWidth())); - GroupConstructors->setTitle(tr("SMESH_SEWING")); - GroupConstructors->setExclusive(TRUE); - GroupConstructors->setColumnLayout(0, Qt::Vertical); - GroupConstructors->layout()->setSpacing(0); - GroupConstructors->layout()->setMargin(0); - GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout()); - GroupConstructorsLayout->setAlignment(Qt::AlignTop); - GroupConstructorsLayout->setSpacing(6); - GroupConstructorsLayout->setMargin(11); - QHBoxLayout* RBLayout = new QHBoxLayout(0, 0, 6, "Layout2"); - RadioButton1= new QRadioButton(GroupConstructors, "RadioButton1"); - RadioButton1->setText(tr("" )); - RadioButton1->setPixmap(image0); - RBLayout->addWidget(RadioButton1); - RadioButton2= new QRadioButton(GroupConstructors, "RadioButton2"); - RadioButton2->setText(tr("" )); - RadioButton2->setPixmap(image1); - RBLayout->addWidget(RadioButton2); - RadioButton3= new QRadioButton(GroupConstructors, "RadioButton3"); - RadioButton3->setText(tr("" )); - RadioButton3->setPixmap(image2); - RBLayout->addWidget(RadioButton3); - RadioButton4= new QRadioButton(GroupConstructors, "RadioButton4"); - RadioButton4->setText(tr("" )); - RadioButton4->setPixmap(image3); - RBLayout->addWidget(RadioButton4); - GroupConstructorsLayout->addLayout(RBLayout, 0, 0); - SMESHGUI_SewingDlgLayout->addWidget(GroupConstructors, 0, 0); + QVBoxLayout* SMESHGUI_SewingDlgLayout = new QVBoxLayout(this); + SMESHGUI_SewingDlgLayout->setSpacing(SPACING); + SMESHGUI_SewingDlgLayout->setMargin(MARGIN); /***************************************************************/ - GroupButtons = new QGroupBox(this, "GroupButtons"); - GroupButtons->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)7, - (QSizePolicy::SizeType)0, 0, 0, - GroupButtons->sizePolicy().hasHeightForWidth())); - GroupButtons->setGeometry(QRect(10, 10, 281, 48)); - GroupButtons->setTitle(tr("" )); - GroupButtons->setColumnLayout(0, Qt::Vertical); - GroupButtons->layout()->setSpacing(0); - GroupButtons->layout()->setMargin(0); - GroupButtonsLayout = new QGridLayout(GroupButtons->layout()); - GroupButtonsLayout->setAlignment(Qt::AlignTop); - GroupButtonsLayout->setSpacing(6); - GroupButtonsLayout->setMargin(11); - buttonHelp = new QPushButton(GroupButtons, "buttonHelp"); - buttonHelp->setText(tr("SMESH_BUT_HELP" )); - buttonHelp->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonHelp, 0, 4); - buttonCancel = new QPushButton(GroupButtons, "buttonCancel"); - buttonCancel->setText(tr("SMESH_BUT_CLOSE")); - buttonCancel->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonCancel, 0, 3); - buttonApply = new QPushButton(GroupButtons, "buttonApply"); - buttonApply->setText(tr("SMESH_BUT_APPLY")); - buttonApply->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonApply, 0, 1); - QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - GroupButtonsLayout->addItem(spacer_9, 0, 2); - buttonOk = new QPushButton(GroupButtons, "buttonOk"); - buttonOk->setText(tr("SMESH_BUT_OK")); - buttonOk->setAutoDefault(TRUE); - buttonOk->setDefault(TRUE); - GroupButtonsLayout->addWidget(buttonOk, 0, 0); - SMESHGUI_SewingDlgLayout->addWidget(GroupButtons, 2, 0); + ConstructorsBox = new QGroupBox(tr("SMESH_SEWING"), this); + GroupConstructors = new QButtonGroup(this); + QHBoxLayout* ConstructorsBoxLayout = new QHBoxLayout(ConstructorsBox); + ConstructorsBoxLayout->setSpacing(SPACING); + ConstructorsBoxLayout->setMargin(MARGIN); + + RadioButton1 = new QRadioButton(ConstructorsBox); + RadioButton1->setIcon(image0); + RadioButton2 = new QRadioButton(ConstructorsBox); + RadioButton2->setIcon(image1); + RadioButton3 = new QRadioButton(ConstructorsBox); + RadioButton3->setIcon(image2); + RadioButton4 = new QRadioButton(ConstructorsBox); + RadioButton4->setIcon(image3); + + ConstructorsBoxLayout->addWidget(RadioButton1); + ConstructorsBoxLayout->addWidget(RadioButton2); + ConstructorsBoxLayout->addWidget(RadioButton3); + ConstructorsBoxLayout->addWidget(RadioButton4); + GroupConstructors->addButton(RadioButton1, 0); + GroupConstructors->addButton(RadioButton2, 1); + GroupConstructors->addButton(RadioButton3, 2); + GroupConstructors->addButton(RadioButton4, 3); /***************************************************************/ - GroupArguments = new QGroupBox(this, "GroupArguments"); - GroupArguments->setColumnLayout(0, Qt::Vertical); - GroupArguments->layout()->setSpacing(0); - GroupArguments->layout()->setMargin(0); - GroupArgumentsLayout = new QGridLayout(GroupArguments->layout()); - GroupArgumentsLayout->setAlignment(Qt::AlignTop); - GroupArgumentsLayout->setSpacing(6); - GroupArgumentsLayout->setMargin(11); + GroupArguments = new QGroupBox(this); + QVBoxLayout* GroupArgumentsLayout = new QVBoxLayout(GroupArguments); + GroupArgumentsLayout->setSpacing(SPACING); + GroupArgumentsLayout->setMargin(MARGIN); // First subgroup - SubGroup1 = new QGroupBox(GroupArguments, "SubGroup1"); - SubGroup1->setColumnLayout(0, Qt::Vertical); - SubGroup1->layout()->setSpacing(0); - SubGroup1->layout()->setMargin(0); - QGridLayout* SubGroup1Layout = new QGridLayout(SubGroup1->layout()); - SubGroup1Layout->setAlignment(Qt::AlignTop); - SubGroup1Layout->setSpacing(6); - SubGroup1Layout->setMargin(11); + SubGroup1 = new QGroupBox(GroupArguments); + QGridLayout* SubGroup1Layout = new QGridLayout(SubGroup1); + SubGroup1Layout->setSpacing(SPACING); + SubGroup1Layout->setMargin(MARGIN); // Controls of the first subgroup - TextLabel1 = new QLabel(SubGroup1, "TextLabel1"); - TextLabel1->setFixedWidth(104); - SubGroup1Layout->addWidget(TextLabel1, 0, 0); - - SelectButton1 = new QPushButton(SubGroup1, "SelectButton1"); - SelectButton1->setPixmap(image4); + TextLabel1 = new QLabel(SubGroup1); + SelectButton1 = new QPushButton(SubGroup1); + SelectButton1->setIcon(image4); + LineEdit1 = new QLineEdit(SubGroup1); + + TextLabel2 = new QLabel(SubGroup1); + SelectButton2 = new QPushButton(SubGroup1); + SelectButton2->setIcon(image4); + LineEdit2 = new QLineEdit(SubGroup1); + + TextLabel3 = new QLabel(SubGroup1); + SelectButton3 = new QPushButton(SubGroup1); + SelectButton3->setIcon(image4); + LineEdit3 = new QLineEdit(SubGroup1); + + SubGroup1Layout->addWidget(TextLabel1, 0, 0); SubGroup1Layout->addWidget(SelectButton1, 0, 1); - - LineEdit1 = new QLineEdit(SubGroup1, "LineEdit1"); - SubGroup1Layout->addWidget(LineEdit1, 0, 2); - - TextLabel2 = new QLabel(SubGroup1, "TextLabel2"); - SubGroup1Layout->addWidget(TextLabel2, 1, 0); - - SelectButton2 = new QPushButton(SubGroup1, "SelectButton2"); - SelectButton2->setPixmap(image4); + SubGroup1Layout->addWidget(LineEdit1, 0, 2); + SubGroup1Layout->addWidget(TextLabel2, 1, 0); SubGroup1Layout->addWidget(SelectButton2, 1, 1); - - LineEdit2 = new QLineEdit(SubGroup1, "LineEdit2"); - SubGroup1Layout->addWidget(LineEdit2, 1, 2); - - TextLabel3 = new QLabel(SubGroup1, "TextLabel3"); - SubGroup1Layout->addWidget(TextLabel3, 2, 0); - - SelectButton3 = new QPushButton(SubGroup1, "SelectButton3"); - SelectButton3->setPixmap(image4); + SubGroup1Layout->addWidget(LineEdit2, 1, 2); + SubGroup1Layout->addWidget(TextLabel3, 2, 0); SubGroup1Layout->addWidget(SelectButton3, 2, 1); - - LineEdit3 = new QLineEdit(SubGroup1, "LineEdit3"); - SubGroup1Layout->addWidget(LineEdit3, 2, 2); + SubGroup1Layout->addWidget(LineEdit3, 2, 2); // Second subgroup - SubGroup2 = new QGroupBox(GroupArguments, "SubGroup2"); - SubGroup2->setColumnLayout(0, Qt::Vertical); - SubGroup2->layout()->setSpacing(0); - SubGroup2->layout()->setMargin(0); - QGridLayout* SubGroup2Layout = new QGridLayout(SubGroup2->layout()); - SubGroup2Layout->setAlignment(Qt::AlignTop); - SubGroup2Layout->setSpacing(6); - SubGroup2Layout->setMargin(11); + SubGroup2 = new QGroupBox(GroupArguments); + QGridLayout* SubGroup2Layout = new QGridLayout(SubGroup2); + SubGroup2Layout->setSpacing(SPACING); + SubGroup2Layout->setMargin(MARGIN); // Controls of the first subgroup - TextLabel4 = new QLabel(SubGroup2, "TextLabel4"); - SubGroup2Layout->addWidget(TextLabel4, 0, 0); - - SelectButton4 = new QPushButton(SubGroup2, "SelectButton4"); - SelectButton4->setPixmap(image4); + TextLabel4 = new QLabel(SubGroup2); + SelectButton4 = new QPushButton(SubGroup2); + SelectButton4->setIcon(image4); + LineEdit4 = new QLineEdit(SubGroup2); + + TextLabel5 = new QLabel(SubGroup2); + SelectButton5 = new QPushButton(SubGroup2); + SelectButton5->setIcon(image4); + LineEdit5 = new QLineEdit(SubGroup2); + + TextLabel6 = new QLabel(SubGroup2); + SelectButton6 = new QPushButton(SubGroup2); + SelectButton6->setIcon(image4); + LineEdit6 = new QLineEdit(SubGroup2); + + SubGroup2Layout->addWidget(TextLabel4, 0, 0); SubGroup2Layout->addWidget(SelectButton4, 0, 1); - - LineEdit4 = new QLineEdit(SubGroup2, "LineEdit4"); - SubGroup2Layout->addWidget(LineEdit4, 0, 2); - - TextLabel5 = new QLabel(SubGroup2, "TextLabel5"); - SubGroup2Layout->addWidget(TextLabel5, 1, 0); - - SelectButton5 = new QPushButton(SubGroup2, "SelectButton5"); - SelectButton5->setPixmap(image4); + SubGroup2Layout->addWidget(LineEdit4, 0, 2); + SubGroup2Layout->addWidget(TextLabel5, 1, 0); SubGroup2Layout->addWidget(SelectButton5, 1, 1); - - LineEdit5 = new QLineEdit(SubGroup2, "LineEdit5"); - SubGroup2Layout->addWidget(LineEdit5, 1, 2); - - TextLabel6 = new QLabel(SubGroup2, "TextLabel6"); - SubGroup2Layout->addWidget(TextLabel6, 2, 0); - - SelectButton6 = new QPushButton(SubGroup2, "SelectButton6"); - SelectButton6->setPixmap(image4); + SubGroup2Layout->addWidget(LineEdit5, 1, 2); + SubGroup2Layout->addWidget(TextLabel6, 2, 0); SubGroup2Layout->addWidget(SelectButton6, 2, 1); - - LineEdit6 = new QLineEdit(SubGroup2, "LineEdit6"); - SubGroup2Layout->addWidget(LineEdit6, 2, 2); - - // Add subgroups to the group of arguments - GroupArgumentsLayout->addWidget(SubGroup1, 0, 0); - GroupArgumentsLayout->addWidget(SubGroup2, 1, 0); + SubGroup2Layout->addWidget(LineEdit6, 2, 2); // Control for the merging equal elements - CheckBoxMerge = new QCheckBox(GroupArguments, "CheckBoxMerge"); - CheckBoxMerge->setText(tr("MERGE_EQUAL_ELEMENTS" )); - GroupArgumentsLayout->addWidget(CheckBoxMerge, 2, 0); - -// Control for the polygons creation instead of splitting - CheckBoxPolygons = new QCheckBox( GroupArguments, "CheckBoxPolygons" ); - CheckBoxPolygons->setText( tr( "CREATE_POLYGONS_INSTEAD_SPLITTING" ) ); - GroupArgumentsLayout->addWidget( CheckBoxPolygons, 3, 0 ); + CheckBoxMerge = new QCheckBox(tr("MERGE_EQUAL_ELEMENTS"), GroupArguments); + + // Control for the polygons creation instead of splitting + CheckBoxPolygons = new QCheckBox(tr("CREATE_POLYGONS_INSTEAD_SPLITTING"), GroupArguments); // Control for the polyedres creation to obtain conform mesh - CheckBoxPolyedrs = new QCheckBox( GroupArguments, "CheckBoxPolyedrs" ); - CheckBoxPolyedrs->setText( tr( "CREATE_POLYEDRS_NEAR_BOUNDARY" ) ); - GroupArgumentsLayout->addWidget( CheckBoxPolyedrs, 4, 0 ); + CheckBoxPolyedrs = new QCheckBox(tr("CREATE_POLYEDRS_NEAR_BOUNDARY"), GroupArguments); + // layout + GroupArgumentsLayout->addWidget(SubGroup1); + GroupArgumentsLayout->addWidget(SubGroup2); + GroupArgumentsLayout->addWidget(CheckBoxMerge); + GroupArgumentsLayout->addWidget(CheckBoxPolygons); + GroupArgumentsLayout->addWidget(CheckBoxPolyedrs); + + /***************************************************************/ + GroupButtons = new QGroupBox(this); + QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons); + GroupButtonsLayout->setSpacing(SPACING); + GroupButtonsLayout->setMargin(MARGIN); + + buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk->setAutoDefault(true); + buttonOk->setDefault(true); + buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); + buttonApply->setAutoDefault(true); + buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons); + buttonCancel->setAutoDefault(true); + buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons); + buttonHelp->setAutoDefault(true); + + GroupButtonsLayout->addWidget(buttonOk); + GroupButtonsLayout->addSpacing(10); + GroupButtonsLayout->addWidget(buttonApply); + GroupButtonsLayout->addSpacing(10); + GroupButtonsLayout->addStretch(); + GroupButtonsLayout->addWidget(buttonCancel); + GroupButtonsLayout->addWidget(buttonHelp); - SMESHGUI_SewingDlgLayout->addWidget(GroupArguments, 1, 0); + /***************************************************************/ + SMESHGUI_SewingDlgLayout->addWidget(ConstructorsBox); + SMESHGUI_SewingDlgLayout->addWidget(GroupArguments); + SMESHGUI_SewingDlgLayout->addWidget(GroupButtons); /* Initialisations */ - GroupArguments->show(); - RadioButton1->setChecked(TRUE); + RadioButton1->setChecked(true); - LineEdit2->setValidator(new SMESHGUI_IdValidator(this, "validator", 1)); - LineEdit3->setValidator(new SMESHGUI_IdValidator(this, "validator", 1)); - LineEdit5->setValidator(new SMESHGUI_IdValidator(this, "validator", 1)); - LineEdit6->setValidator(new SMESHGUI_IdValidator(this, "validator", 1)); + LineEdit2->setValidator(new SMESHGUI_IdValidator(this, 1)); + LineEdit3->setValidator(new SMESHGUI_IdValidator(this, 1)); + LineEdit5->setValidator(new SMESHGUI_IdValidator(this, 1)); + LineEdit6->setValidator(new SMESHGUI_IdValidator(this, 1)); mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); @@ -302,11 +254,11 @@ SMESHGUI_SewingDlg::SMESHGUI_SewingDlg( SMESHGUI* theModule, const char* name, Init(); /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); - connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int))); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); + connect(GroupConstructors, SIGNAL(buttonClicked(int)), SLOT(ConstructorsClicked(int))); connect(SelectButton1, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument())); connect(SelectButton2, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument())); @@ -327,10 +279,7 @@ SMESHGUI_SewingDlg::SMESHGUI_SewingDlg( SMESHGUI* theModule, const char* name, connect(LineEdit5, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&))); connect(LineEdit6, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&))); - this->show(); /* displays Dialog */ - ConstructorsClicked(0); - resize(0,0); } //================================================================================= @@ -339,7 +288,6 @@ SMESHGUI_SewingDlg::SMESHGUI_SewingDlg( SMESHGUI* theModule, const char* name, //================================================================================= SMESHGUI_SewingDlg::~SMESHGUI_SewingDlg() { - // no need to delete child widgets, Qt does it all for us } //================================================================================= @@ -409,7 +357,6 @@ void SMESHGUI_SewingDlg::ConstructorsClicked (int constructorId) if (!CheckBoxPolyedrs->isVisible()) CheckBoxPolyedrs->show(); - break; } case 1: @@ -441,7 +388,6 @@ void SMESHGUI_SewingDlg::ConstructorsClicked (int constructorId) if (!CheckBoxPolyedrs->isVisible()) CheckBoxPolyedrs->show(); - myOk5 = true; break; @@ -459,8 +405,8 @@ void SMESHGUI_SewingDlg::ConstructorsClicked (int constructorId) TextLabel5->setText(tr("NODE1_TO_MERGE")); TextLabel6->setText(tr("NODE2_TO_MERGE")); - LineEdit1->setValidator(new SMESHGUI_IdValidator(this, "validator")); - LineEdit4->setValidator(new SMESHGUI_IdValidator(this, "validator")); + LineEdit1->setValidator(new SMESHGUI_IdValidator(this)); + LineEdit4->setValidator(new SMESHGUI_IdValidator(this)); SMESH::SetPointRepresentation(false); @@ -478,8 +424,8 @@ void SMESHGUI_SewingDlg::ConstructorsClicked (int constructorId) TextLabel5->setText(tr("SECOND_NODE_ID")); TextLabel6->setText(tr("LAST_NODE_ID")); - LineEdit1->setValidator(new SMESHGUI_IdValidator(this, "validator", 1)); - LineEdit4->setValidator(new SMESHGUI_IdValidator(this, "validator", 1)); + LineEdit1->setValidator(new SMESHGUI_IdValidator(this, 1)); + LineEdit4->setValidator(new SMESHGUI_IdValidator(this, 1)); SMESH::SetPointRepresentation(true); @@ -489,6 +435,10 @@ void SMESHGUI_SewingDlg::ConstructorsClicked (int constructorId) connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); mySelectionMgr->setSelectedObjects( io ); + + QApplication::instance()->processEvents(); + updateGeometry(); + resize( minimumSize() ); } //================================================================================= @@ -509,7 +459,7 @@ bool SMESHGUI_SewingDlg::ClickOnApply() try { SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); - QApplication::setOverrideCursor(Qt::waitCursor); + QApplication::setOverrideCursor(Qt::WaitCursor); int aConstructorId = GetConstructorId(); SMESH::SMESH_MeshEditor::Sew_Error anError; @@ -538,8 +488,8 @@ bool SMESHGUI_SewingDlg::ClickOnApply() toCreatePolygons, toCreatePolyedrs); else if (aConstructorId == 3) { - QStringList aListElementsId1 = QStringList::split(" ", LineEdit1->text(), false); - QStringList aListElementsId2 = QStringList::split(" ", LineEdit4->text(), false); + QStringList aListElementsId1 = LineEdit1->text().split(" ", QString::SkipEmptyParts); + QStringList aListElementsId2 = LineEdit4->text().split(" ", QString::SkipEmptyParts); SMESH::long_array_var anElementsId1 = new SMESH::long_array; SMESH::long_array_var anElementsId2 = new SMESH::long_array; @@ -567,9 +517,8 @@ bool SMESHGUI_SewingDlg::ClickOnApply() QApplication::restoreOverrideCursor(); if (!aResult) { - QString msg = tr(QString("ERROR_%1").arg(anError)); - SUIT_MessageBox::warn1(SMESHGUI::desktop(), tr("SMESH_WRN_WARNING"), - msg, tr("SMESH_BUT_OK")); + QString msg = tr(QString("ERROR_%1").arg(anError).toLatin1().data()); + SUIT_MessageBox::warning(this, tr("SMESH_WRN_WARNING"), msg); } } catch (...) { } @@ -625,16 +574,17 @@ void SMESHGUI_SewingDlg::ClickOnHelp() if (app) app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); else { - QString platform; + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName)); } } @@ -711,7 +661,7 @@ void SMESHGUI_SewingDlg::onTextChange (const QString& theNewText) if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->SetSelectionMode(CellSelection); - QStringList aListId = QStringList::split(" ", theNewText, false); + QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts); bool isEvenOneExists = false; @@ -884,8 +834,8 @@ void SMESHGUI_SewingDlg::SetEditCurrentArgument() //================================================================================= void SMESHGUI_SewingDlg::DeactivateActiveDialog() { - if (GroupConstructors->isEnabled()) { - GroupConstructors->setEnabled(false); + if (ConstructorsBox->isEnabled()) { + ConstructorsBox->setEnabled(false); GroupArguments->setEnabled(false); GroupButtons->setEnabled(false); mySMESHGUI->ResetState(); @@ -901,7 +851,7 @@ void SMESHGUI_SewingDlg::ActivateThisDialog() { /* Emit a signal to deactivate the active dialog */ mySMESHGUI->EmitSignalDeactivateDialog(); - GroupConstructors->setEnabled(true); + ConstructorsBox->setEnabled(true); GroupArguments->setEnabled(true); GroupButtons->setEnabled(true); @@ -917,7 +867,7 @@ void SMESHGUI_SewingDlg::ActivateThisDialog() //================================================================================= void SMESHGUI_SewingDlg::enterEvent (QEvent* e) { - if (!GroupConstructors->isEnabled()) + if (!ConstructorsBox->isEnabled()) ActivateThisDialog(); } @@ -928,7 +878,7 @@ void SMESHGUI_SewingDlg::enterEvent (QEvent* e) void SMESHGUI_SewingDlg::closeEvent (QCloseEvent*) { /* same than click on cancel button */ - this->ClickOnCancel(); + ClickOnCancel(); } //======================================================================= @@ -947,9 +897,7 @@ void SMESHGUI_SewingDlg::hideEvent (QHideEvent*) //================================================================================= int SMESHGUI_SewingDlg::GetConstructorId() { - if (GroupConstructors != NULL && GroupConstructors->selected() != NULL) - return GroupConstructors->id(GroupConstructors->selected()); - return -1; + return GroupConstructors->checkedId(); } //================================================================================= @@ -971,9 +919,8 @@ void SMESHGUI_SewingDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) - { - e->accept(); - ClickOnHelp(); - } + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + ClickOnHelp(); + } } diff --git a/src/SMESHGUI/SMESHGUI_SewingDlg.h b/src/SMESHGUI/SMESHGUI_SewingDlg.h index 4e96dd40d..f41e170aa 100644 --- a/src/SMESHGUI/SMESHGUI_SewingDlg.h +++ b/src/SMESHGUI/SMESHGUI_SewingDlg.h @@ -1,42 +1,41 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_SewingDlg.h +// Author : Michael ZORIN, Open CASCADE S.A.S. // -// File : SMESHGUI_SewingDlg.h -// Author : Michael ZORIN -// Module : SMESH -// $Header: -#ifndef DIALOGBOX_SEWING_H -#define DIALOGBOX_SEWING_H +#ifndef SMESHGUI_SEWINGDLG_H +#define SMESHGUI_SEWINGDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include "LightApp_SelectionMgr.h" +// Qt includes +#include -// QT Includes -#include +// IDL includes +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) -class QGridLayout; class QButtonGroup; class QGroupBox; class QLabel; @@ -46,13 +45,8 @@ class QRadioButton; class QCheckBox; class SMESHGUI; class SMESH_Actor; -class SVTK_ViewWindow; class SVTK_Selector; - -// IDL Headers -#include -#include CORBA_SERVER_HEADER(SMESH_Mesh) - +class LightApp_SelectionMgr; //================================================================================= // class : SMESHGUI_SewingDlg @@ -60,89 +54,80 @@ class SVTK_Selector; //================================================================================= class SMESHGUI_EXPORT SMESHGUI_SewingDlg : public QDialog { - Q_OBJECT + Q_OBJECT public: - SMESHGUI_SewingDlg( SMESHGUI*, - const char* name = 0, - bool modal = FALSE, - WFlags fl = 0); - ~SMESHGUI_SewingDlg(); + SMESHGUI_SewingDlg( SMESHGUI* ); + ~SMESHGUI_SewingDlg(); private: - void Init() ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ); /* mouse enter the QWidget */ - void hideEvent ( QHideEvent * ); /* ESC key */ - void keyPressEvent(QKeyEvent*); - int GetConstructorId(); - bool IsValid(); - - SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ - LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ - int myOk1, myOk2, myOk3, myOk4, myOk5, myOk6; - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - SVTK_Selector* mySelector; - - bool myBusy; - SMESH::SMESH_Mesh_var myMesh; - SMESH_Actor* myActor; - - QButtonGroup* GroupConstructors; - QRadioButton* RadioButton1; - QRadioButton* RadioButton2; - QRadioButton* RadioButton3; - QRadioButton* RadioButton4; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QPushButton* buttonHelp; - QGroupBox* GroupArguments; - QGroupBox* SubGroup1; - QGroupBox* SubGroup2; - QLabel* TextLabel1; - QLabel* TextLabel2; - QLabel* TextLabel3; - QLabel* TextLabel4; - QLabel* TextLabel5; - QLabel* TextLabel6; - QPushButton* SelectButton1; - QPushButton* SelectButton2; - QPushButton* SelectButton3; - QPushButton* SelectButton4; - QPushButton* SelectButton5; - QPushButton* SelectButton6; - QLineEdit* LineEdit1; - QLineEdit* LineEdit2; - QLineEdit* LineEdit3; - QLineEdit* LineEdit4; - QLineEdit* LineEdit5; - QLineEdit* LineEdit6; - QCheckBox* CheckBoxMerge; - QCheckBox* CheckBoxPolygons; - QCheckBox* CheckBoxPolyedrs; + void Init(); + void closeEvent( QCloseEvent* ); + void enterEvent( QEvent* ); /* mouse enter the QWidget */ + void hideEvent( QHideEvent* ); /* ESC key */ + void keyPressEvent( QKeyEvent* ); + int GetConstructorId(); + bool IsValid(); + + SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ + LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ + int myOk1, myOk2, myOk3, myOk4, myOk5, myOk6; + QLineEdit* myEditCurrentArgument; /* Current LineEdit */ + SVTK_Selector* mySelector; + + bool myBusy; + SMESH::SMESH_Mesh_var myMesh; + SMESH_Actor* myActor; + + QGroupBox* ConstructorsBox; + QButtonGroup* GroupConstructors; + QRadioButton* RadioButton1; + QRadioButton* RadioButton2; + QRadioButton* RadioButton3; + QRadioButton* RadioButton4; + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QPushButton* buttonApply; + QPushButton* buttonHelp; + QGroupBox* GroupArguments; + QGroupBox* SubGroup1; + QGroupBox* SubGroup2; + QLabel* TextLabel1; + QLabel* TextLabel2; + QLabel* TextLabel3; + QLabel* TextLabel4; + QLabel* TextLabel5; + QLabel* TextLabel6; + QPushButton* SelectButton1; + QPushButton* SelectButton2; + QPushButton* SelectButton3; + QPushButton* SelectButton4; + QPushButton* SelectButton5; + QPushButton* SelectButton6; + QLineEdit* LineEdit1; + QLineEdit* LineEdit2; + QLineEdit* LineEdit3; + QLineEdit* LineEdit4; + QLineEdit* LineEdit5; + QLineEdit* LineEdit6; + QCheckBox* CheckBoxMerge; + QCheckBox* CheckBoxPolygons; + QCheckBox* CheckBoxPolyedrs; - QString myHelpFileName; + QString myHelpFileName; private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - bool ClickOnApply(); - void ClickOnHelp(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument(bool isSelectionChanged = true) ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void onTextChange(const QString&); - -protected: - QGridLayout* SMESHGUI_SewingDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupArgumentsLayout; + void ConstructorsClicked( int ); + void ClickOnOk(); + void ClickOnCancel(); + bool ClickOnApply(); + void ClickOnHelp(); + void SetEditCurrentArgument(); + void SelectionIntoArgument( bool = true ); + void DeactivateActiveDialog(); + void ActivateThisDialog(); + void onTextChange( const QString& ); }; -#endif // DIALOGBOX_SEWING_H +#endif // SMESHGUI_SEWINGDLG_H diff --git a/src/SMESHGUI/SMESHGUI_ShapeByMeshDlg.cxx b/src/SMESHGUI/SMESHGUI_ShapeByMeshDlg.cxx index 51881af42..ba45e5735 100644 --- a/src/SMESHGUI/SMESHGUI_ShapeByMeshDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ShapeByMeshDlg.cxx @@ -1,30 +1,27 @@ -// SMESH SMESHGUI : GUI for SMESH component +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_ShapeByMeshDlg.cxx +// Author : Edward AGAPOV, Open CASCADE S.A.S. // -// -// File : SMESHGUI_ShapeByMeshDlg.cxx -// Author : Edward AGAPOV -// Module : SMESH +// SMESH includes #include "SMESHGUI_ShapeByMeshDlg.h" #include "SMESHGUI.h" @@ -34,42 +31,46 @@ #include "SMESHGUI_Utils.h" #include "SMESHGUI_VTKUtils.h" -#include "SMDS_Mesh.hxx" -#include "SMDS_MeshNode.hxx" -#include "SMESH_Actor.h" +#include +#include +#include + +// SALOME GEOM includes +#include +#include -#include "GEOMBase.h" -#include "GeometryGUI.h" +// SALOME GUI includes +#include +#include +#include +#include +#include +#include +#include +#include -#include "LightApp_DataOwner.h" -#include "LightApp_SelectionMgr.h" -#include "SALOMEDSClient_SObject.hxx" -#include "SALOME_ListIO.hxx" -#include "SUIT_Desktop.h" -#include "SVTK_Selector.h" -#include "SVTK_ViewWindow.h" -#include "SVTK_ViewModel.h" -#include "SalomeApp_Tools.h" +// SALOME KERNEL includes +#include -// OCCT Includes +// OCCT includes #include #include #include -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define SPACING 5 -#define MARGIN 10 - +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SPACING 6 +#define MARGIN 11 enum { EDGE = 0, FACE, VOLUME }; @@ -80,9 +81,11 @@ enum { EDGE = 0, FACE, VOLUME }; SMESHGUI_ShapeByMeshDlg::SMESHGUI_ShapeByMeshDlg() : SMESHGUI_Dialog( 0, false, true, OK | Close ) { - setCaption(tr("CAPTION")); + setWindowTitle(tr("CAPTION")); - QVBoxLayout* aDlgLay = new QVBoxLayout (mainFrame(), MARGIN, SPACING); + QVBoxLayout* aDlgLay = new QVBoxLayout (mainFrame()); + aDlgLay->setMargin(MARGIN); + aDlgLay->setSpacing(SPACING); QFrame* aMainFrame = createMainFrame (mainFrame()); @@ -97,35 +100,41 @@ SMESHGUI_ShapeByMeshDlg::SMESHGUI_ShapeByMeshDlg() //======================================================================= QFrame* SMESHGUI_ShapeByMeshDlg::createMainFrame (QWidget* theParent) { - QFrame* aMainGrp = new QFrame(theParent, "main frame"); - QGridLayout* aLayout = new QGridLayout(aMainGrp, 3, 2); - aLayout->setSpacing(6); - aLayout->setAutoAdd(false); + QFrame* aMainGrp = new QFrame(theParent); + QGridLayout* aLayout = new QGridLayout(aMainGrp); + aLayout->setMargin(0); + aLayout->setSpacing(SPACING); // elem type - myElemTypeGroup = new QButtonGroup(1, Qt::Vertical, aMainGrp, "Group types"); - myElemTypeGroup->setTitle(tr("SMESH_ELEMENT_TYPE")); - myElemTypeGroup->setExclusive(true); - - (new QRadioButton( tr("SMESH_EDGE") , myElemTypeGroup))->setChecked(true); - new QRadioButton( tr("SMESH_FACE") , myElemTypeGroup); - new QRadioButton( tr("SMESH_VOLUME"), myElemTypeGroup); - + myElemTypeBox = new QGroupBox(tr("SMESH_ELEMENT_TYPE"), aMainGrp); + myElemTypeGroup = new QButtonGroup(aMainGrp); + QHBoxLayout* myElemTypeBoxLayout = new QHBoxLayout(myElemTypeBox); + myElemTypeBoxLayout->setMargin(MARGIN); + myElemTypeBoxLayout->setSpacing(SPACING); + + QRadioButton* aEdgeRb = new QRadioButton( tr("SMESH_EDGE"), myElemTypeBox); + QRadioButton* aFaceRb = new QRadioButton( tr("SMESH_FACE"), myElemTypeBox); + QRadioButton* aVolumeRb = new QRadioButton( tr("SMESH_VOLUME"), myElemTypeBox); + + myElemTypeBoxLayout->addWidget(aEdgeRb); + myElemTypeBoxLayout->addWidget(aFaceRb); + myElemTypeBoxLayout->addWidget(aVolumeRb); + myElemTypeGroup->addButton(aEdgeRb, 0); + myElemTypeGroup->addButton(aFaceRb, 1); + myElemTypeGroup->addButton(aVolumeRb, 2); + aEdgeRb->setChecked(true); + // element id - QLabel* anIdLabel = new QLabel( aMainGrp, "element id label"); - anIdLabel->setText( tr("ELEMENT_ID") ); - myElementId = new QLineEdit( aMainGrp, "element id"); - if (!myIsMultipleAllowed) - myElementId->setValidator( new SMESHGUI_IdValidator( theParent, "id validator", 1 )); - else - myElementId->setValidator( new SMESHGUI_IdValidator( theParent, "id validator" )); + QLabel* anIdLabel = new QLabel( tr("ELEMENT_ID"), aMainGrp ); + myElementId = new QLineEdit( aMainGrp ); + myElementId->setValidator( new SMESHGUI_IdValidator( theParent, + !myIsMultipleAllowed ? 1 : 0 ) ); // 0 for any number of entities // shape name - QLabel* aNameLabel = new QLabel( aMainGrp, "geom name label"); - aNameLabel->setText( tr("GEOMETRY_NAME") ); - myGeomName = new QLineEdit( aMainGrp, "geom name"); + QLabel* aNameLabel = new QLabel( tr("GEOMETRY_NAME"), aMainGrp ); + myGeomName = new QLineEdit( aMainGrp ); - aLayout->addMultiCellWidget(myElemTypeGroup, 0, 0, 0, 1); + aLayout->addWidget(myElemTypeBox, 0, 0, 1, 2); aLayout->addWidget(anIdLabel, 1, 0); aLayout->addWidget(myElementId, 1, 1); aLayout->addWidget(aNameLabel, 2, 0); @@ -140,13 +149,17 @@ QFrame* SMESHGUI_ShapeByMeshDlg::createMainFrame (QWidget* theParent) //======================================================================= SMESHGUI_ShapeByMeshDlg::~SMESHGUI_ShapeByMeshDlg() { - // no need to delete child widgets, Qt does it all for us +} + +void SMESHGUI_ShapeByMeshDlg:: setMultipleAllowed( bool isAllowed ) +{ + myIsMultipleAllowed = isAllowed; } //================================================================================ /*! * \brief Constructor -*/ + */ //================================================================================ SMESHGUI_ShapeByMeshOp::SMESHGUI_ShapeByMeshOp(bool isMultipleAllowed): myIsMultipleAllowed(isMultipleAllowed) @@ -157,7 +170,7 @@ SMESHGUI_ShapeByMeshOp::SMESHGUI_ShapeByMeshOp(bool isMultipleAllowed): myDlg = new SMESHGUI_ShapeByMeshDlg; myDlg->setMultipleAllowed(myIsMultipleAllowed); - connect(myDlg->myElemTypeGroup, SIGNAL(clicked(int)), SLOT(onTypeChanged(int))); + connect(myDlg->myElemTypeGroup, SIGNAL(buttonClicked(int)), SLOT(onTypeChanged(int))); connect(myDlg->myElementId, SIGNAL(textChanged(const QString&)), SLOT(onElemIdChanged(const QString&))); } @@ -182,7 +195,7 @@ void SMESHGUI_ShapeByMeshOp::startOperation() //================================================================================ /*! * \brief Destructor -*/ + */ //================================================================================ SMESHGUI_ShapeByMeshOp::~SMESHGUI_ShapeByMeshOp() { @@ -193,14 +206,19 @@ SMESHGUI_ShapeByMeshOp::~SMESHGUI_ShapeByMeshOp() //================================================================================ /*! * \brief Gets dialog of this operation - * \retval LightApp_Dialog* - pointer to dialog of this operation -*/ + * \retval LightApp_Dialog* - pointer to dialog of this operation + */ //================================================================================ LightApp_Dialog* SMESHGUI_ShapeByMeshOp::dlg() const { return myDlg; } +SMESH::SMESH_Mesh_ptr SMESHGUI_ShapeByMeshOp::GetMesh() +{ + return myMesh; +} + //======================================================================= // function : GetShape() // purpose : Get published sub-shape @@ -221,52 +239,52 @@ void SMESHGUI_ShapeByMeshOp::SetMesh (SMESH::SMESH_Mesh_ptr thePtr) myGeomObj = GEOM::GEOM_Object::_nil(); myHasSolids = false; - vector< bool > hasElement (myDlg->myElemTypeGroup->count(), false); + vector< bool > hasElement (myDlg->myElemTypeGroup->buttons().count(), false); if (!myMesh->_is_nil() ) - { -// _PTR(SObject) aSobj = SMESH::FindSObject(myMesh.in()); -// SUIT_DataOwnerPtr anIObj (new LightApp_DataOwner(aSobj->GetID().c_str())); - - vector< int > nbShapes( TopAbs_SHAPE, 0 ); - int shapeDim = 0; // max dim with several shapes - //if ( /*mySelectionMgr*/ selectionMgr()->isOk(anIObj) ) // check that the mesh has a valid shape { - _PTR(SObject) aSO = SMESH::FindSObject(myMesh.in()); - GEOM::GEOM_Object_var mainShape = SMESH::GetGeom(aSO); - if ( !mainShape->_is_nil() ) + // _PTR(SObject) aSobj = SMESH::FindSObject(myMesh.in()); + // SUIT_DataOwnerPtr anIObj (new LightApp_DataOwner(aSobj->GetID().c_str())); + + vector< int > nbShapes( TopAbs_SHAPE, 0 ); + int shapeDim = 0; // max dim with several shapes + //if ( /*mySelectionMgr*/ selectionMgr()->isOk(anIObj) ) // check that the mesh has a valid shape { - TopoDS_Shape aShape; - if ( GEOMBase::GetShape(mainShape, aShape)) - { - TopAbs_ShapeEnum types[4] = { TopAbs_EDGE, TopAbs_FACE, TopAbs_SHELL, TopAbs_SOLID }; - for ( int dim = 4; dim > 0; --dim ) { - TopAbs_ShapeEnum type = types[ dim - 1 ]; - TopAbs_ShapeEnum avoid = ( type == TopAbs_SHELL ) ? TopAbs_SOLID : TopAbs_SHAPE; - TopExp_Explorer exp( aShape, type, avoid ); - for ( ; nbShapes[ type ] < 2 && exp.More(); exp.Next() ) - ++nbShapes[ type ]; - if ( nbShapes[ type ] > 1 ) { - shapeDim = dim; - break; - } - } - } + _PTR(SObject) aSO = SMESH::FindSObject(myMesh.in()); + GEOM::GEOM_Object_var mainShape = SMESH::GetGeom(aSO); + if ( !mainShape->_is_nil() ) + { + TopoDS_Shape aShape; + if ( GEOMBase::GetShape(mainShape, aShape)) + { + TopAbs_ShapeEnum types[4] = { TopAbs_EDGE, TopAbs_FACE, TopAbs_SHELL, TopAbs_SOLID }; + for ( int dim = 4; dim > 0; --dim ) { + TopAbs_ShapeEnum type = types[ dim - 1 ]; + TopAbs_ShapeEnum avoid = ( type == TopAbs_SHELL ) ? TopAbs_SOLID : TopAbs_SHAPE; + TopExp_Explorer exp( aShape, type, avoid ); + for ( ; nbShapes[ type ] < 2 && exp.More(); exp.Next() ) + ++nbShapes[ type ]; + if ( nbShapes[ type ] > 1 ) { + shapeDim = dim; + break; + } + } + } + } } + if (shapeDim > 0) + { + if ( nbShapes[ TopAbs_SHELL ] + nbShapes[ TopAbs_SOLID ] > 1 ) + shapeDim = 3; + hasElement[ EDGE ] = shapeDim > 0 && myMesh->NbEdges(); + hasElement[ FACE ] = shapeDim > 1 && myMesh->NbFaces(); + hasElement[ VOLUME ] = shapeDim > 2 && myMesh->NbVolumes(); + } + myHasSolids = nbShapes[ TopAbs_SOLID ]; } - if (shapeDim > 0) - { - if ( nbShapes[ TopAbs_SHELL ] + nbShapes[ TopAbs_SOLID ] > 1 ) - shapeDim = 3; - hasElement[ EDGE ] = shapeDim > 0 && myMesh->NbEdges() ; - hasElement[ FACE ] = shapeDim > 1 && myMesh->NbFaces() ; - hasElement[ VOLUME ] = shapeDim > 2 && myMesh->NbVolumes(); - } - myHasSolids = nbShapes[ TopAbs_SOLID ]; - } // disable inexistant elem types - for ( int i = 0; i < myDlg->myElemTypeGroup->count(); ++i ) { - if ( QButton* button = myDlg->myElemTypeGroup->find( i ) ) + for ( int i = 0; i < myDlg->myElemTypeGroup->buttons().count(); ++i ) { + if ( QAbstractButton* button = myDlg->myElemTypeGroup->button( i ) ) button->setEnabled( hasElement[ i ] ); } myDlg->myElementId->setEnabled( hasElement[ EDGE ] ); @@ -284,12 +302,12 @@ void SMESHGUI_ShapeByMeshOp::commitOperation() { SMESHGUI_SelectionOp::commitOperation(); try { - QStringList aListId = QStringList::split( " ", myDlg->myElementId->text(), false); + QStringList aListId = myDlg->myElementId->text().split( " ", QString::SkipEmptyParts); if (aListId.count() == 1) { int elemID = (aListId.first()).toInt(); myGeomObj = SMESHGUI::GetSMESHGen()->GetGeometryByMeshElement - ( myMesh.in(), elemID, myDlg->myGeomName->text().latin1()); + ( myMesh.in(), elemID, myDlg->myGeomName->text().toLatin1().data()); } else { @@ -358,10 +376,11 @@ void SMESHGUI_ShapeByMeshOp::commitOperation() } // publish the GEOM object in study - QString aNewGeomGroupName ( myDlg->myGeomName->text().latin1() ); + QString aNewGeomGroupName ( myDlg->myGeomName->text() ); SALOMEDS::SObject_var aNewGroupSO = - geomGen->AddInStudy(SMESHGUI::GetSMESHGen()->GetCurrentStudy(), myGeomObj, aNewGeomGroupName, aMeshShape); + geomGen->AddInStudy(SMESHGUI::GetSMESHGen()->GetCurrentStudy(), myGeomObj, + aNewGeomGroupName.toLatin1().data(), aMeshShape); } } catch (const SALOME::SALOME_Exception& S_ex) { @@ -372,6 +391,11 @@ void SMESHGUI_ShapeByMeshOp::commitOperation() } +bool SMESHGUI_ShapeByMeshOp::onApply() +{ + return true; +} + //======================================================================= // function : onSelectionDone() // purpose : SLOT called when selection changed. Enable/desable [ OK ] @@ -417,7 +441,7 @@ void SMESHGUI_ShapeByMeshOp::activateSelection() QString geomName; Selection_Mode mode = EdgeSelection; - switch ( myDlg->myElemTypeGroup->id( myDlg->myElemTypeGroup->selected() )) { + switch ( myDlg->myElemTypeGroup->checkedId() ) { case EDGE : mode = EdgeSelection; geomName = tr("GEOM_EDGE"); break; case FACE : @@ -454,35 +478,39 @@ void SMESHGUI_ShapeByMeshOp::onElemIdChanged(const QString& theNewText) myDlg->setButtonEnabled( false, QtxDialog::OK ); if ( myIsManualIdEnter && !myMesh->_is_nil() ) + { if ( SMESH_Actor* actor = SMESH::FindActorByObject(myMesh) ) + { if ( SMDS_Mesh* aMesh = actor->GetObject()->GetMesh() ) { - SMDSAbs_ElementType type = SMDSAbs_Edge; - switch ( myDlg->myElemTypeGroup->id( myDlg->myElemTypeGroup->selected() )) { - case EDGE : type = SMDSAbs_Edge; break; - case FACE : type = SMDSAbs_Face; break; - case VOLUME: type = SMDSAbs_Volume; break; - default: return; - } - TColStd_MapOfInteger newIndices; - QStringList aListId = QStringList::split( " ", theNewText, false); - for ( int i = 0; i < aListId.count(); i++ ) { - if ( const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() )) - if ( e->GetType() == type ) - newIndices.Add( e->GetID() ); - } - + SMDSAbs_ElementType type = SMDSAbs_Edge; + switch ( myDlg->myElemTypeGroup->checkedId() ) { + case EDGE : type = SMDSAbs_Edge; break; + case FACE : type = SMDSAbs_Face; break; + case VOLUME: type = SMDSAbs_Volume; break; + default: return; + } + TColStd_MapOfInteger newIndices; + QStringList aListId = theNewText.split( " ", QString::SkipEmptyParts); + for ( int i = 0; i < aListId.count(); i++ ) { + if ( const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() )) + if ( e->GetType() == type ) + newIndices.Add( e->GetID() ); + } + if ( !newIndices.IsEmpty() ) - { - if (!myIsMultipleAllowed && newIndices.Extent() != 1) - return; - if ( SVTK_Selector* s = selector() ) { - s->AddOrRemoveIndex( actor->getIO(), newIndices, false ); - viewWindow()->highlight( actor->getIO(), true, true ); - myDlg->setButtonEnabled( true, QtxDialog::OK ); - } + { + if (!myIsMultipleAllowed && newIndices.Extent() != 1) + return; + if ( SVTK_Selector* s = selector() ) { + s->AddOrRemoveIndex( actor->getIO(), newIndices, false ); + viewWindow()->highlight( actor->getIO(), true, true ); + myDlg->setButtonEnabled( true, QtxDialog::OK ); } + } } + } + } } //======================================================================= diff --git a/src/SMESHGUI/SMESHGUI_ShapeByMeshDlg.h b/src/SMESHGUI/SMESHGUI_ShapeByMeshDlg.h index 222a38bba..f49abb6bf 100644 --- a/src/SMESHGUI/SMESHGUI_ShapeByMeshDlg.h +++ b/src/SMESHGUI/SMESHGUI_ShapeByMeshDlg.h @@ -1,50 +1,43 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_ShapeByMeshDlg.h +// Author : Edward AGAPOV, Open CASCADE S.A.S. // -// -// File : SMESHGUI_ShapeByMeshDlg.h -// Author : Edward AGAPOV -// Module : SMESH - -#ifndef SMESHGUI_ShapeByMeshDlg_H -#define SMESHGUI_ShapeByMeshDlg_H +#ifndef SMESHGUI_SHAPEBYMESHDLG_H +#define SMESHGUI_SHAPEBYMESHDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" #include "SMESHGUI_Dialog.h" #include "SMESHGUI_SelectionOp.h" -// IDL Headers +// IDL includes #include -#include CORBA_SERVER_HEADER(GEOM_Gen) #include CORBA_SERVER_HEADER(SMESH_Mesh) -class QCloseEvent; class QFrame; class QLineEdit; -class QPushButton; -class LightApp_SelectionMgr; -class SVTK_ViewWindow; class QButtonGroup; -class SMESHGUI; +class QGroupBox; /*! * \brief Dialog to publish a sub-shape of the mesh main shape @@ -56,19 +49,19 @@ class SMESHGUI_EXPORT SMESHGUI_ShapeByMeshDlg : public SMESHGUI_Dialog Q_OBJECT public: - SMESHGUI_ShapeByMeshDlg(); - virtual ~SMESHGUI_ShapeByMeshDlg(); + SMESHGUI_ShapeByMeshDlg(); + virtual ~SMESHGUI_ShapeByMeshDlg(); private: + QFrame* createMainFrame( QWidget* ); - QFrame* createMainFrame (QWidget*); - + QGroupBox* myElemTypeBox; QButtonGroup* myElemTypeGroup; QLineEdit* myElementId; QLineEdit* myGeomName; bool myIsMultipleAllowed; - void setMultipleAllowed(bool isAllowed) {myIsMultipleAllowed = isAllowed;}; + void setMultipleAllowed( bool ); friend class SMESHGUI_ShapeByMeshOp; }; @@ -82,36 +75,32 @@ class SMESHGUI_ShapeByMeshOp: public SMESHGUI_SelectionOp Q_OBJECT public: - SMESHGUI_ShapeByMeshOp(bool isMultipleAllowed = false); + SMESHGUI_ShapeByMeshOp( bool = false ); virtual ~SMESHGUI_ShapeByMeshOp(); - virtual LightApp_Dialog* dlg() const; + virtual LightApp_Dialog* dlg() const; void Init(); - void SetMesh (SMESH::SMESH_Mesh_ptr); - SMESH::SMESH_Mesh_ptr GetMesh () { return myMesh; } + void SetMesh( SMESH::SMESH_Mesh_ptr ); + SMESH::SMESH_Mesh_ptr GetMesh(); GEOM::GEOM_Object_ptr GetShape(); protected: - - virtual void commitOperation(); - virtual void startOperation(); + virtual void commitOperation(); + virtual void startOperation(); void activateSelection(); - void setElementID(const QString&); + void setElementID( const QString& ); protected slots: - - virtual bool onApply() { return true; } + virtual bool onApply(); private slots: - void onSelectionDone(); - void onTypeChanged (int); - void onElemIdChanged (const QString&); + void onTypeChanged( int ); + void onElemIdChanged( const QString& ); private: - SMESHGUI_ShapeByMeshDlg* myDlg; SMESH::SMESH_Mesh_var myMesh; GEOM::GEOM_Object_var myGeomObj; diff --git a/src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx b/src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx index 201b1c126..43e14a203 100755 --- a/src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx @@ -1,72 +1,65 @@ -// SMESH SMESHGUI : GUI for SMESH component +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_SingleEditDlg.cxx +// Author : Sergey LITONIN, Open CASCADE S.A.S. // -// -// File : SMESHGUI_SingleEditDlg.cxx -// Author : Sergey LITONIN -// Module : SMESH +// SMESH includes #include "SMESHGUI_SingleEditDlg.h" #include "SMESHGUI.h" #include "SMESHGUI_Utils.h" #include "SMESHGUI_VTKUtils.h" #include "SMESHGUI_MeshUtils.h" -#include "SMESHGUI_SpinBox.h" -#include "SMESH_Actor.h" -#include "SMDS_Mesh.hxx" +#include +#include -#include "LightApp_SelectionMgr.h" -#include "LightApp_Application.h" -#include "SUIT_ResourceMgr.h" -#include "SUIT_MessageBox.h" -#include "SUIT_Desktop.h" -#include "SUIT_Session.h" +// SALOME GUI includes +#include +#include +#include +#include +#include +#include -#include "SVTK_Selector.h" -#include "SVTK_ViewWindow.h" -#include "SALOME_ListIO.hxx" +#include +#include +#include -#include "utilities.h" - -// OCCT Includes +// OCCT includes #include #include -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include - - -#define SPACING 5 -#define MARGIN 10 +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#define SPACING 6 +#define MARGIN 11 /*! * Class : SMESHGUI_DiagValidator @@ -74,19 +67,19 @@ */ class SMESHGUI_DiagValidator: public QValidator { - public: - SMESHGUI_DiagValidator (QWidget * parent, const char * name = 0): - QValidator(parent,name) {} +public: + SMESHGUI_DiagValidator (QWidget* parent): + QValidator(parent) {} - State validate (QString & text, int & pos) const + State validate (QString& text, int& pos) const { - text.stripWhiteSpace(); + text = text.trimmed(); text.replace(QRegExp("[^0-9]+"), "-"); if (text == "-") text = ""; - int ind = text.find(QRegExp("-[0-9]+-")); + int ind = text.indexOf(QRegExp("-[0-9]+-")); if (ind > 0) { // leave only two ids - ind = text.find('-', ind + 1); + ind = text.indexOf('-', ind + 1); if (ind > 0) text.truncate(ind); } @@ -107,26 +100,24 @@ class SMESHGUI_DiagValidator: public QValidator // Purpose : Constructor //======================================================================= SMESHGUI_SingleEditDlg -::SMESHGUI_SingleEditDlg(SMESHGUI* theModule, - const char* theName): - QDialog(SMESH::GetDesktop(theModule), - theName, - false, - WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), +::SMESHGUI_SingleEditDlg(SMESHGUI* theModule) + : QDialog(SMESH::GetDesktop(theModule)), mySelector(SMESH::GetViewWindow(theModule)->GetSelector()), mySelectionMgr(SMESH::GetSelectionMgr(theModule)), mySMESHGUI(theModule) { - QVBoxLayout* aDlgLay = new QVBoxLayout(this, MARGIN, SPACING); + setModal(false); + + QVBoxLayout* aDlgLay = new QVBoxLayout(this); + aDlgLay->setMargin(MARGIN); + aDlgLay->setSpacing(SPACING); - QFrame* aMainFrame = createMainFrame (this); - QFrame* aBtnFrame = createButtonFrame(this); + QWidget* aMainFrame = createMainFrame (this); + QWidget* aBtnFrame = createButtonFrame(this); aDlgLay->addWidget(aMainFrame); aDlgLay->addWidget(aBtnFrame); - aDlgLay->setStretchFactor(aMainFrame, 1); - Init(); } @@ -134,16 +125,24 @@ SMESHGUI_SingleEditDlg // name : createMainFrame() // Purpose : Create frame containing dialog's input fields //======================================================================= -QFrame* SMESHGUI_SingleEditDlg::createMainFrame (QWidget* theParent) +QWidget* SMESHGUI_SingleEditDlg::createMainFrame (QWidget* theParent) { - QGroupBox* aMainGrp = new QGroupBox(1, Qt::Vertical, tr("EDGE_BETWEEN"), theParent); + QGroupBox* aMainGrp = new QGroupBox(tr("EDGE_BETWEEN"), theParent); + QHBoxLayout* aLay = new QHBoxLayout(aMainGrp); + aLay->setMargin(MARGIN); + aLay->setSpacing(SPACING); QPixmap aPix (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT"))); - new QLabel(tr("SMESH_EDGE"), aMainGrp); - (new QPushButton(aMainGrp))->setPixmap(aPix); + QLabel* aLab = new QLabel(tr("SMESH_EDGE"), aMainGrp); + QPushButton* aBtn = new QPushButton(aMainGrp); + aBtn->setIcon(aPix); myEdge = new QLineEdit(aMainGrp); - myEdge->setValidator(new SMESHGUI_DiagValidator(this, "validator")); + myEdge->setValidator(new SMESHGUI_DiagValidator(this)); + + aLay->addWidget(aLab); + aLay->addWidget(aBtn); + aLay->addWidget(myEdge); return aMainGrp; } @@ -152,23 +151,24 @@ QFrame* SMESHGUI_SingleEditDlg::createMainFrame (QWidget* theParent) // name : createButtonFrame() // Purpose : Create frame containing buttons //======================================================================= -QFrame* SMESHGUI_SingleEditDlg::createButtonFrame (QWidget* theParent) +QWidget* SMESHGUI_SingleEditDlg::createButtonFrame (QWidget* theParent) { - QFrame* aFrame = new QFrame(theParent); - aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken); + QGroupBox* aFrame = new QGroupBox(theParent); myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), aFrame); myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame); myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame); - myHelpBtn = new QPushButton (tr("SMESH_BUT_HELP"), aFrame); - - QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); + myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aFrame); - QHBoxLayout* aLay = new QHBoxLayout(aFrame, MARGIN, SPACING); + QHBoxLayout* aLay = new QHBoxLayout(aFrame); + aLay->setMargin(MARGIN); + aLay->setSpacing(SPACING); aLay->addWidget(myOkBtn); + aLay->addSpacing(10); aLay->addWidget(myApplyBtn); - aLay->addItem(aSpacer); + aLay->addSpacing(10); + aLay->addStretch(); aLay->addWidget(myCloseBtn); aLay->addWidget(myHelpBtn); @@ -238,8 +238,6 @@ void SMESHGUI_SingleEditDlg::Init() myApplyBtn->setEnabled(false); setEnabled(true); - this->show(); - // set selection mode if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->SetSelectionMode(EdgeOfCellSelection); @@ -283,16 +281,17 @@ void SMESHGUI_SingleEditDlg::onHelp() if (app) app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); else { - QString platform; + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName)); } } @@ -358,7 +357,7 @@ void SMESHGUI_SingleEditDlg::onTextChange (const QString& theNewText) mySelector->GetIndex(anIO,selectedIndices); myBusy = false; - QStringList aListId = QStringList::split("-", theNewText, false); + QStringList aListId = theNewText.split("-", QString::SkipEmptyParts); if (aListId.count() != 2) return; @@ -515,10 +514,9 @@ bool SMESHGUI_SingleEditDlg::onApply() SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(aList.First()); if (aMesh->_is_nil()) { - SUIT_MessageBox::info1(SMESH::GetDesktop(mySMESHGUI), - tr("SMESH_ERROR"), - tr("SMESHG_NO_MESH"), - tr("SMESH_BUT_OK")); + SUIT_MessageBox::information(SMESH::GetDesktop(mySMESHGUI), + tr("SMESH_ERROR"), + tr("SMESHG_NO_MESH")); return false; } @@ -551,11 +549,10 @@ void SMESHGUI_SingleEditDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) - { - e->accept(); - onHelp(); - } + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + onHelp(); + } } /*! @@ -565,11 +562,10 @@ void SMESHGUI_SingleEditDlg::keyPressEvent( QKeyEvent* e ) */ SMESHGUI_TrianglesInversionDlg -::SMESHGUI_TrianglesInversionDlg(SMESHGUI* theModule, - const char* theName) -: SMESHGUI_SingleEditDlg(theModule,theName) +::SMESHGUI_TrianglesInversionDlg(SMESHGUI* theModule) +: SMESHGUI_SingleEditDlg(theModule) { - setCaption(tr("CAPTION")); + setWindowTitle(tr("CAPTION")); myHelpFileName = "diagonal_inversion_of_elements_page.html"; } @@ -590,11 +586,10 @@ bool SMESHGUI_TrianglesInversionDlg::process (SMESH::SMESH_MeshEditor_ptr theMes */ SMESHGUI_UnionOfTwoTrianglesDlg -::SMESHGUI_UnionOfTwoTrianglesDlg(SMESHGUI* theModule, - const char* theName) -: SMESHGUI_SingleEditDlg(theModule,theName) +::SMESHGUI_UnionOfTwoTrianglesDlg(SMESHGUI* theModule) +: SMESHGUI_SingleEditDlg(theModule) { - setCaption(tr("CAPTION")); + setWindowTitle(tr("CAPTION")); myHelpFileName = "uniting_two_triangles_page.html"; } diff --git a/src/SMESHGUI/SMESHGUI_SingleEditDlg.h b/src/SMESHGUI/SMESHGUI_SingleEditDlg.h index 1faf1416c..00fe956b1 100755 --- a/src/SMESHGUI/SMESHGUI_SingleEditDlg.h +++ b/src/SMESHGUI/SMESHGUI_SingleEditDlg.h @@ -1,50 +1,45 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_SingleEditDlg.h +// Author : Sergey LITONIN, Open CASCADE S.A.S. // -// File : SMESHGUI_SingleEditDlg.h -// Author : Sergey LITONIN -// Module : SMESH - -#ifndef SMESHGUI_SingleEditDlg_H -#define SMESHGUI_SingleEditDlg_H +#ifndef SMESHGUI_SINGLEEDITDLG_H +#define SMESHGUI_SINGLEEDITDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include +// Qt includes +#include +// IDL includes #include -#include CORBA_SERVER_HEADER(SMESH_Mesh) #include CORBA_SERVER_HEADER(SMESH_MeshEditor) -class QCloseEvent; -class QFrame; class QLineEdit; -class SMESHGUI_SpinBox; class QPushButton; class SMESHGUI; class SMESH_Actor; class SVTK_Selector; -class SVTK_ViewWindow; class LightApp_SelectionMgr; /*! @@ -57,11 +52,10 @@ class SMESHGUI_EXPORT SMESHGUI_SingleEditDlg : public QDialog Q_OBJECT public: - SMESHGUI_SingleEditDlg(SMESHGUI* theModule, - const char* theName = 0); + SMESHGUI_SingleEditDlg( SMESHGUI* ); virtual ~SMESHGUI_SingleEditDlg(); - void Init(); + void Init(); protected slots: void onOk(); @@ -72,18 +66,18 @@ protected slots: void onDeactivate(); void onSelectionDone(); - void onTextChange (const QString&); + void onTextChange( const QString& ); protected: - void closeEvent (QCloseEvent*); - void enterEvent (QEvent*); - void hideEvent (QHideEvent*); /* ESC key */ - void keyPressEvent(QKeyEvent*); - QFrame* createButtonFrame (QWidget*); - QFrame* createMainFrame (QWidget*); - bool isValid (const bool) const; - bool getNodeIds (const QString&, int&, int&) const; - virtual bool process (SMESH::SMESH_MeshEditor_ptr, const int, const int) = 0; + void closeEvent( QCloseEvent* ); + void enterEvent( QEvent* ); + void hideEvent( QHideEvent* ); /* ESC key */ + void keyPressEvent( QKeyEvent* ); + QWidget* createButtonFrame( QWidget* ); + QWidget* createMainFrame( QWidget* ); + bool isValid( const bool ) const; + bool getNodeIds( const QString&, int&, int& ) const; + virtual bool process( SMESH::SMESH_MeshEditor_ptr, const int, const int ) = 0; protected: bool myBusy; @@ -111,12 +105,11 @@ class SMESHGUI_TrianglesInversionDlg : public SMESHGUI_SingleEditDlg Q_OBJECT public: - SMESHGUI_TrianglesInversionDlg(SMESHGUI* theModule, - const char* theName = 0); + SMESHGUI_TrianglesInversionDlg( SMESHGUI* ); virtual ~SMESHGUI_TrianglesInversionDlg(); protected: - virtual bool process (SMESH::SMESH_MeshEditor_ptr, const int, const int); + virtual bool process( SMESH::SMESH_MeshEditor_ptr, const int, const int ); }; /*! @@ -129,12 +122,11 @@ class SMESHGUI_UnionOfTwoTrianglesDlg : public SMESHGUI_SingleEditDlg Q_OBJECT public: - SMESHGUI_UnionOfTwoTrianglesDlg(SMESHGUI* theModule, - const char* theName = 0); + SMESHGUI_UnionOfTwoTrianglesDlg( SMESHGUI* ); virtual ~SMESHGUI_UnionOfTwoTrianglesDlg(); protected: - virtual bool process (SMESH::SMESH_MeshEditor_ptr, const int, const int); + virtual bool process( SMESH::SMESH_MeshEditor_ptr, const int, const int ); }; -#endif +#endif // SMESHGUI_SINGLEEDITDLG_H diff --git a/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx b/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx index d46673b73..ef8eb7f46 100644 --- a/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx @@ -1,31 +1,29 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_SmoothingDlg.cxx +// Author : Michael ZORIN, Open CASCADE S.A.S. // -// -// File : SMESHGUI_SmoothingDlg.cxx -// Author : Michael ZORIN -// Module : SMESH -// $Header: +// SMESH includes #include "SMESHGUI_SmoothingDlg.h" #include "SMESHGUI.h" @@ -35,222 +33,186 @@ #include "SMESHGUI_SpinBox.h" #include "SMESHGUI_IdValidator.h" -#include "SMESH_Actor.h" -#include "SMESH_TypeFilter.hxx" -#include "SMESH_NumberFilter.hxx" -#include "SMESH_LogicalFilter.hxx" - -#include "SMDS_Mesh.hxx" +#include +#include +#include -#include "SUIT_ResourceMgr.h" -#include "SUIT_OverrideCursor.h" -#include "SUIT_Desktop.h" -#include "SUIT_Session.h" -#include "SUIT_MessageBox.h" +#include -#include "LightApp_Application.h" +// SALOME GUI includes +#include +#include +#include +#include +#include -#include "SVTK_ViewModel.h" -#include "SVTK_Selector.h" -#include "SVTK_ViewWindow.h" -#include "SVTK_Selection.h" -#include "SALOME_ListIO.hxx" +#include +#include -#include "utilities.h" +#include +#include +#include +#include +#include -// OCCT Includes +// OCCT includes #include -#include - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// IDL Headers -#include "SALOMEconfig.h" + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// IDL includes +#include #include CORBA_SERVER_HEADER(SMESH_Group) #include CORBA_SERVER_HEADER(SMESH_MeshEditor) -using namespace std; +#define SPACING 6 +#define MARGIN 11 //================================================================================= // function : SMESHGUI_SmoothingDlg() // purpose : constructor //================================================================================= -SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule, const char* name, - bool modal, WFlags fl) - : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | - WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose), - mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) +SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule ) + : QDialog( SMESH::GetDesktop( theModule ) ), + mySMESHGUI( theModule ), + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) { QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_SMOOTHING"))); QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT"))); - if (!name) - setName("SMESHGUI_SmoothingDlg"); - resize(303, 185); - setCaption(tr("SMESH_SMOOTHING")); - setSizeGripEnabled(TRUE); - SMESHGUI_SmoothingDlgLayout = new QGridLayout(this); - SMESHGUI_SmoothingDlgLayout->setSpacing(6); - SMESHGUI_SmoothingDlgLayout->setMargin(11); + setModal(false); + setAttribute(Qt::WA_DeleteOnClose, true); + setWindowTitle(tr("SMESH_SMOOTHING")); + setSizeGripEnabled(true); /***************************************************************/ - GroupConstructors = new QButtonGroup(this, "GroupConstructors"); - GroupConstructors->setTitle(tr("SMESH_SMOOTHING" )); - GroupConstructors->setExclusive(TRUE); - GroupConstructors->setColumnLayout(0, Qt::Vertical); - GroupConstructors->layout()->setSpacing(0); - GroupConstructors->layout()->setMargin(0); - GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout()); - GroupConstructorsLayout->setAlignment(Qt::AlignTop); - GroupConstructorsLayout->setSpacing(6); - GroupConstructorsLayout->setMargin(11); - Constructor1 = new QRadioButton(GroupConstructors, "Constructor1"); - Constructor1->setText(tr("" )); - Constructor1->setPixmap(image0); - Constructor1->setChecked(TRUE); - Constructor1->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)1, - (QSizePolicy::SizeType)0, - Constructor1->sizePolicy().hasHeightForWidth())); - Constructor1->setMinimumSize(QSize(50, 0)); - GroupConstructorsLayout->addWidget(Constructor1, 0, 0); - QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - GroupConstructorsLayout->addItem(spacer, 0, 1); - SMESHGUI_SmoothingDlgLayout->addWidget(GroupConstructors, 0, 0); + QVBoxLayout* SMESHGUI_SmoothingDlgLayout = new QVBoxLayout(this); + SMESHGUI_SmoothingDlgLayout->setSpacing(SPACING); + SMESHGUI_SmoothingDlgLayout->setMargin(MARGIN); /***************************************************************/ - GroupButtons = new QGroupBox(this, "GroupButtons"); - GroupButtons->setGeometry(QRect(10, 10, 281, 48)); - GroupButtons->setTitle(tr("")); - GroupButtons->setColumnLayout(0, Qt::Vertical); - GroupButtons->layout()->setSpacing(0); - GroupButtons->layout()->setMargin(0); - GroupButtonsLayout = new QGridLayout(GroupButtons->layout()); - GroupButtonsLayout->setAlignment(Qt::AlignTop); - GroupButtonsLayout->setSpacing(6); - GroupButtonsLayout->setMargin(11); - buttonHelp = new QPushButton(GroupButtons, "buttonHelp"); - buttonHelp->setText(tr("SMESH_BUT_HELP" )); - buttonHelp->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonHelp, 0, 4); - buttonCancel = new QPushButton(GroupButtons, "buttonCancel"); - buttonCancel->setText(tr("SMESH_BUT_CLOSE" )); - buttonCancel->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonCancel, 0, 3); - buttonApply = new QPushButton(GroupButtons, "buttonApply"); - buttonApply->setText(tr("SMESH_BUT_APPLY" )); - buttonApply->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonApply, 0, 1); - QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - GroupButtonsLayout->addItem(spacer_9, 0, 2); - buttonOk = new QPushButton(GroupButtons, "buttonOk"); - buttonOk->setText(tr("SMESH_BUT_OK" )); - buttonOk->setAutoDefault(TRUE); - buttonOk->setDefault(TRUE); - GroupButtonsLayout->addWidget(buttonOk, 0, 0); - SMESHGUI_SmoothingDlgLayout->addWidget(GroupButtons, 2, 0); + GroupConstructors = new QGroupBox(tr("SMESH_SMOOTHING"), this); + QHBoxLayout* GroupConstructorsLayout = new QHBoxLayout(GroupConstructors); + GroupConstructorsLayout->setSpacing(SPACING); + GroupConstructorsLayout->setMargin(MARGIN); + + Constructor1 = new QRadioButton(GroupConstructors); + Constructor1->setIcon(image0); + Constructor1->setChecked(true); + GroupConstructorsLayout->addWidget(Constructor1); + GroupConstructorsLayout->addStretch(); /***************************************************************/ - GroupArguments = new QGroupBox(this, "GroupArguments"); - GroupArguments->setTitle(tr("SMESH_ARGUMENTS")); - GroupArguments->setColumnLayout(0, Qt::Vertical); - GroupArguments->layout()->setSpacing(0); - GroupArguments->layout()->setMargin(0); - GroupArgumentsLayout = new QGridLayout(GroupArguments->layout()); - GroupArgumentsLayout->setAlignment(Qt::AlignTop); - GroupArgumentsLayout->setSpacing(6); - GroupArgumentsLayout->setMargin(11); + GroupArguments = new QGroupBox(tr("SMESH_ARGUMENTS"), this); + QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments); + GroupArgumentsLayout->setSpacing(SPACING); + GroupArgumentsLayout->setMargin(MARGIN); // Controls for elements selection - TextLabelElements = new QLabel(GroupArguments, "TextLabelElements"); - TextLabelElements->setText(tr("SMESH_ID_ELEMENTS" )); - GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0); + TextLabelElements = new QLabel(tr("SMESH_ID_ELEMENTS"), GroupArguments); - SelectElementsButton = new QPushButton(GroupArguments, "SelectElementsButton"); - SelectElementsButton->setText(tr("" )); - SelectElementsButton->setPixmap(image1); - SelectElementsButton->setToggleButton(FALSE); - GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1); + SelectElementsButton = new QPushButton(GroupArguments); + SelectElementsButton->setIcon(image1); - LineEditElements = new QLineEdit(GroupArguments, "LineEditElements"); - LineEditElements->setValidator(new SMESHGUI_IdValidator(this, "validator")); - GroupArgumentsLayout->addWidget(LineEditElements, 0, 2); + LineEditElements = new QLineEdit(GroupArguments); + LineEditElements->setValidator(new SMESHGUI_IdValidator(this)); // Control for the whole mesh selection - CheckBoxMesh = new QCheckBox(GroupArguments, "CheckBoxMesh"); - CheckBoxMesh->setText(tr("SMESH_SELECT_WHOLE_MESH")); - GroupArgumentsLayout->addMultiCellWidget(CheckBoxMesh, 1, 1, 0, 2); + CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments); // Controls for nodes selection - TextLabelNodes = new QLabel(GroupArguments, "TextLabelNodes"); - TextLabelNodes->setText(tr("FIXED_NODES_IDS")); - GroupArgumentsLayout->addWidget(TextLabelNodes, 2, 0); + TextLabelNodes = new QLabel(tr("FIXED_NODES_IDS"), GroupArguments); - SelectNodesButton = new QPushButton(GroupArguments, "SelectNodesButton"); - SelectNodesButton->setText(tr("" )); - SelectNodesButton->setPixmap(image1); - SelectNodesButton->setToggleButton(FALSE); - GroupArgumentsLayout->addWidget(SelectNodesButton, 2, 1); + SelectNodesButton = new QPushButton(GroupArguments); + SelectNodesButton->setIcon(image1); - LineEditNodes = new QLineEdit(GroupArguments, "LineEditNodes"); - LineEditNodes->setValidator(new SMESHGUI_IdValidator(this, "validator")); - GroupArgumentsLayout->addWidget(LineEditNodes, 2, 2); + LineEditNodes = new QLineEdit(GroupArguments); + LineEditNodes->setValidator(new SMESHGUI_IdValidator(this)); // Controls for method selection - TextLabelMethod = new QLabel(GroupArguments, "TextLabelMethod"); - TextLabelMethod->setText(tr("METHOD" )); - GroupArgumentsLayout->addMultiCellWidget(TextLabelMethod, 3, 3, 0, 1); + TextLabelMethod = new QLabel(tr("METHOD"), GroupArguments); - ComboBoxMethod = new QComboBox(GroupArguments, "ComboBoxMethod"); - GroupArgumentsLayout->addWidget(ComboBoxMethod, 3, 2); + ComboBoxMethod = new QComboBox(GroupArguments); // Controls for iteration limit defining - TextLabelLimit = new QLabel(GroupArguments, "TextLabelLimit"); - TextLabelLimit->setText(tr("ITERATION_LIMIT" )); - GroupArgumentsLayout->addMultiCellWidget(TextLabelLimit, 4, 4, 0, 1); + TextLabelLimit = new QLabel(tr("ITERATION_LIMIT"), GroupArguments); - SpinBox_IterationLimit = new QSpinBox(GroupArguments, "SpinBox_IterationLimit"); - GroupArgumentsLayout->addWidget(SpinBox_IterationLimit, 4, 2); + SpinBox_IterationLimit = new QSpinBox(GroupArguments); // Controls for max. aspect ratio defining - TextLabelAspectRatio = new QLabel(GroupArguments, "TextLabelAspectRatio"); - TextLabelAspectRatio->setText(tr("MAX_ASPECT_RATIO")); - GroupArgumentsLayout->addMultiCellWidget(TextLabelAspectRatio, 5, 5, 0, 1); + TextLabelAspectRatio = new QLabel(tr("MAX_ASPECT_RATIO"), GroupArguments); - SpinBox_AspectRatio = new SMESHGUI_SpinBox(GroupArguments, "SpinBox_AspectRatio"); - GroupArgumentsLayout->addWidget(SpinBox_AspectRatio, 5, 2); + SpinBox_AspectRatio = new SMESHGUI_SpinBox(GroupArguments); // Check box "Is Parametric" - CheckBoxParametric = new QCheckBox( GroupArguments, "CheckBoxParametric" ); - CheckBoxParametric->setText( tr( "IS_PARAMETRIC" ) ); - GroupArgumentsLayout->addMultiCellWidget( CheckBoxParametric, 6, 6, 0, 2 ); + CheckBoxParametric = new QCheckBox( tr("IS_PARAMETRIC"), GroupArguments ); + + GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0); + GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1); + GroupArgumentsLayout->addWidget(LineEditElements, 0, 2); + GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 3); + GroupArgumentsLayout->addWidget(TextLabelNodes, 2, 0); + GroupArgumentsLayout->addWidget(SelectNodesButton, 2, 1); + GroupArgumentsLayout->addWidget(LineEditNodes, 2, 2); + GroupArgumentsLayout->addWidget(TextLabelMethod, 3, 0); + GroupArgumentsLayout->addWidget(ComboBoxMethod, 3, 2); + GroupArgumentsLayout->addWidget(TextLabelLimit, 4, 0); + GroupArgumentsLayout->addWidget(SpinBox_IterationLimit, 4, 2); + GroupArgumentsLayout->addWidget(TextLabelAspectRatio, 5, 0); + GroupArgumentsLayout->addWidget(SpinBox_AspectRatio, 5, 2); + GroupArgumentsLayout->addWidget(CheckBoxParametric, 6, 0, 1, 3); + /***************************************************************/ + GroupButtons = new QGroupBox(this); + QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons); + GroupButtonsLayout->setSpacing(SPACING); + GroupButtonsLayout->setMargin(MARGIN); + + buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk->setAutoDefault(true); + buttonOk->setDefault(true); + buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); + buttonApply->setAutoDefault(true); + buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons); + buttonCancel->setAutoDefault(true); + buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons); + buttonHelp->setAutoDefault(true); + + GroupButtonsLayout->addWidget(buttonOk); + GroupButtonsLayout->addSpacing(10); + GroupButtonsLayout->addWidget(buttonApply); + GroupButtonsLayout->addSpacing(10); + GroupButtonsLayout->addStretch(); + GroupButtonsLayout->addWidget(buttonCancel); + GroupButtonsLayout->addWidget(buttonHelp); - SMESHGUI_SmoothingDlgLayout->addWidget(GroupArguments, 1, 0); + /***************************************************************/ + SMESHGUI_SmoothingDlgLayout->addWidget(GroupConstructors); + SMESHGUI_SmoothingDlgLayout->addWidget(GroupArguments); + SMESHGUI_SmoothingDlgLayout->addWidget(GroupButtons); + /***************************************************************/ /* Initialisations */ - ComboBoxMethod->insertItem(tr("LAPLACIAN")); - ComboBoxMethod->insertItem(tr("CENTROIDAL")); + ComboBoxMethod->addItem(tr("LAPLACIAN")); + ComboBoxMethod->addItem(tr("CENTROIDAL")); - ComboBoxMethod->setCurrentItem(0); + ComboBoxMethod->setCurrentIndex(0); - CheckBoxParametric->setChecked( TRUE ); + CheckBoxParametric->setChecked( true ); - QIntValidator* anIntValidator = new QIntValidator(SpinBox_IterationLimit); - SpinBox_IterationLimit->setValidator(anIntValidator); SpinBox_IterationLimit->setRange(1, 999999); SpinBox_IterationLimit->setValue(20); SpinBox_AspectRatio->RangeStepAndValidator(0.0, +999999.999, 0.1, 3); @@ -258,7 +220,7 @@ SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule, const char* n GroupArguments->show(); myConstructorId = 0; - Constructor1->setChecked(TRUE); + Constructor1->setChecked(true); mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); @@ -268,7 +230,7 @@ SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule, const char* n SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH); SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter (GROUP); - QPtrList aListOfFilters; + QList aListOfFilters; if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter); if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter); @@ -285,7 +247,6 @@ SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule, const char* n connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); - connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int))); connect(SelectElementsButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument())); connect(SelectNodesButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument())); @@ -299,10 +260,6 @@ SMESHGUI_SmoothingDlg::SMESHGUI_SmoothingDlg( SMESHGUI* theModule, const char* n SLOT(onTextChange(const QString&))); connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool))); - - /***************************************************************/ - - this->show(); // displays Dialog } //================================================================================= @@ -341,14 +298,6 @@ void SMESHGUI_SmoothingDlg::Init() onSelectMesh(false); } -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void SMESHGUI_SmoothingDlg::ConstructorsClicked (int constructorId) -{ -} - //================================================================================= // function : ClickOnApply() // purpose : Called when user presses button @@ -359,9 +308,9 @@ void SMESHGUI_SmoothingDlg::ClickOnApply() return; if (myNbOkElements && - (myNbOkNodes || LineEditNodes->text().stripWhiteSpace().isEmpty())) { - QStringList aListElementsId = QStringList::split(" ", myElementsId, false); - QStringList aListNodesId = QStringList::split(" ", LineEditNodes->text(), false); + (myNbOkNodes || LineEditNodes->text().trimmed().isEmpty())) { + QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts); + QStringList aListNodesId = LineEditNodes->text().split(" ", QString::SkipEmptyParts); SMESH::long_array_var anElementsId = new SMESH::long_array; SMESH::long_array_var aNodesId = new SMESH::long_array; @@ -382,13 +331,13 @@ void SMESHGUI_SmoothingDlg::ClickOnApply() double aMaxAspectRatio = SpinBox_AspectRatio->GetValue(); SMESH::SMESH_MeshEditor::Smooth_Method aMethod = SMESH::SMESH_MeshEditor::LAPLACIAN_SMOOTH; - if (ComboBoxMethod->currentItem() > 0) + if (ComboBoxMethod->currentIndex() > 0) aMethod = SMESH::SMESH_MeshEditor::CENTROIDAL_SMOOTH; bool aResult = false; try { SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); - QApplication::setOverrideCursor(Qt::waitCursor); + QApplication::setOverrideCursor(Qt::WaitCursor); if ( CheckBoxParametric->isChecked() ) aResult = aMeshEditor->SmoothParametric(anElementsId.inout(), aNodesId.inout(), anIterationLimit, aMaxAspectRatio, aMethod); @@ -448,16 +397,17 @@ void SMESHGUI_SmoothingDlg::ClickOnHelp() if (app) app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); else { - QString platform; + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName)); } } @@ -490,7 +440,7 @@ void SMESHGUI_SmoothingDlg::onTextChange (const QString& theNewText) if (aMesh) { - QStringList aListId = QStringList::split(" ", theNewText, false); + QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts); if (send == LineEditElements) { const Handle(SALOME_InteractiveObject)& anIO = myActor->getIO(); @@ -521,7 +471,7 @@ void SMESHGUI_SmoothingDlg::onTextChange (const QString& theNewText) } } - if (myNbOkElements && (myNbOkNodes || LineEditNodes->text().stripWhiteSpace().isEmpty())) { + if (myNbOkElements && (myNbOkNodes || LineEditNodes->text().trimmed().isEmpty())) { buttonOk->setEnabled(true); buttonApply->setEnabled(true); } @@ -735,7 +685,7 @@ void SMESHGUI_SmoothingDlg::enterEvent (QEvent*) void SMESHGUI_SmoothingDlg::closeEvent (QCloseEvent*) { /* same than click on cancel button */ - this->ClickOnCancel(); + ClickOnCancel(); } //======================================================================= @@ -791,9 +741,8 @@ void SMESHGUI_SmoothingDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) - { - e->accept(); - ClickOnHelp(); - } + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + ClickOnHelp(); + } } diff --git a/src/SMESHGUI/SMESHGUI_SmoothingDlg.h b/src/SMESHGUI/SMESHGUI_SmoothingDlg.h index c201dfffe..c36459a1d 100644 --- a/src/SMESHGUI/SMESHGUI_SmoothingDlg.h +++ b/src/SMESHGUI/SMESHGUI_SmoothingDlg.h @@ -1,45 +1,41 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_SmoothingDlg.h +// Author : Michael ZORIN, Open CASCADE S.A.S. // -// File : SMESHGUI_SmoothingDlg.h -// Author : Michael ZORIN -// Module : SMESH -// $Header: -#ifndef DIALOGBOX_SMOOTHING_H -#define DIALOGBOX_SMOOTHING_H +#ifndef SMESHGUI_SMOOTHINGDLG_H +#define SMESHGUI_SMOOTHINGDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include "LightApp_SelectionMgr.h" +// Qt includes +#include -#include "SMESH_LogicalFilter.hxx" - -// QT Includes -#include +// IDL includes +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) -class QGridLayout; -class QButtonGroup; class QGroupBox; class QLabel; class QLineEdit; @@ -51,14 +47,9 @@ class QSpinBox; class SMESHGUI_SpinBox; class SMESHGUI; class SMESH_Actor; -class SVTK_ViewWindow; class SVTK_Selector; - - -// IDL Headers -#include -#include CORBA_SERVER_HEADER(SMESH_Mesh) - +class LightApp_SelectionMgr; +class SMESH_LogicalFilter; //================================================================================= // class : SMESHGUI_SmoothingDlg @@ -66,81 +57,69 @@ class SVTK_Selector; //================================================================================= class SMESHGUI_EXPORT SMESHGUI_SmoothingDlg : public QDialog { - Q_OBJECT + Q_OBJECT public: - SMESHGUI_SmoothingDlg( SMESHGUI*, - const char* name = 0, - bool modal = FALSE, - WFlags fl = 0); - ~SMESHGUI_SmoothingDlg(); + SMESHGUI_SmoothingDlg( SMESHGUI* ); + ~SMESHGUI_SmoothingDlg(); private: - - void Init(); - void closeEvent(QCloseEvent*); - void enterEvent (QEvent*); /* mouse enter the QWidget */ - void hideEvent (QHideEvent*); /* ESC key */ - void keyPressEvent(QKeyEvent*); - - SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ - LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ - QString myElementsId; - int myNbOkElements; /* to check when elements are defined */ - int myNbOkNodes; /* to check when fixed nodes are defined */ - int myConstructorId; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - SVTK_Selector* mySelector; - - bool myBusy; - SMESH::SMESH_Mesh_var myMesh; - SMESH_Actor* myActor; - SMESH_LogicalFilter* myMeshOrSubMeshOrGroupFilter; - - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QPushButton* buttonHelp; - QGroupBox* GroupArguments; - QLabel* TextLabelElements; - QPushButton* SelectElementsButton; - QLineEdit* LineEditElements; - QCheckBox* CheckBoxMesh; - QLabel* TextLabelNodes; - QPushButton* SelectNodesButton; - QLineEdit* LineEditNodes; - QLabel* TextLabelMethod; - QComboBox* ComboBoxMethod; - QLabel* TextLabelLimit; - QSpinBox* SpinBox_IterationLimit; - QLabel* TextLabelAspectRatio; - SMESHGUI_SpinBox* SpinBox_AspectRatio; - QCheckBox * CheckBoxParametric; - - QString myHelpFileName; + void Init(); + void closeEvent( QCloseEvent* ); + void enterEvent( QEvent* ); /* mouse enter the QWidget */ + void hideEvent( QHideEvent* ); /* ESC key */ + void keyPressEvent( QKeyEvent* ); + + SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ + LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ + QString myElementsId; + int myNbOkElements; /* to check when elements are defined */ + int myNbOkNodes; /* to check when fixed nodes are defined */ + int myConstructorId; /* Current constructor id = radio button id */ + QLineEdit* myEditCurrentArgument; /* Current LineEdit */ + SVTK_Selector* mySelector; + + bool myBusy; + SMESH::SMESH_Mesh_var myMesh; + SMESH_Actor* myActor; + SMESH_LogicalFilter* myMeshOrSubMeshOrGroupFilter; + + QGroupBox* GroupConstructors; + QRadioButton* Constructor1; + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QPushButton* buttonApply; + QPushButton* buttonHelp; + QGroupBox* GroupArguments; + QLabel* TextLabelElements; + QPushButton* SelectElementsButton; + QLineEdit* LineEditElements; + QCheckBox* CheckBoxMesh; + QLabel* TextLabelNodes; + QPushButton* SelectNodesButton; + QLineEdit* LineEditNodes; + QLabel* TextLabelMethod; + QComboBox* ComboBoxMethod; + QLabel* TextLabelLimit; + QSpinBox* SpinBox_IterationLimit; + QLabel* TextLabelAspectRatio; + SMESHGUI_SpinBox* SpinBox_AspectRatio; + QCheckBox* CheckBoxParametric; + + QString myHelpFileName; private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void ClickOnHelp(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void onTextChange(const QString&); - void onSelectMesh(bool toSelectMesh); - -protected: - QGridLayout* SMESHGUI_SmoothingDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupArgumentsLayout; + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void ClickOnHelp(); + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void DeactivateActiveDialog(); + void ActivateThisDialog(); + void onTextChange( const QString& ); + void onSelectMesh( bool ); }; -#endif // DIALOGBOX_SMOOTHING_H +#endif // SMESHGUI_SMOOTHINGDLG_H diff --git a/src/SMESHGUI/SMESHGUI_SpinBox.cxx b/src/SMESHGUI/SMESHGUI_SpinBox.cxx index a79c6ad64..ae80c505a 100644 --- a/src/SMESHGUI/SMESHGUI_SpinBox.cxx +++ b/src/SMESHGUI/SMESHGUI_SpinBox.cxx @@ -1,70 +1,66 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_SpinBox.cxx +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : SMESHGUI_SpinBox.cxx -// Author : Lucien PIGNOLONI -// Module : SMESH -// $Header$ +// SMESH includes #include "SMESHGUI_SpinBox.h" -#include "SMESHGUI.h" - -#include -#include -using namespace std; +// Qt includes +#include +#include //================================================================================= // class : SMESHGUI_SpinBox() // purpose : constructor of specific widget accepting floats in double precision. //================================================================================= -SMESHGUI_SpinBox::SMESHGUI_SpinBox (QWidget* parent, const char* name) - : QtxDblSpinBox(parent, name) +SMESHGUI_SpinBox::SMESHGUI_SpinBox( QWidget* parent ) + : QtxDoubleSpinBox( parent ) { } //================================================================================= -// function : SetStep() [SLOT] -// purpose : +// function : ~SMESHGUI_SpinBox() +// purpose : destructor //================================================================================= -void SMESHGUI_SpinBox::SetStep (double newStep) +SMESHGUI_SpinBox::~SMESHGUI_SpinBox() { - setLineStep(newStep); } //================================================================================= -// function : ~SMESHGUI_SpinBox() -// purpose : destructor +// function : SetStep() [SLOT] +// purpose : //================================================================================= -SMESHGUI_SpinBox::~SMESHGUI_SpinBox() +void SMESHGUI_SpinBox::SetStep( double newStep ) { + setSingleStep( newStep ); } //================================================================================= // function : SetValue() // purpose : //================================================================================= -void SMESHGUI_SpinBox::SetValue (double v) +void SMESHGUI_SpinBox::SetValue( double v ) { setValue(v); editor()->setCursorPosition( 0 ); @@ -74,7 +70,7 @@ void SMESHGUI_SpinBox::SetValue (double v) // function : GetValue() // purpose : returns a double //================================================================================= -double SMESHGUI_SpinBox::GetValue() +double SMESHGUI_SpinBox::GetValue() const { return value(); } @@ -83,21 +79,41 @@ double SMESHGUI_SpinBox::GetValue() // function : GetString() // purpose : returns a QString //================================================================================= -QString SMESHGUI_SpinBox::GetString() +QString SMESHGUI_SpinBox::GetString() const { return cleanText(); } +//================================================================================= +// function : editor() +// purpose : returns editor +//================================================================================= +QLineEdit* SMESHGUI_SpinBox::editor() const +{ + return QtxDoubleSpinBox::lineEdit(); +} + +//================================================================================= +// function : validator() +// purpose : returns validator +//================================================================================= +QDoubleValidator* SMESHGUI_SpinBox::validator() const +{ + return (QDoubleValidator*)editor()->validator(); +} + //================================================================================= // function : RangeStepAndValidator() // purpose : //================================================================================= -void SMESHGUI_SpinBox::RangeStepAndValidator - (double min, double max, double step, unsigned short decimals) +void SMESHGUI_SpinBox::RangeStepAndValidator( double min, + double max, + double step, + unsigned short decimals ) { - setPrecision(-decimals); // PAL8769. Minus is for using 'g' double->string conversion specifier, - // see QtxDblSpinBox::mapValueToText( double v ) - setRange(min, max); - setLineStep(step); - ((QDoubleValidator*)validator())->setRange(min, max, decimals); + setDecimals(decimals); // PAL8769. Minus is for using 'g' double->string conversion specifier, + // see QtxDoubleSpinBox::mapValueToText( double v ) + setRange( min, max ); + setSingleStep( step ); + validator()->setRange( min, max, decimals ); } diff --git a/src/SMESHGUI/SMESHGUI_SpinBox.h b/src/SMESHGUI/SMESHGUI_SpinBox.h index 53069b718..4be468aca 100644 --- a/src/SMESHGUI/SMESHGUI_SpinBox.h +++ b/src/SMESHGUI/SMESHGUI_SpinBox.h @@ -1,65 +1,68 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_SpinBox.h +// Author : Lucien PIGNOLONI, Open CASCADE S.A.S. // -// -// File : SMESHGUI_SpinBox.h -// Author : Lucien PIGNOLONI -// Module : SMESH -// $Header$ -#ifndef SMESH_SPINBOX_H -#define SMESH_SPINBOX_H +#ifndef SMESHGUI_SPINBOX_H +#define SMESHGUI_SPINBOX_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include +// SALOME GUI includes +#include -// like in GEOM_SRC/src/DlgRef/DlgRef_SpinBox.h #define COORD_MIN -1e+15 #define COORD_MAX +1e+15 #define DBL_DIGITS_DISPLAY 14 +class QLineEdit; +class QDoubleValidator; + //================================================================================= // class : SMESHGUI_SpinBox -// purpose : Derivated from QtxDblSpinBox class +// purpose : Derivated from QtxDoubleSpinBox class //================================================================================= -class SMESHGUI_EXPORT SMESHGUI_SpinBox : public QtxDblSpinBox +class SMESHGUI_EXPORT SMESHGUI_SpinBox : public QtxDoubleSpinBox { Q_OBJECT public: - SMESHGUI_SpinBox (QWidget* parent, const char* name = 0); + SMESHGUI_SpinBox( QWidget* ); ~SMESHGUI_SpinBox(); - void RangeStepAndValidator (double min = -1000000.0, - double max = +1000000.0, - double step = 100.0, - unsigned short decimals = 3); - void SetValue (double v); - double GetValue(); - QString GetString(); - QLineEdit* editor() { return QtxDblSpinBox::editor(); } + void RangeStepAndValidator( double = -1000000.0, + double = +1000000.0, + double = 100.0, + unsigned short = 3 ); + void SetValue( double ); + double GetValue() const; + QString GetString() const; + QLineEdit* editor() const; + QDoubleValidator* validator() const; public slots: - void SetStep (double newStep); + void SetStep( double ); }; -#endif // SMESH_SPINBOX_H + +#endif // SMESHGUI_SPINBOX_H diff --git a/src/SMESHGUI/SMESHGUI_StandardMeshInfosDlg.cxx b/src/SMESHGUI/SMESHGUI_StandardMeshInfosDlg.cxx index 3fe48b107..2cb49b275 100644 --- a/src/SMESHGUI/SMESHGUI_StandardMeshInfosDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_StandardMeshInfosDlg.cxx @@ -1,71 +1,70 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_StandardMeshInfosDlg.cxx +// Author : Michael ZORIN, Open CASCADE S.A.S. // -// -// File : SMESHGUI_StandardMeshInfosDlg.cxx -// Author : Michael ZORIN -// Module : SMESH -// $Header$ +// SMESH includes #include "SMESHGUI_StandardMeshInfosDlg.h" #include "SMESHGUI.h" #include "SMESHGUI_Utils.h" #include "SMESHGUI_MeshUtils.h" -#include "SMESH_TypeFilter.hxx" - -#include "SALOMEDSClient_Study.hxx" -#include "SALOMEDSClient_SObject.hxx" +#include -#include "SUIT_Desktop.h" -#include "SUIT_Session.h" -#include "SUIT_OverrideCursor.h" -#include "SUIT_MessageBox.h" +// SALOME KERNEL includes +#include +#include -#include "LightApp_Application.h" +// SALOME GUI includes +#include +#include +#include +#include +#include -#include "LightApp_SelectionMgr.h" -#include "SALOME_ListIO.hxx" +#include +#include -#include "utilities.h" +#include -// QT Includes -#include -#include -#include -#include -#include -#include -#include +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include -// IDL Headers -#include "SALOMEconfig.h" +// IDL includes +#include #include CORBA_SERVER_HEADER(SMESH_Mesh) #include CORBA_SERVER_HEADER(SMESH_Group) -#include CORBA_SERVER_HEADER(GEOM_Gen) - -using namespace std; +#define SPACING 6 +#define MARGIN 11 //================================================================================= /*! @@ -74,89 +73,75 @@ using namespace std; * Constructor */ //================================================================================= -SMESHGUI_StandardMeshInfosDlg::SMESHGUI_StandardMeshInfosDlg( SMESHGUI* theModule, const char* name, - bool modal, WFlags fl) - : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | - WStyle_Title | WStyle_SysMenu | WDestructiveClose), - mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) +SMESHGUI_StandardMeshInfosDlg::SMESHGUI_StandardMeshInfosDlg( SMESHGUI* theModule ) + : QDialog( SMESH::GetDesktop( theModule ) ), + mySMESHGUI( theModule ), + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) { - if (!name) - setName("SMESHGUI_StandardMeshInfosDlg"); - setCaption(tr("SMESH_STANDARD_MESHINFO_TITLE" )); - setSizeGripEnabled(TRUE); + setModal(false); + setAttribute(Qt::WA_DeleteOnClose, true); + setWindowTitle(tr("SMESH_STANDARD_MESHINFO_TITLE")); + setSizeGripEnabled(true); myStartSelection = true; myIsActiveWindow = true; // dialog layout - QGridLayout* aDlgLayout = new QGridLayout(this); - aDlgLayout->setSpacing(6); - aDlgLayout->setMargin(11); + QVBoxLayout* aDlgLayout = new QVBoxLayout(this); + aDlgLayout->setSpacing(SPACING); + aDlgLayout->setMargin(MARGIN); // mesh group box - myMeshGroup = new QGroupBox(this, "myMeshGroup"); - myMeshGroup->setTitle(tr("SMESH_MESH")); - myMeshGroup->setColumnLayout(0, Qt::Vertical); - myMeshGroup->layout()->setSpacing(0); - myMeshGroup->layout()->setMargin(0); - QGridLayout* myMeshGroupLayout = new QGridLayout(myMeshGroup->layout()); - myMeshGroupLayout->setAlignment(Qt::AlignTop); - myMeshGroupLayout->setSpacing(6); - myMeshGroupLayout->setMargin(11); + myMeshGroup = new QGroupBox(tr("SMESH_MESH"), this); + QHBoxLayout* myMeshGroupLayout = new QHBoxLayout(myMeshGroup); + myMeshGroupLayout->setSpacing(SPACING); + myMeshGroupLayout->setMargin(MARGIN); // select button, label and line edit with mesh name - myNameLab = new QLabel(myMeshGroup, "myNameLab"); - myNameLab->setText(tr("SMESH_NAME" )); - myMeshGroupLayout->addWidget(myNameLab, 0, 0); + myNameLab = new QLabel(tr("SMESH_NAME"), myMeshGroup); + myMeshGroupLayout->addWidget(myNameLab); QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("SMESH",tr("ICON_SELECT"))); - mySelectBtn = new QPushButton(myMeshGroup, "mySelectBtn"); - mySelectBtn->setPixmap(image0); - mySelectBtn->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); - myMeshGroupLayout->addWidget(mySelectBtn, 0, 1); + mySelectBtn = new QPushButton(myMeshGroup); + mySelectBtn->setIcon(image0); + myMeshGroupLayout->addWidget(mySelectBtn); - myMeshLine = new QLineEdit(myMeshGroup, "myMeshLine"); - myMeshGroupLayout->addWidget(myMeshLine, 0, 2); + myMeshLine = new QLineEdit(myMeshGroup); + myMeshGroupLayout->addWidget(myMeshLine); - aDlgLayout->addWidget(myMeshGroup, 0, 0); + aDlgLayout->addWidget(myMeshGroup); // information group box - myInfoGroup = new QGroupBox(this, "myInfoGroup"); - myInfoGroup->setTitle(tr("SMESH_INFORMATION")); - myInfoGroup->setColumnLayout(0, Qt::Vertical); - myInfoGroup->layout()->setSpacing(0); - myInfoGroup->layout()->setMargin(0); - QGridLayout* myInfoGroupLayout = new QGridLayout(myInfoGroup->layout()); - myInfoGroupLayout->setAlignment(Qt::AlignTop); - myInfoGroupLayout->setSpacing(6); - myInfoGroupLayout->setMargin(11); + myInfoGroup = new QGroupBox(tr("SMESH_INFORMATION"), this); + QVBoxLayout* myInfoGroupLayout = new QVBoxLayout(myInfoGroup); + myInfoGroupLayout->setSpacing(SPACING); + myInfoGroupLayout->setMargin(MARGIN); // information text browser - myInfo = new QTextBrowser(myInfoGroup, "myInfo"); - myInfoGroupLayout->addWidget(myInfo, 0, 0); + myInfo = new QTextBrowser(myInfoGroup); + myInfo->setMinimumSize(200, 150); + myInfoGroupLayout->addWidget(myInfo); - aDlgLayout->addWidget(myInfoGroup, 1, 0); + aDlgLayout->addWidget(myInfoGroup); // buttons group - myButtonsGroup = new QGroupBox(this, "myButtonsGroup"); - myButtonsGroup->setColumnLayout(0, Qt::Vertical); - myButtonsGroup->layout()->setSpacing(0); myButtonsGroup->layout()->setMargin(0); - QHBoxLayout* myButtonsGroupLayout = new QHBoxLayout(myButtonsGroup->layout()); - myButtonsGroupLayout->setAlignment(Qt::AlignTop); - myButtonsGroupLayout->setSpacing(6); myButtonsGroupLayout->setMargin(11); + myButtonsGroup = new QGroupBox(this); + QHBoxLayout* myButtonsGroupLayout = new QHBoxLayout(myButtonsGroup); + myButtonsGroupLayout->setSpacing(SPACING); + myButtonsGroupLayout->setMargin(MARGIN); // buttons --> OK and Help buttons - myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), myButtonsGroup, "myOkBtn"); - myOkBtn->setAutoDefault(TRUE); myOkBtn->setDefault(TRUE); - myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP" ), myButtonsGroup, "myHelpBtn"); - myHelpBtn->setAutoDefault(TRUE); + myOkBtn = new QPushButton(tr("SMESH_BUT_OK"), myButtonsGroup); + myOkBtn->setAutoDefault(true); myOkBtn->setDefault(true); + myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), myButtonsGroup); + myHelpBtn->setAutoDefault(true); myButtonsGroupLayout->addWidget(myOkBtn); + myButtonsGroupLayout->addSpacing(10); myButtonsGroupLayout->addStretch(); myButtonsGroupLayout->addWidget(myHelpBtn); - aDlgLayout->addWidget(myButtonsGroup, 2, 0); + aDlgLayout->addWidget(myButtonsGroup); mySMESHGUI->SetActiveDialogBox(this); @@ -168,10 +153,6 @@ SMESHGUI_StandardMeshInfosDlg::SMESHGUI_StandardMeshInfosDlg( SMESHGUI* theModul connect( mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); connect( mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged())); - // resize and move dialog, then show - this->setMinimumSize(270, 428); - this->show(); - // init dialog with current selection myMeshFilter = new SMESH_TypeFilter (MESH); mySelectionMgr->installFilter(myMeshFilter); @@ -257,7 +238,7 @@ void SMESHGUI_StandardMeshInfosDlg::DumpMeshInfos() anInfo.append(QString("Groups:

")); hasGroup = true; } - for (; it->More(); it->Next()) { + for ( ; it->More(); it->Next()) { _PTR(SObject) subObj = it->Value(); CORBA::Object_var anObject = SMESH::SObjectToObject(subObj); SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObject); @@ -290,7 +271,7 @@ void SMESHGUI_StandardMeshInfosDlg::DumpMeshInfos() anInfo.append(QString("Groups:

")); hasGroup = true; } - for (; it->More(); it->Next()) { + for ( ; it->More(); it->Next()) { _PTR(SObject) subObj = it->Value(); CORBA::Object_var anObject = SMESH::SObjectToObject(subObj); SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObject); @@ -316,14 +297,14 @@ void SMESHGUI_StandardMeshInfosDlg::DumpMeshInfos() // info about groups on faces anObj.reset(); - aMeshSO->FindSubObject(SMESH::Tag_FaceGroups , anObj); + aMeshSO->FindSubObject(SMESH::Tag_FaceGroups, anObj); if (anObj) { _PTR(ChildIterator) it = aStudy->NewChildIterator(anObj); if (!hasGroup && it->More()) { anInfo.append(QString("Groups:

")); hasGroup = true; } - for (; it->More(); it->Next()) { + for ( ; it->More(); it->Next()) { _PTR(SObject) subObj = it->Value(); CORBA::Object_var anObject = SMESH::SObjectToObject(subObj); SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObject); @@ -354,7 +335,7 @@ void SMESHGUI_StandardMeshInfosDlg::DumpMeshInfos() _PTR(ChildIterator) it = aStudy->NewChildIterator(anObj); if (!hasGroup && it->More()) anInfo.append(QString("Groups:
")); - for (; it->More(); it->Next()) { + for ( ; it->More(); it->Next()) { _PTR(SObject) subObj = it->Value(); CORBA::Object_var anObject = SMESH::SObjectToObject(subObj); SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObject); @@ -466,10 +447,11 @@ void SMESHGUI_StandardMeshInfosDlg::onHelp() #else platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName)); } } @@ -483,9 +465,8 @@ void SMESHGUI_StandardMeshInfosDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) - { - e->accept(); - onHelp(); - } + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + onHelp(); + } } diff --git a/src/SMESHGUI/SMESHGUI_StandardMeshInfosDlg.h b/src/SMESHGUI/SMESHGUI_StandardMeshInfosDlg.h index 586593d4d..56b4545a2 100644 --- a/src/SMESHGUI/SMESHGUI_StandardMeshInfosDlg.h +++ b/src/SMESHGUI/SMESHGUI_StandardMeshInfosDlg.h @@ -1,95 +1,89 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_StandardMeshInfosDlg.h +// Author : Michael ZORIN, Open CASCADE S.A.S. // -// File : SMESHGUI_StandardMeshInfosDlg.h -// Author : Michael ZORIN -// Module : SMESH -// $Header: #ifndef SMESHGUI_STANDARDMESHINFOSDLG_H #define SMESHGUI_STANDARDMESHINFOSDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -//#include "SMESH_TypeFilter.hxx" -#include "SUIT_SelectionFilter.h" - -// QT Includes -#include +// Qt includes +#include class QGroupBox; class QLabel; class QPushButton; class QLineEdit; class QTextBrowser; -class LightApp_SelectionMgr; class SMESHGUI; - +class LightApp_SelectionMgr; +class SUIT_SelectionFilter; class SMESHGUI_EXPORT SMESHGUI_StandardMeshInfosDlg : public QDialog { - Q_OBJECT + Q_OBJECT public: - SMESHGUI_StandardMeshInfosDlg( SMESHGUI*, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); - ~SMESHGUI_StandardMeshInfosDlg(); + SMESHGUI_StandardMeshInfosDlg( SMESHGUI* ); + ~SMESHGUI_StandardMeshInfosDlg(); protected: - void closeEvent( QCloseEvent* e ); - void keyPressEvent( QKeyEvent* e ); - void windowActivationChange( bool oldActive ); - void DumpMeshInfos(); + void closeEvent( QCloseEvent* ); + void keyPressEvent( QKeyEvent* ); + void windowActivationChange( bool ); + void DumpMeshInfos(); private slots: - void onSelectionChanged(); - void DeactivateActiveDialog() ; - void ActivateThisDialog(); - void onStartSelection(); - void onHelp(); + void onSelectionChanged(); + void DeactivateActiveDialog(); + void ActivateThisDialog(); + void onStartSelection(); + void onHelp(); private: - SMESHGUI* mySMESHGUI; - LightApp_SelectionMgr* mySelectionMgr; - bool myStartSelection; - bool myIsActiveWindow; + SMESHGUI* mySMESHGUI; + LightApp_SelectionMgr* mySelectionMgr; + bool myStartSelection; + bool myIsActiveWindow; - //Handle(SMESH_TypeFilter) myMeshFilter; - SUIT_SelectionFilter* myMeshFilter; + SUIT_SelectionFilter* myMeshFilter; - QLabel* myNameLab; - QPushButton* mySelectBtn; - QLineEdit* myMeshLine; + QLabel* myNameLab; + QPushButton* mySelectBtn; + QLineEdit* myMeshLine; - QTextBrowser* myInfo; + QTextBrowser* myInfo; - QGroupBox* myMeshGroup; - QGroupBox* myInfoGroup; + QGroupBox* myMeshGroup; + QGroupBox* myInfoGroup; - QGroupBox* myButtonsGroup; - QPushButton* myOkBtn; - QPushButton* myHelpBtn; + QGroupBox* myButtonsGroup; + QPushButton* myOkBtn; + QPushButton* myHelpBtn; - QString myHelpFileName; + QString myHelpFileName; }; #endif // SMESHGUI_STANDARDMESHINFOSDLG_H diff --git a/src/SMESHGUI/SMESHGUI_Swig.hxx b/src/SMESHGUI/SMESHGUI_Swig.hxx deleted file mode 100644 index 073f6902a..000000000 --- a/src/SMESHGUI/SMESHGUI_Swig.hxx +++ /dev/null @@ -1,80 +0,0 @@ -// SMESH SMESH : GUI for SMESH component -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SMESHGUI_Swig.hxx -// Author : Nicolas REJNERI -// Module : SMESH -// $Header$ - -#ifndef _SMESHGUI_SWIG_HXX_ -#define _SMESHGUI_SWIG_HXX_ - -#include "SMESH_SMESHGUI.hxx" - -// IDL Headers -#include -#include CORBA_SERVER_HEADER(SALOMEDS) -#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) - -class SMESHGUI_EXPORT SMESH_Swig -{ -public: - SMESH_Swig(); - ~SMESH_Swig(); - - void Init(int studyID); - - const char* AddNewMesh(const char* IOR); - - const char* AddNewHypothesis(const char* IOR); - const char* AddNewAlgorithms(const char* IOR); - - void SetShape(const char* ShapeEntry, const char* MeshEntry); - - void SetHypothesis(const char* Mesh_Or_SubMesh_Entry, const char* Hypothesis_Entry); - void SetAlgorithms(const char* Mesh_Or_SubMesh_Entry, const char* Algorithms_Entry); - - void UnSetHypothesis(const char* Applied_Hypothesis_Entry ); - - const char* AddSubMesh (const char* Mesh_Entry, const char* SM_IOR, int ST); - const char* AddSubMeshOnShape (const char* Mesh_Entry, const char* GeomShape_Entry, const char* SM_IOR, int ST); - - void CreateAndDisplayActor( const char* Mesh_Entry ); - - void SetName(const char* Entry, const char* Name); - - /*! - * \brief Set mesh icon according to compute status - * \param Mesh_Entry - entry of a mesh - * \param isComputed - is mesh computed or not - */ - void SetMeshIcon(const char* Mesh_Entry, const bool isComputed, const bool isEmpty); - -private: - SALOMEDS::Study_var myStudy; - SALOMEDS::StudyBuilder_var myStudyBuilder; - SALOMEDS::SComponent_var mySComponentMesh; -}; - - -#endif diff --git a/src/SMESHGUI/SMESHGUI_Swig.i b/src/SMESHGUI/SMESHGUI_Swig.i deleted file mode 100644 index 67c00c06e..000000000 --- a/src/SMESHGUI/SMESHGUI_Swig.i +++ /dev/null @@ -1,79 +0,0 @@ -// SMESH SMESHGUI : GUI for SMESH component -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SMESHGUI_Swig.i -// Author : Nicolas REJNERI -// Module : SMESH -// $Header$ - -%{ -#include "SMESHGUI_Swig.hxx" -%} - -/* Exception handler for all functions */ -%exception { - class PyAllowThreadsGuard { - public: - // Py_BEGIN_ALLOW_THREADS - PyAllowThreadsGuard() { _save = PyEval_SaveThread(); } - // Py_END_ALLOW_THREADS - ~PyAllowThreadsGuard() { PyEval_RestoreThread(_save); } - private: - PyThreadState *_save; - }; - - PyAllowThreadsGuard guard; - - $action -} - -%include "typemaps.i" - -class SMESH_Swig -{ - public: - SMESH_Swig(); - ~SMESH_Swig(); - - void Init(int studyID); - - const char* AddNewMesh(const char* IOR); - const char* AddNewHypothesis(const char* IOR); - const char* AddNewAlgorithms(const char* IOR); - - void SetShape(const char* ShapeEntry, const char* MeshEntry); - - void SetHypothesis(const char* Mesh_Or_SubMesh_Entry, const char* Hypothesis_Entry); - void SetAlgorithms(const char* Mesh_Or_SubMesh_Entry, const char* Algorithms_Entry); - - void UnSetHypothesis(const char* Applied_Hypothesis_Entry ); - - const char* AddSubMesh (const char* Mesh_Entry, const char* SM_IOR, int ST); - const char* AddSubMeshOnShape (const char* Mesh_Entry, const char* GeomShape_Entry, const char* SM_IOR, int ST); - - void SetName(const char* Entry, const char* Name); - - void SetMeshIcon(const char* Mesh_Entry, const bool isComputed, const bool isEmpty); - - void CreateAndDisplayActor( const char* Mesh_Entry ); -}; diff --git a/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx b/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx index 0bf92e0d8..39d9b89a1 100644 --- a/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx @@ -1,31 +1,29 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_SymmetryDlg.cxx +// Author : Michael ZORIN, Open CASCADE S.A.S. // -// -// File : SMESHGUI_SymmetryDlg.cxx -// Author : Michael ZORIN -// Module : SMESH -// $Header: +// SMESH includes #include "SMESHGUI_SymmetryDlg.h" #include "SMESHGUI.h" @@ -35,270 +33,223 @@ #include "SMESHGUI_MeshUtils.h" #include "SMESHGUI_IdValidator.h" -#include "SMESH_Actor.h" -#include "SMESH_TypeFilter.hxx" -#include "SMESH_LogicalFilter.hxx" -#include "SMDS_Mesh.hxx" +#include +#include +#include +#include -#include "SUIT_Desktop.h" -#include "SUIT_ResourceMgr.h" -#include "SUIT_Session.h" -#include "SUIT_MessageBox.h" +// SALOME GUI includes +#include +#include +#include +#include -#include "LightApp_Application.h" +#include +#include -#include "SVTK_ViewModel.h" -#include "SVTK_ViewWindow.h" -#include "SVTK_Selector.h" -#include "SVTK_Selection.h" -#include "SALOME_ListIO.hxx" -#include "SALOMEDSClient_SObject.hxx" +#include +#include +#include -#include "utilities.h" +// SALOME KERNEL includes +#include -// OCCT Includes +// OCCT includes #include -#include - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// IDL Headers -#include "SALOMEconfig.h" + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// IDL includes +#include #include CORBA_SERVER_HEADER(SMESH_Group) #include CORBA_SERVER_HEADER(SMESH_MeshEditor) -using namespace std; - enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action type +#define SPACING 6 +#define MARGIN 11 + //================================================================================= // class : SMESHGUI_SymmetryDlg() // purpose : //================================================================================= -SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule, const char* name, - bool modal, WFlags fl) - : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | - WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose), - mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) +SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule ) + : QDialog( SMESH::GetDesktop( theModule ) ), + mySMESHGUI( theModule ), + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) { QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_SYMMETRY_POINT"))); QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_SYMMETRY_AXIS"))); QPixmap image2 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_SYMMETRY_PLANE"))); QPixmap image3 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT"))); - if (!name) - setName("SMESHGUI_SymmetryDlg"); - resize(303, 185); - setCaption(tr("SMESH_SYMMETRY")); - setSizeGripEnabled(TRUE); - SMESHGUI_SymmetryDlgLayout = new QGridLayout(this); - SMESHGUI_SymmetryDlgLayout->setSpacing(6); - SMESHGUI_SymmetryDlgLayout->setMargin(11); + setModal(false); + setAttribute(Qt::WA_DeleteOnClose, true); + setWindowTitle(tr("SMESH_SYMMETRY")); + setSizeGripEnabled(true); - /***************************************************************/ - GroupConstructors = new QButtonGroup(this, "GroupConstructors"); - GroupConstructors->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)5, - (QSizePolicy::SizeType)0, 0, 0, - GroupConstructors->sizePolicy().hasHeightForWidth())); - GroupConstructors->setTitle(tr("SMESH_SYMMETRY" )); - GroupConstructors->setExclusive(TRUE); - GroupConstructors->setColumnLayout(0, Qt::Vertical); - GroupConstructors->layout()->setSpacing(0); - GroupConstructors->layout()->setMargin(0); - GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout()); - GroupConstructorsLayout->setAlignment(Qt::AlignTop); - GroupConstructorsLayout->setSpacing(6); - GroupConstructorsLayout->setMargin(11); - QHBoxLayout* RBLayout = new QHBoxLayout(0, 0, 6, "Layout2"); - RadioButton1= new QRadioButton(GroupConstructors, "RadioButton1"); - RadioButton1->setText(tr("" )); - RadioButton1->setPixmap(image0); - RBLayout->addWidget(RadioButton1); - RadioButton2= new QRadioButton(GroupConstructors, "RadioButton2"); - RadioButton2->setText(tr("" )); - RadioButton2->setPixmap(image1); - RBLayout->addWidget(RadioButton2); - RadioButton3= new QRadioButton(GroupConstructors, "RadioButton3"); - RadioButton3->setText(tr("" )); - RadioButton3->setPixmap(image2); - RBLayout->addWidget(RadioButton3); - GroupConstructorsLayout->addLayout(RBLayout, 0, 0); - SMESHGUI_SymmetryDlgLayout->addWidget(GroupConstructors, 0, 0); + QVBoxLayout* SMESHGUI_SymmetryDlgLayout = new QVBoxLayout(this); + SMESHGUI_SymmetryDlgLayout->setSpacing(SPACING); + SMESHGUI_SymmetryDlgLayout->setMargin(MARGIN); /***************************************************************/ - GroupButtons = new QGroupBox(this, "GroupButtons"); - GroupButtons->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)7, - (QSizePolicy::SizeType)0, 0, 0, - GroupButtons->sizePolicy().hasHeightForWidth())); - GroupButtons->setGeometry(QRect(10, 10, 281, 48)); - GroupButtons->setTitle(tr("" )); - GroupButtons->setColumnLayout(0, Qt::Vertical); - GroupButtons->layout()->setSpacing(0); - GroupButtons->layout()->setMargin(0); - GroupButtonsLayout = new QGridLayout(GroupButtons->layout()); - GroupButtonsLayout->setAlignment(Qt::AlignTop); - GroupButtonsLayout->setSpacing(6); - GroupButtonsLayout->setMargin(11); - buttonHelp = new QPushButton(GroupButtons, "buttonHelp"); - buttonHelp->setText(tr("SMESH_BUT_HELP" )); - buttonHelp->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonHelp, 0, 4); - buttonCancel = new QPushButton(GroupButtons, "buttonCancel"); - buttonCancel->setText(tr("SMESH_BUT_CLOSE" )); - buttonCancel->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonCancel, 0, 3); - buttonApply = new QPushButton(GroupButtons, "buttonApply"); - buttonApply->setText(tr("SMESH_BUT_APPLY" )); - buttonApply->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonApply, 0, 1); - QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - GroupButtonsLayout->addItem(spacer_9, 0, 2); - buttonOk = new QPushButton(GroupButtons, "buttonOk"); - buttonOk->setText(tr("SMESH_BUT_OK" )); - buttonOk->setAutoDefault(TRUE); - buttonOk->setDefault(TRUE); - GroupButtonsLayout->addWidget(buttonOk, 0, 0); - SMESHGUI_SymmetryDlgLayout->addWidget(GroupButtons, 2, 0); + ConstructorsBox = new QGroupBox(tr("SMESH_SYMMETRY"), this); + GroupConstructors = new QButtonGroup(this); + QHBoxLayout* ConstructorsBoxLayout = new QHBoxLayout(ConstructorsBox); + ConstructorsBoxLayout->setSpacing(SPACING); + ConstructorsBoxLayout->setMargin(MARGIN); + + RadioButton1 = new QRadioButton(ConstructorsBox); + RadioButton1->setIcon(image0); + RadioButton2 = new QRadioButton(ConstructorsBox); + RadioButton2->setIcon(image1); + RadioButton3 = new QRadioButton(ConstructorsBox); + RadioButton3->setIcon(image2); + + ConstructorsBoxLayout->addWidget(RadioButton1); + ConstructorsBoxLayout->addWidget(RadioButton2); + ConstructorsBoxLayout->addWidget(RadioButton3); + GroupConstructors->addButton(RadioButton1, 0); + GroupConstructors->addButton(RadioButton2, 1); + GroupConstructors->addButton(RadioButton3, 2); /***************************************************************/ - GroupArguments = new QGroupBox(this, "GroupArguments"); - GroupArguments->setTitle(tr("SMESH_ARGUMENTS")); - GroupArguments->setColumnLayout(0, Qt::Vertical); - GroupArguments->layout()->setSpacing(0); - GroupArguments->layout()->setMargin(0); - GroupArgumentsLayout = new QGridLayout(GroupArguments->layout()); - GroupArgumentsLayout->setAlignment(Qt::AlignTop); - GroupArgumentsLayout->setSpacing(6); - GroupArgumentsLayout->setMargin(11); + GroupArguments = new QGroupBox(tr("SMESH_ARGUMENTS"), this); + QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments); + GroupArgumentsLayout->setSpacing(SPACING); + GroupArgumentsLayout->setMargin(MARGIN); // Controls for elements selection - TextLabelElements = new QLabel(GroupArguments, "TextLabelElements"); - TextLabelElements->setText(tr("SMESH_ID_ELEMENTS" )); - //TextLabelElements->setFixedWidth(74); - GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0); - //GroupArgumentsLayout->addMultiCellWidget(TextLabelElements, 0, 0, 0, 1); - - SelectElementsButton = new QPushButton(GroupArguments, "SelectElementsButton"); - SelectElementsButton->setText(tr("" )); - SelectElementsButton->setPixmap(image3); - SelectElementsButton->setToggleButton(FALSE); - GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1); - - LineEditElements = new QLineEdit(GroupArguments, "LineEditElements"); - LineEditElements->setValidator(new SMESHGUI_IdValidator(this, "validator")); - //GroupArgumentsLayout->addWidget(LineEditElements, 0, 3); - GroupArgumentsLayout->addMultiCellWidget(LineEditElements, 0, 0, 2, 4); + TextLabelElements = new QLabel(tr("SMESH_ID_ELEMENTS"), GroupArguments); + SelectElementsButton = new QPushButton(GroupArguments); + SelectElementsButton->setIcon(image3); + LineEditElements = new QLineEdit(GroupArguments); + LineEditElements->setValidator(new SMESHGUI_IdValidator(this)); // Control for the whole mesh selection - CheckBoxMesh = new QCheckBox(GroupArguments, "CheckBoxMesh"); - CheckBoxMesh->setText(tr("SMESH_SELECT_WHOLE_MESH" )); - GroupArgumentsLayout->addMultiCellWidget(CheckBoxMesh, 1, 1, 0, 4); + CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments); // Controls for mirror selection - GroupMirror = new QGroupBox(GroupArguments, "GroupMirror"); - GroupMirror->setColumnLayout(0, Qt::Vertical); - GroupMirror->layout()->setSpacing(0); - GroupMirror->layout()->setMargin(0); - QGridLayout* GroupMirrorLayout = new QGridLayout(GroupMirror->layout()); - GroupMirrorLayout->setAlignment(Qt::AlignTop); - GroupMirrorLayout->setSpacing(6); - GroupMirrorLayout->setMargin(11); - - TextLabelPoint = new QLabel(GroupMirror, "TextLabelPoint"); - TextLabelPoint->setText(tr("SMESH_POINT")); - GroupMirrorLayout->addWidget(TextLabelPoint, 0, 0); - - SelectPointButton = new QPushButton(GroupMirror, "SelectPointButton"); - SelectPointButton->setPixmap(image3); - GroupMirrorLayout->addWidget(SelectPointButton, 0, 1); - - TextLabelX = new QLabel(GroupMirror, "TextLabelX"); - TextLabelX->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); - TextLabelX->setText(tr("SMESH_X")); - GroupMirrorLayout->addWidget(TextLabelX, 0, 2); - - SpinBox_X = new SMESHGUI_SpinBox(GroupMirror, "SpinBox_X"); - GroupMirrorLayout->addWidget(SpinBox_X, 0, 3); - - TextLabelY = new QLabel(GroupMirror, "TextLabelY"); - TextLabelY->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); - TextLabelY->setText(tr("SMESH_Y")); - GroupMirrorLayout->addWidget(TextLabelY, 0, 4); - - SpinBox_Y = new SMESHGUI_SpinBox(GroupMirror, "SpinBox_Y"); - GroupMirrorLayout->addWidget(SpinBox_Y, 0, 5); - - TextLabelZ = new QLabel(GroupMirror, "TextLabelZ"); - TextLabelZ->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); - TextLabelZ->setText(tr("SMESH_Z")); - GroupMirrorLayout->addWidget(TextLabelZ, 0, 6); - - SpinBox_Z = new SMESHGUI_SpinBox(GroupMirror, "SpinBox_Z"); - GroupMirrorLayout->addWidget(SpinBox_Z, 0, 7); - - TextLabelVector = new QLabel(GroupMirror, "TextLabelVector"); - GroupMirrorLayout->addWidget(TextLabelVector, 1, 0); - - SelectVectorButton = new QPushButton(GroupMirror, "SelectVectorButton"); - SelectVectorButton->setPixmap(image3); + GroupMirror = new QGroupBox(GroupArguments); + QGridLayout* GroupMirrorLayout = new QGridLayout(GroupMirror); + GroupMirrorLayout->setSpacing(SPACING); + GroupMirrorLayout->setMargin(MARGIN); + + TextLabelPoint = new QLabel(tr("SMESH_POINT"), GroupMirror); + SelectPointButton = new QPushButton(GroupMirror); + SelectPointButton->setIcon(image3); + + TextLabelX = new QLabel(tr("SMESH_X"), GroupMirror); + SpinBox_X = new SMESHGUI_SpinBox(GroupMirror); + TextLabelY = new QLabel(tr("SMESH_Y"), GroupMirror); + SpinBox_Y = new SMESHGUI_SpinBox(GroupMirror); + TextLabelZ = new QLabel(tr("SMESH_Z"), GroupMirror); + SpinBox_Z = new SMESHGUI_SpinBox(GroupMirror); + + TextLabelVector = new QLabel(GroupMirror); + SelectVectorButton = new QPushButton(GroupMirror); + SelectVectorButton->setIcon(image3); + + TextLabelDX = new QLabel(tr("SMESH_DX"), GroupMirror); + SpinBox_DX = new SMESHGUI_SpinBox(GroupMirror); + TextLabelDY = new QLabel(tr("SMESH_DY"), GroupMirror); + SpinBox_DY = new SMESHGUI_SpinBox(GroupMirror); + TextLabelDZ = new QLabel(tr("SMESH_DZ"), GroupMirror); + SpinBox_DZ = new SMESHGUI_SpinBox(GroupMirror); + + GroupMirrorLayout->addWidget(TextLabelPoint, 0, 0); + GroupMirrorLayout->addWidget(SelectPointButton, 0, 1); + GroupMirrorLayout->addWidget(TextLabelX, 0, 2); + GroupMirrorLayout->addWidget(SpinBox_X, 0, 3); + GroupMirrorLayout->addWidget(TextLabelY, 0, 4); + GroupMirrorLayout->addWidget(SpinBox_Y, 0, 5); + GroupMirrorLayout->addWidget(TextLabelZ, 0, 6); + GroupMirrorLayout->addWidget(SpinBox_Z, 0, 7); + GroupMirrorLayout->addWidget(TextLabelVector, 1, 0); GroupMirrorLayout->addWidget(SelectVectorButton, 1, 1); - - TextLabelDX = new QLabel(GroupMirror, "TextLabelDX"); - TextLabelDX->setText(tr("SMESH_DX")); - TextLabelDX->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); - GroupMirrorLayout->addWidget(TextLabelDX, 1, 2); - - SpinBox_DX = new SMESHGUI_SpinBox(GroupMirror, "SpinBox_DX"); - GroupMirrorLayout->addWidget(SpinBox_DX, 1, 3); - - TextLabelDY = new QLabel(GroupMirror, "TextLabelDY"); - TextLabelDY->setText(tr("SMESH_DY")); - TextLabelDY->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); - GroupMirrorLayout->addWidget(TextLabelDY, 1, 4); - - SpinBox_DY = new SMESHGUI_SpinBox(GroupMirror, "SpinBox_DY"); - GroupMirrorLayout->addWidget(SpinBox_DY, 1, 5); - - TextLabelDZ = new QLabel(GroupMirror, "TextLabelDZ"); - TextLabelDZ->setText(tr("SMESH_DZ")); - TextLabelDZ->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); - GroupMirrorLayout->addWidget(TextLabelDZ, 1, 6); - - SpinBox_DZ = new SMESHGUI_SpinBox(GroupMirror, "SpinBox_DZ"); - GroupMirrorLayout->addWidget(SpinBox_DZ, 1, 7); - - GroupArgumentsLayout->addMultiCellWidget(GroupMirror, 2, 2, 0, 4); + GroupMirrorLayout->addWidget(TextLabelDX, 1, 2); + GroupMirrorLayout->addWidget(SpinBox_DX, 1, 3); + GroupMirrorLayout->addWidget(TextLabelDY, 1, 4); + GroupMirrorLayout->addWidget(SpinBox_DY, 1, 5); + GroupMirrorLayout->addWidget(TextLabelDZ, 1, 6); + GroupMirrorLayout->addWidget(SpinBox_DZ, 1, 7); // switch of action type - ActionGroup = new QButtonGroup(1, Qt::Horizontal, GroupArguments, "ActionGroup"); - ActionGroup->setExclusive(true); - ActionGroup->insert(new QRadioButton(tr("SMESH_MOVE_ELEMENTS"),ActionGroup), MOVE_ELEMS_BUTTON); - ActionGroup->insert(new QRadioButton(tr("SMESH_COPY_ELEMENTS"),ActionGroup), COPY_ELEMS_BUTTON); - ActionGroup->insert(new QRadioButton(tr("SMESH_CREATE_MESH" ),ActionGroup), MAKE_MESH_BUTTON); - GroupArgumentsLayout->addMultiCellWidget(ActionGroup, 3, 5, 0, 3); + ActionBox = new QGroupBox(tr("ACTION"), GroupArguments); + ActionGroup = new QButtonGroup(GroupArguments); + QVBoxLayout* ActionBoxLayout = new QVBoxLayout(ActionBox); + ActionBoxLayout->addSpacing(SPACING); + ActionBoxLayout->setMargin(MARGIN); + + QRadioButton* aMoveElements = new QRadioButton(tr("SMESH_MOVE_ELEMENTS"), ActionBox); + QRadioButton* aCopyElements = new QRadioButton(tr("SMESH_COPY_ELEMENTS"), ActionBox); + QRadioButton* aCreateMesh = new QRadioButton(tr("SMESH_CREATE_MESH"), ActionBox); + + ActionBoxLayout->addWidget(aMoveElements); + ActionBoxLayout->addWidget(aCopyElements); + ActionBoxLayout->addWidget(aCreateMesh); + ActionGroup->addButton(aMoveElements, MOVE_ELEMS_BUTTON); + ActionGroup->addButton(aCopyElements, COPY_ELEMS_BUTTON); + ActionGroup->addButton(aCreateMesh, MAKE_MESH_BUTTON); // CheckBox for groups generation MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments); MakeGroupsCheck->setChecked(false); - GroupArgumentsLayout->addWidget(MakeGroupsCheck, 4, 4); // Name of a mesh to create - LineEditNewMesh = new QLineEdit(GroupArguments, "LineEditNewMesh"); - GroupArgumentsLayout->addWidget(LineEditNewMesh, 5, 4); + LineEditNewMesh = new QLineEdit(GroupArguments); + + // layout + GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0); + GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1); + GroupArgumentsLayout->addWidget(LineEditElements, 0, 2, 1, 2); + GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 4); + GroupArgumentsLayout->addWidget(GroupMirror, 2, 0, 1, 4); + GroupArgumentsLayout->addWidget(ActionBox, 3, 0, 3, 3); + GroupArgumentsLayout->addWidget(MakeGroupsCheck, 4, 4); + GroupArgumentsLayout->addWidget(LineEditNewMesh, 5, 4); - SMESHGUI_SymmetryDlgLayout->addWidget(GroupArguments, 1, 0); + /***************************************************************/ + GroupButtons = new QGroupBox(this); + QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons); + GroupButtonsLayout->setSpacing(SPACING); + GroupButtonsLayout->setMargin(MARGIN); + + buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk->setAutoDefault(true); + buttonOk->setDefault(true); + buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); + buttonApply->setAutoDefault(true); + buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons); + buttonCancel->setAutoDefault(true); + buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons); + buttonHelp->setAutoDefault(true); + + GroupButtonsLayout->addWidget(buttonOk); + GroupButtonsLayout->addSpacing(10); + GroupButtonsLayout->addWidget(buttonApply); + GroupButtonsLayout->addSpacing(10); + GroupButtonsLayout->addStretch(); + GroupButtonsLayout->addWidget(buttonCancel); + GroupButtonsLayout->addWidget(buttonHelp); + + /***************************************************************/ + SMESHGUI_SymmetryDlgLayout->addWidget(ConstructorsBox); + SMESHGUI_SymmetryDlgLayout->addWidget(GroupArguments); + SMESHGUI_SymmetryDlgLayout->addWidget(GroupButtons); /* Initialisations */ SpinBox_X->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); @@ -308,8 +259,7 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule, const char* nam SpinBox_DY->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); SpinBox_DZ->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, 3); - GroupArguments->show(); - RadioButton1->setChecked(TRUE); + RadioButton1->setChecked(true); mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); @@ -319,7 +269,7 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule, const char* nam SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH); SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter (GROUP); - QPtrList aListOfFilters; + QList aListOfFilters; if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter); if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter); @@ -331,15 +281,15 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule, const char* nam Init(); /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); - connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int))); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); + connect(GroupConstructors, SIGNAL(buttonClicked(int)), SLOT(ConstructorsClicked(int))); - connect(SelectElementsButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument())); - connect(SelectPointButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument())); - connect(SelectVectorButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument())); + connect(SelectElementsButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(SelectPointButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(SelectVectorButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged())); connect(SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(onVectorChanged())); @@ -351,14 +301,11 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule, const char* nam connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&))); connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool))); - connect(ActionGroup, SIGNAL(clicked(int)), SLOT(onActionClicked(int))); - - this->show(); /* displays Dialog */ + connect(ActionGroup, SIGNAL(buttonClicked(int)), SLOT(onActionClicked(int))); ConstructorsClicked(0); SelectionIntoArgument(); onActionClicked(MOVE_ELEMS_BUTTON); - resize(0,0); // ?? } //================================================================================= @@ -367,7 +314,6 @@ SMESHGUI_SymmetryDlg::SMESHGUI_SymmetryDlg( SMESHGUI* theModule, const char* nam //================================================================================= SMESHGUI_SymmetryDlg::~SMESHGUI_SymmetryDlg() { - // no need to delete child widgets, Qt does it all for us } //================================================================================= @@ -397,7 +343,7 @@ void SMESHGUI_SymmetryDlg::Init (bool ResetControls) SpinBox_DY->SetValue(0.0); SpinBox_DZ->SetValue(0.0); - ((QRadioButton*) ActionGroup->find( MOVE_ELEMS_BUTTON ))->setChecked(TRUE); + ActionGroup->button( MOVE_ELEMS_BUTTON )->setChecked(true); CheckBoxMesh->setChecked(false); // MakeGroupsCheck->setChecked(false); // MakeGroupsCheck->setEnabled(false); @@ -469,6 +415,10 @@ void SMESHGUI_SymmetryDlg::ConstructorsClicked (int constructorId) onSelectMesh(true); connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + QApplication::instance()->processEvents(); + updateGeometry(); + resize( minimumSize() ); } //================================================================================= @@ -481,7 +431,7 @@ void SMESHGUI_SymmetryDlg::ClickOnApply() return; if (myNbOkElements && IsMirrorOk()) { - QStringList aListElementsId = QStringList::split(" ", myElementsId, false); + QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts); SMESH::long_array_var anElementsId = new SMESH::long_array; @@ -512,12 +462,12 @@ void SMESHGUI_SymmetryDlg::ClickOnApply() if (GetConstructorId() == 2) aMirrorType = SMESH::SMESH_MeshEditor::PLANE; - int actionButton = ActionGroup->id( ActionGroup->selected() ); + int actionButton = ActionGroup->checkedId(); bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ); try { SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); - QApplication::setOverrideCursor(Qt::waitCursor); + QApplication::setOverrideCursor(Qt::WaitCursor); switch ( actionButton ) { case MOVE_ELEMS_BUTTON: aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, false ); @@ -532,7 +482,7 @@ void SMESHGUI_SymmetryDlg::ClickOnApply() case MAKE_MESH_BUTTON: SMESH::SMESH_Mesh_var mesh = aMeshEditor->MirrorMakeMesh(anElementsId, aMirror, aMirrorType, makeGroups, - LineEditNewMesh->text().latin1()); + LineEditNewMesh->text().toLatin1().data()); } QApplication::restoreOverrideCursor(); } catch (...) { @@ -584,16 +534,17 @@ void SMESHGUI_SymmetryDlg::ClickOnHelp() if (app) app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); else { - QString platform; + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName)); } } @@ -624,7 +575,7 @@ void SMESHGUI_SymmetryDlg::onTextChange (const QString& theNewText) TColStd_MapOfInteger newIndices; - QStringList aListId = QStringList::split(" ", theNewText, false); + QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts); if (send == LineEditElements) { for (int i = 0; i < aListId.count(); i++) { @@ -703,7 +654,7 @@ void SMESHGUI_SymmetryDlg::SelectionIntoArgument() MakeGroupsCheck->setChecked(false); MakeGroupsCheck->setEnabled(false); } - else if ( ActionGroup->id( ActionGroup->selected() ) != MOVE_ELEMS_BUTTON ) { + else if ( ActionGroup->checkedId() != MOVE_ELEMS_BUTTON ) { MakeGroupsCheck->setEnabled(true); } if (CheckBoxMesh->isChecked()) { @@ -847,8 +798,8 @@ void SMESHGUI_SymmetryDlg::SetEditCurrentArgument() //================================================================================= void SMESHGUI_SymmetryDlg::DeactivateActiveDialog() { - if (GroupConstructors->isEnabled()) { - GroupConstructors->setEnabled(false); + if (ConstructorsBox->isEnabled()) { + ConstructorsBox->setEnabled(false); GroupArguments->setEnabled(false); GroupButtons->setEnabled(false); mySMESHGUI->ResetState(); @@ -864,7 +815,7 @@ void SMESHGUI_SymmetryDlg::ActivateThisDialog() { /* Emit a signal to deactivate the active dialog */ mySMESHGUI->EmitSignalDeactivateDialog(); - GroupConstructors->setEnabled(true); + ConstructorsBox->setEnabled(true); GroupArguments->setEnabled(true); GroupButtons->setEnabled(true); @@ -881,7 +832,7 @@ void SMESHGUI_SymmetryDlg::ActivateThisDialog() //================================================================================= void SMESHGUI_SymmetryDlg::enterEvent (QEvent*) { - if (!GroupConstructors->isEnabled()) + if (!ConstructorsBox->isEnabled()) ActivateThisDialog(); } @@ -892,7 +843,7 @@ void SMESHGUI_SymmetryDlg::enterEvent (QEvent*) void SMESHGUI_SymmetryDlg::closeEvent (QCloseEvent*) { /* same than click on cancel button */ - this->ClickOnCancel(); + ClickOnCancel(); } //======================================================================= @@ -945,9 +896,7 @@ void SMESHGUI_SymmetryDlg::onSelectMesh (bool toSelectMesh) //================================================================================= int SMESHGUI_SymmetryDlg::GetConstructorId() { - if (GroupConstructors != NULL && GroupConstructors->selected() != NULL) - return GroupConstructors->id(GroupConstructors->selected()); - return -1; + return GroupConstructors->checkedId(); } //================================================================================= @@ -1028,10 +977,10 @@ void SMESHGUI_SymmetryDlg::setNewMeshName() } else { _PTR(SObject) meshSO = SMESH::FindSObject( myMesh ); - name = meshSO->GetName(); + name = meshSO->GetName().c_str(); } if ( !name.isEmpty() ) - LineEditNewMesh->setText( SMESH::UniqueMeshName( name.latin1(), "mirrored")); + LineEditNewMesh->setText( SMESH::UniqueMeshName( name, "mirrored")); } } @@ -1045,9 +994,8 @@ void SMESHGUI_SymmetryDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) - { - e->accept(); - ClickOnHelp(); - } + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + ClickOnHelp(); + } } diff --git a/src/SMESHGUI/SMESHGUI_SymmetryDlg.h b/src/SMESHGUI/SMESHGUI_SymmetryDlg.h index 3f33ab4c1..c1602a8f6 100644 --- a/src/SMESHGUI/SMESHGUI_SymmetryDlg.h +++ b/src/SMESHGUI/SMESHGUI_SymmetryDlg.h @@ -1,45 +1,41 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_SymmetryDlg.h +// Author : Michael ZORIN, Open CASCADE S.A.S. // -// File : SMESHGUI_SymmetryDlg.h -// Author : Michael ZORIN -// Module : SMESH -// $Header: -#ifndef DIALOGBOX_SYMMETRY_H -#define DIALOGBOX_SYMMETRY_H +#ifndef SMESHGUI_SYMMETRYDLG_H +#define SMESHGUI_SYMMETRYDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include "LightApp_SelectionMgr.h" +// Qt includes +#include -#include "SMESH_LogicalFilter.hxx" - -// QT Includes -#include +// IDL includes +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) -class QGridLayout; -class QHBoxLayout; class QButtonGroup; class QGroupBox; class QLabel; @@ -50,13 +46,9 @@ class QCheckBox; class SMESHGUI_SpinBox; class SMESHGUI; class SMESH_Actor; -class SVTK_ViewWindow; class SVTK_Selector; - -// IDL Headers -#include -#include CORBA_SERVER_HEADER(SMESH_Mesh) - +class LightApp_SelectionMgr; +class SMESH_LogicalFilter; //================================================================================= // class : SMESHGUI_SymmetryDlg @@ -64,99 +56,90 @@ class SVTK_Selector; //================================================================================= class SMESHGUI_EXPORT SMESHGUI_SymmetryDlg : public QDialog { - Q_OBJECT + Q_OBJECT public: - SMESHGUI_SymmetryDlg( SMESHGUI*, - const char* name = 0, - bool modal = FALSE, - WFlags fl = 0); - ~SMESHGUI_SymmetryDlg(); + SMESHGUI_SymmetryDlg( SMESHGUI* ); + ~SMESHGUI_SymmetryDlg(); private: - void Init (bool ResetControls = true); - void closeEvent (QCloseEvent*); - void enterEvent (QEvent*); /* mouse enter the QWidget */ - void hideEvent (QHideEvent*); /* ESC key */ - void keyPressEvent(QKeyEvent*); - int GetConstructorId(); - bool IsMirrorOk(); - void setNewMeshName(); - - SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ - LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ - int myNbOkElements; /* to check when elements are defined */ - QString myElementsId; - SVTK_Selector* mySelector; - - QWidget* myEditCurrentArgument; /* Current LineEdit */ - - bool myBusy; - SMESH::SMESH_Mesh_var myMesh; - SMESH_Actor* myActor; - SMESH_LogicalFilter* myMeshOrSubMeshOrGroupFilter; + void Init( bool = true ); + void closeEvent( QCloseEvent* ); + void enterEvent( QEvent* ); /* mouse enter the QWidget */ + void hideEvent( QHideEvent* ); /* ESC key */ + void keyPressEvent( QKeyEvent* ); + int GetConstructorId(); + bool IsMirrorOk(); + void setNewMeshName(); + + SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ + LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ + int myNbOkElements; /* to check when elements are defined */ + QString myElementsId; + SVTK_Selector* mySelector; + + QWidget* myEditCurrentArgument; /* Current LineEdit */ + + bool myBusy; + SMESH::SMESH_Mesh_var myMesh; + SMESH_Actor* myActor; + SMESH_LogicalFilter* myMeshOrSubMeshOrGroupFilter; - QButtonGroup* GroupConstructors; - QRadioButton* RadioButton1; - QRadioButton* RadioButton2; - QRadioButton* RadioButton3; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QPushButton* buttonHelp; - QGroupBox* GroupArguments; - QGroupBox* GroupMirror; - QLabel* TextLabelElements; - QPushButton* SelectElementsButton; - QLineEdit* LineEditElements; - QCheckBox* CheckBoxMesh; - - QLabel* TextLabelPoint; - QPushButton* SelectPointButton; - QLabel* TextLabelX; - SMESHGUI_SpinBox* SpinBox_X; - QLabel* TextLabelY; - SMESHGUI_SpinBox* SpinBox_Y; - QLabel* TextLabelZ; - SMESHGUI_SpinBox* SpinBox_Z; - QLabel* TextLabelVector; - QPushButton* SelectVectorButton; - QLabel* TextLabelDX; - SMESHGUI_SpinBox* SpinBox_DX; - QLabel* TextLabelDY; - SMESHGUI_SpinBox* SpinBox_DY; - QLabel* TextLabelDZ; - SMESHGUI_SpinBox* SpinBox_DZ; + QGroupBox* ConstructorsBox; + QButtonGroup* GroupConstructors; + QRadioButton* RadioButton1; + QRadioButton* RadioButton2; + QRadioButton* RadioButton3; + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QPushButton* buttonApply; + QPushButton* buttonHelp; + QGroupBox* GroupArguments; + QGroupBox* GroupMirror; + QLabel* TextLabelElements; + QPushButton* SelectElementsButton; + QLineEdit* LineEditElements; + QCheckBox* CheckBoxMesh; + + QLabel* TextLabelPoint; + QPushButton* SelectPointButton; + QLabel* TextLabelX; + SMESHGUI_SpinBox* SpinBox_X; + QLabel* TextLabelY; + SMESHGUI_SpinBox* SpinBox_Y; + QLabel* TextLabelZ; + SMESHGUI_SpinBox* SpinBox_Z; + QLabel* TextLabelVector; + QPushButton* SelectVectorButton; + QLabel* TextLabelDX; + SMESHGUI_SpinBox* SpinBox_DX; + QLabel* TextLabelDY; + SMESHGUI_SpinBox* SpinBox_DY; + QLabel* TextLabelDZ; + SMESHGUI_SpinBox* SpinBox_DZ; - //QCheckBox* CheckBoxCopy; - QButtonGroup* ActionGroup; - QCheckBox* MakeGroupsCheck; - QLineEdit* LineEditNewMesh; + QGroupBox* ActionBox; + QButtonGroup* ActionGroup; + QCheckBox* MakeGroupsCheck; + QLineEdit* LineEditNewMesh; - QString myHelpFileName; + QString myHelpFileName; - private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void ClickOnHelp(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void onTextChange(const QString&); - void onSelectMesh(bool toSelectMesh); - void onVectorChanged(); - void onActionClicked(int button); - -protected: - QGridLayout* SMESHGUI_SymmetryDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupArgumentsLayout; +private slots: + void ConstructorsClicked( int ); + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void ClickOnHelp(); + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void DeactivateActiveDialog(); + void ActivateThisDialog(); + void onTextChange( const QString& ); + void onSelectMesh( bool ); + void onVectorChanged(); + void onActionClicked( int ); }; -#endif // DIALOGBOX_SYMMETRY_H +#endif // SMESHGUI_SYMMETRYDLG_H diff --git a/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx b/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx index 56cae0c67..1c5ac1f1e 100644 --- a/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx @@ -1,31 +1,29 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_TranslationDlg.cxx +// Author : Michael ZORIN, Open CASCADE S.A.S. // -// -// File : SMESHGUI_TranslationDlg.cxx -// Author : Michael ZORIN -// Module : SMESH -// $Header: +// SMESH includes #include "SMESHGUI_TranslationDlg.h" #include "SMESHGUI.h" @@ -35,252 +33,211 @@ #include "SMESHGUI_MeshUtils.h" #include "SMESHGUI_IdValidator.h" -#include "SMESH_Actor.h" -#include "SMESH_TypeFilter.hxx" -#include "SMESH_LogicalFilter.hxx" -#include "SMDS_Mesh.hxx" +#include +#include +#include +#include -#include "SUIT_Desktop.h" -#include "SUIT_ResourceMgr.h" -#include "SUIT_Session.h" -#include "SUIT_MessageBox.h" +// SALOME GUI includes +#include +#include +#include +#include -#include "LightApp_Application.h" +#include +#include -#include "SVTK_ViewModel.h" -#include "SVTK_Selection.h" -#include "SVTK_ViewWindow.h" -#include "SVTK_Selector.h" -#include "SALOME_ListIO.hxx" -#include "SALOMEDSClient_SObject.hxx" +#include +#include +#include -#include "utilities.h" +// SALOME KERNEL includes +#include -// OCCT Includes +// OCCT includes #include -#include - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// IDL Headers -#include "SALOMEconfig.h" + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// IDL includes +#include #include CORBA_SERVER_HEADER(SMESH_Group) #include CORBA_SERVER_HEADER(SMESH_MeshEditor) -using namespace std; - enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action type +#define SPACING 6 +#define MARGIN 11 + //================================================================================= // class : SMESHGUI_TranslationDlg() // purpose : //================================================================================= -SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule, const char* name, - bool modal, WFlags fl) - : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | - WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose), - mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) +SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule ) + : QDialog( SMESH::GetDesktop( theModule ) ), + mySMESHGUI( theModule ), + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) { QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_TRANSLATION_POINTS"))); QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_TRANSLATION_VECTOR"))); QPixmap image2 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT"))); - if (!name) - setName("SMESHGUI_TranslationDlg"); - resize(303, 185); - setCaption(tr("SMESH_TRANSLATION")); - setSizeGripEnabled(TRUE); - SMESHGUI_TranslationDlgLayout = new QGridLayout(this); - SMESHGUI_TranslationDlgLayout->setSpacing(6); - SMESHGUI_TranslationDlgLayout->setMargin(11); + setModal(false); + setAttribute(Qt::WA_DeleteOnClose, true); + setWindowTitle(tr("SMESH_TRANSLATION")); + setSizeGripEnabled(true); - /***************************************************************/ - GroupConstructors = new QButtonGroup(this, "GroupConstructors"); - GroupConstructors->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, GroupConstructors->sizePolicy().hasHeightForWidth())); - GroupConstructors->setTitle(tr("SMESH_TRANSLATION" )); - GroupConstructors->setExclusive(TRUE); - GroupConstructors->setColumnLayout(0, Qt::Vertical); - GroupConstructors->layout()->setSpacing(0); - GroupConstructors->layout()->setMargin(0); - GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout()); - GroupConstructorsLayout->setAlignment(Qt::AlignTop); - GroupConstructorsLayout->setSpacing(6); - GroupConstructorsLayout->setMargin(11); - RadioButton1= new QRadioButton(GroupConstructors, "RadioButton1"); - RadioButton1->setText(tr("" )); - RadioButton1->setPixmap(image0); - GroupConstructorsLayout->addWidget(RadioButton1, 0, 0); - RadioButton2= new QRadioButton(GroupConstructors, "RadioButton2"); - RadioButton2->setText(tr("" )); - RadioButton2->setPixmap(image1); - GroupConstructorsLayout->addWidget(RadioButton2, 0, 2 ); - SMESHGUI_TranslationDlgLayout->addWidget(GroupConstructors, 0, 0); + QVBoxLayout* SMESHGUI_TranslationDlgLayout = new QVBoxLayout(this); + SMESHGUI_TranslationDlgLayout->setSpacing(SPACING); + SMESHGUI_TranslationDlgLayout->setMargin(MARGIN); /***************************************************************/ - GroupButtons = new QGroupBox(this, "GroupButtons"); - GroupButtons->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth())); - GroupButtons->setGeometry(QRect(10, 10, 281, 48)); - GroupButtons->setTitle(tr("" )); - GroupButtons->setColumnLayout(0, Qt::Vertical); - GroupButtons->layout()->setSpacing(0); - GroupButtons->layout()->setMargin(0); - GroupButtonsLayout = new QGridLayout(GroupButtons->layout()); - GroupButtonsLayout->setAlignment(Qt::AlignTop); - GroupButtonsLayout->setSpacing(6); - GroupButtonsLayout->setMargin(11); - buttonHelp = new QPushButton(GroupButtons, "buttonHelp"); - buttonHelp->setText(tr("SMESH_BUT_HELP" )); - buttonHelp->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonHelp, 0, 4); - buttonCancel = new QPushButton(GroupButtons, "buttonCancel"); - buttonCancel->setText(tr("SMESH_BUT_CLOSE" )); - buttonCancel->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonCancel, 0, 3); - buttonApply = new QPushButton(GroupButtons, "buttonApply"); - buttonApply->setText(tr("SMESH_BUT_APPLY" )); - buttonApply->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonApply, 0, 1); - QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - GroupButtonsLayout->addItem(spacer_9, 0, 2); - buttonOk = new QPushButton(GroupButtons, "buttonOk"); - buttonOk->setText(tr("SMESH_BUT_OK" )); - buttonOk->setAutoDefault(TRUE); - buttonOk->setDefault(TRUE); - GroupButtonsLayout->addWidget(buttonOk, 0, 0); - SMESHGUI_TranslationDlgLayout->addWidget(GroupButtons, 2, 0); + ConstructorsBox = new QGroupBox(tr("SMESH_TRANSLATION"), this); + GroupConstructors = new QButtonGroup(this); + QHBoxLayout* ConstructorsBoxLayout = new QHBoxLayout(ConstructorsBox); + ConstructorsBoxLayout->setSpacing(SPACING); + ConstructorsBoxLayout->setMargin(MARGIN); + + RadioButton1= new QRadioButton(ConstructorsBox); + RadioButton1->setIcon(image0); + RadioButton2= new QRadioButton(ConstructorsBox); + RadioButton2->setIcon(image1); + + ConstructorsBoxLayout->addWidget(RadioButton1); + ConstructorsBoxLayout->addWidget(RadioButton2); + GroupConstructors->addButton(RadioButton1, 0); + GroupConstructors->addButton(RadioButton2, 1); /***************************************************************/ - GroupArguments = new QGroupBox(this, "GroupArguments"); - GroupArguments->setTitle(tr("SMESH_ARGUMENTS")); - GroupArguments->setColumnLayout(0, Qt::Vertical); - GroupArguments->layout()->setSpacing(0); - GroupArguments->layout()->setMargin(0); - GroupArgumentsLayout = new QGridLayout(GroupArguments->layout()); - GroupArgumentsLayout->setAlignment(Qt::AlignTop); - GroupArgumentsLayout->setSpacing(6); - GroupArgumentsLayout->setMargin(11); + GroupArguments = new QGroupBox(tr("SMESH_ARGUMENTS"), this); + QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments); + GroupArgumentsLayout->setSpacing(SPACING); + GroupArgumentsLayout->setMargin(MARGIN); // Controls for elements selection - TextLabelElements = new QLabel(GroupArguments, "TextLabelElements"); - TextLabelElements->setText(tr("SMESH_ID_ELEMENTS" )); - TextLabelElements->setFixedWidth(74); - GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0); - - SelectElementsButton = new QPushButton(GroupArguments, "SelectElementsButton"); - SelectElementsButton->setText(tr("" )); - SelectElementsButton->setPixmap(image2); - SelectElementsButton->setToggleButton(FALSE); - GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1); - - LineEditElements = new QLineEdit(GroupArguments, "LineEditElements"); - LineEditElements->setValidator(new SMESHGUI_IdValidator(this, "validator")); - GroupArgumentsLayout->addMultiCellWidget(LineEditElements, 0, 0, 2, 7); + TextLabelElements = new QLabel(tr("SMESH_ID_ELEMENTS"), GroupArguments); + SelectElementsButton = new QPushButton(GroupArguments); + SelectElementsButton->setIcon(image2); + LineEditElements = new QLineEdit(GroupArguments); + LineEditElements->setValidator(new SMESHGUI_IdValidator(this)); // Control for the whole mesh selection - CheckBoxMesh = new QCheckBox(GroupArguments, "CheckBoxMesh"); - CheckBoxMesh->setText(tr("SMESH_SELECT_WHOLE_MESH" )); - GroupArgumentsLayout->addMultiCellWidget(CheckBoxMesh, 1, 1, 0, 7); + CheckBoxMesh = new QCheckBox(tr("SMESH_SELECT_WHOLE_MESH"), GroupArguments); // Controls for vector and points selection - TextLabel1 = new QLabel(GroupArguments, "TextLabel1"); - GroupArgumentsLayout->addWidget(TextLabel1, 2, 0); - - SelectButton1 = new QPushButton(GroupArguments, "SelectButton1"); - SelectButton1->setText(tr("" )); - SelectButton1->setPixmap(image2); - SelectButton1->setToggleButton(FALSE); - GroupArgumentsLayout->addWidget(SelectButton1, 2, 1); - - TextLabel1_1 = new QLabel(GroupArguments, "TextLabel1_1"); - TextLabel1_1->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); - GroupArgumentsLayout->addWidget(TextLabel1_1, 2, 2); - - SpinBox1_1 = new SMESHGUI_SpinBox(GroupArguments, "SpinBox1_1"); - GroupArgumentsLayout->addWidget(SpinBox1_1, 2, 3); - - TextLabel1_2 = new QLabel(GroupArguments, "TextLabel1_2"); - TextLabel1_2->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); - GroupArgumentsLayout->addWidget(TextLabel1_2, 2, 4); - - SpinBox1_2 = new SMESHGUI_SpinBox(GroupArguments, "SpinBox1_2"); - GroupArgumentsLayout->addWidget(SpinBox1_2, 2, 5); - - TextLabel1_3 = new QLabel(GroupArguments, "TextLabel1_3"); - TextLabel1_3->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); - GroupArgumentsLayout->addWidget(TextLabel1_3, 2, 6); - - SpinBox1_3 = new SMESHGUI_SpinBox(GroupArguments, "SpinBox1_3"); - GroupArgumentsLayout->addWidget(SpinBox1_3, 2, 7); - - TextLabel2 = new QLabel(GroupArguments, "TextLabel2"); - TextLabel2->setText(tr("SMESH_POINT_2" )); - GroupArgumentsLayout->addWidget(TextLabel2, 3, 0); - - SelectButton2 = new QPushButton(GroupArguments, "SelectButton2"); - SelectButton2->setText(tr("" )); - SelectButton2->setPixmap(image2); - SelectButton2->setToggleButton(FALSE); - GroupArgumentsLayout->addWidget(SelectButton2, 3, 1); - - TextLabel2_1 = new QLabel(GroupArguments, "TextLabel2_1"); - TextLabel2_1->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); - TextLabel2_1->setText(tr("SMESH_X" )); - GroupArgumentsLayout->addWidget(TextLabel2_1, 3, 2); - - SpinBox2_1 = new SMESHGUI_SpinBox(GroupArguments, "SpinBox2_1"); - GroupArgumentsLayout->addWidget(SpinBox2_1, 3, 3); - - TextLabel2_2 = new QLabel(GroupArguments, "TextLabel2_2"); - TextLabel2_2->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); - TextLabel2_2->setText(tr("SMESH_Y" )); - GroupArgumentsLayout->addWidget(TextLabel2_2, 3, 4); - - SpinBox2_2 = new SMESHGUI_SpinBox(GroupArguments, "SpinBox2_2"); - GroupArgumentsLayout->addWidget(SpinBox2_2, 3, 5); - - TextLabel2_3 = new QLabel(GroupArguments, "TextLabel2_3"); - TextLabel2_3->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs ); - TextLabel2_3->setText(tr("SMESH_Z")); - GroupArgumentsLayout->addWidget(TextLabel2_3, 3, 6); - - SpinBox2_3 = new SMESHGUI_SpinBox(GroupArguments, "SpinBox2_3"); - GroupArgumentsLayout->addWidget(SpinBox2_3, 3, 7); - - // Controls for "Create a copy" option -// CheckBoxCopy = new QCheckBox(GroupArguments, "CheckBoxCopy"); -// CheckBoxCopy->setText(tr("SMESH_CREATE_COPY")); -// GroupArgumentsLayout->addMultiCellWidget(CheckBoxCopy, 4, 4, 0, 2); + TextLabel1 = new QLabel(GroupArguments); + SelectButton1 = new QPushButton(GroupArguments); + SelectButton1->setIcon(image2); + + TextLabel1_1 = new QLabel(GroupArguments); + SpinBox1_1 = new SMESHGUI_SpinBox(GroupArguments); + TextLabel1_2 = new QLabel(GroupArguments); + SpinBox1_2 = new SMESHGUI_SpinBox(GroupArguments); + TextLabel1_3 = new QLabel(GroupArguments); + SpinBox1_3 = new SMESHGUI_SpinBox(GroupArguments); + + TextLabel2 = new QLabel(tr("SMESH_POINT_2"), GroupArguments); + SelectButton2 = new QPushButton(GroupArguments); + SelectButton2->setIcon(image2); + + TextLabel2_1 = new QLabel(tr("SMESH_X"), GroupArguments); + SpinBox2_1 = new SMESHGUI_SpinBox(GroupArguments); + TextLabel2_2 = new QLabel(tr("SMESH_Y"), GroupArguments); + SpinBox2_2 = new SMESHGUI_SpinBox(GroupArguments); + TextLabel2_3 = new QLabel(tr("SMESH_Z"), GroupArguments); + SpinBox2_3 = new SMESHGUI_SpinBox(GroupArguments); // switch of action type - ActionGroup = new QButtonGroup(1, Qt::Horizontal, GroupArguments, "ActionGroup"); - ActionGroup->setExclusive(true); - ActionGroup->insert(new QRadioButton(tr("SMESH_MOVE_ELEMENTS"),ActionGroup), MOVE_ELEMS_BUTTON); - ActionGroup->insert(new QRadioButton(tr("SMESH_COPY_ELEMENTS"),ActionGroup), COPY_ELEMS_BUTTON); - ActionGroup->insert(new QRadioButton(tr("SMESH_CREATE_MESH" ),ActionGroup), MAKE_MESH_BUTTON); - GroupArgumentsLayout->addMultiCellWidget(ActionGroup, 4, 6, 0, 3); + ActionBox = new QGroupBox(tr("ACTION"), GroupArguments); + ActionGroup = new QButtonGroup(GroupArguments); + QVBoxLayout* ActionBoxLayout = new QVBoxLayout(ActionBox); + ActionBoxLayout->addSpacing(SPACING); + ActionBoxLayout->setMargin(MARGIN); + + QRadioButton* aMoveElements = new QRadioButton(tr("SMESH_MOVE_ELEMENTS"), ActionBox); + QRadioButton* aCopyElements = new QRadioButton(tr("SMESH_COPY_ELEMENTS"), ActionBox); + QRadioButton* aCreateMesh = new QRadioButton(tr("SMESH_CREATE_MESH"), ActionBox); + + ActionBoxLayout->addWidget(aMoveElements); + ActionBoxLayout->addWidget(aCopyElements); + ActionBoxLayout->addWidget(aCreateMesh); + ActionGroup->addButton(aMoveElements, MOVE_ELEMS_BUTTON); + ActionGroup->addButton(aCopyElements, COPY_ELEMS_BUTTON); + ActionGroup->addButton(aCreateMesh, MAKE_MESH_BUTTON); // CheckBox for groups generation MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments); MakeGroupsCheck->setChecked(false); - GroupArgumentsLayout->addMultiCellWidget(MakeGroupsCheck, 5, 5, 4, 7); // Name of a mesh to create - LineEditNewMesh = new QLineEdit(GroupArguments, "LineEditNewMesh"); - GroupArgumentsLayout->addMultiCellWidget(LineEditNewMesh, 6, 6, 4, 7); + LineEditNewMesh = new QLineEdit(GroupArguments); + + // layout + GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0); + GroupArgumentsLayout->addWidget(SelectElementsButton, 0, 1); + GroupArgumentsLayout->addWidget(LineEditElements, 0, 2, 1, 6); + GroupArgumentsLayout->addWidget(CheckBoxMesh, 1, 0, 1, 8); + GroupArgumentsLayout->addWidget(TextLabel1, 2, 0); + GroupArgumentsLayout->addWidget(SelectButton1, 2, 1); + GroupArgumentsLayout->addWidget(TextLabel1_1, 2, 2); + GroupArgumentsLayout->addWidget(SpinBox1_1, 2, 3); + GroupArgumentsLayout->addWidget(TextLabel1_2, 2, 4); + GroupArgumentsLayout->addWidget(SpinBox1_2, 2, 5); + GroupArgumentsLayout->addWidget(TextLabel1_3, 2, 6); + GroupArgumentsLayout->addWidget(SpinBox1_3, 2, 7); + GroupArgumentsLayout->addWidget(TextLabel2, 3, 0); + GroupArgumentsLayout->addWidget(SelectButton2, 3, 1); + GroupArgumentsLayout->addWidget(TextLabel2_1, 3, 2); + GroupArgumentsLayout->addWidget(SpinBox2_1, 3, 3); + GroupArgumentsLayout->addWidget(TextLabel2_2, 3, 4); + GroupArgumentsLayout->addWidget(SpinBox2_2, 3, 5); + GroupArgumentsLayout->addWidget(TextLabel2_3, 3, 6); + GroupArgumentsLayout->addWidget(SpinBox2_3, 3, 7); + GroupArgumentsLayout->addWidget(ActionBox, 4, 0, 3, 4); + GroupArgumentsLayout->addWidget(MakeGroupsCheck, 5, 5, 1, 4); + GroupArgumentsLayout->addWidget(LineEditNewMesh, 6, 5, 1, 4); - SMESHGUI_TranslationDlgLayout->addWidget(GroupArguments, 1, 0); + /***************************************************************/ + GroupButtons = new QGroupBox(this); + QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons); + GroupButtonsLayout->setSpacing(SPACING); + GroupButtonsLayout->setMargin(MARGIN); + + buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk->setAutoDefault(true); + buttonOk->setDefault(true); + buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons); + buttonApply->setAutoDefault(true); + buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons); + buttonCancel->setAutoDefault(true); + buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons); + buttonHelp->setAutoDefault(true); + + GroupButtonsLayout->addWidget(buttonOk); + GroupButtonsLayout->addSpacing(10); + GroupButtonsLayout->addWidget(buttonApply); + GroupButtonsLayout->addSpacing(10); + GroupButtonsLayout->addStretch(); + GroupButtonsLayout->addWidget(buttonCancel); + GroupButtonsLayout->addWidget(buttonHelp); + + /***************************************************************/ + SMESHGUI_TranslationDlgLayout->addWidget(ConstructorsBox); + SMESHGUI_TranslationDlgLayout->addWidget(GroupArguments); + SMESHGUI_TranslationDlgLayout->addWidget(GroupButtons); /* Initialisations */ SpinBox1_1->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); @@ -290,8 +247,7 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule, const cha SpinBox2_2->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); SpinBox2_3->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, DBL_DIGITS_DISPLAY); - GroupArguments->show(); - RadioButton1->setChecked(TRUE); + RadioButton1->setChecked(true); mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); @@ -301,7 +257,7 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule, const cha SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH); SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter (GROUP); - QPtrList aListOfFilters; + QList aListOfFilters; if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter); if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter); @@ -313,11 +269,11 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule, const cha Init(); /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); - connect(GroupConstructors, SIGNAL(clicked(int)), SLOT(ConstructorsClicked(int))); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); + connect(GroupConstructors, SIGNAL(buttonClicked(int)), SLOT(ConstructorsClicked(int))); connect(SelectElementsButton, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument())); connect(SelectButton1, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument())); @@ -329,14 +285,11 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule, const cha connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&))); connect(CheckBoxMesh, SIGNAL(toggled(bool)), SLOT(onSelectMesh(bool))); - connect(ActionGroup, SIGNAL(clicked(int)), SLOT(onActionClicked(int))); - - this->show(); /* displays Dialog */ + connect(ActionGroup, SIGNAL(buttonClicked(int)), SLOT(onActionClicked(int))); ConstructorsClicked(0); SelectionIntoArgument(); onActionClicked(MOVE_ELEMS_BUTTON); - resize(0,0); // ?? } //================================================================================= @@ -345,7 +298,6 @@ SMESHGUI_TranslationDlg::SMESHGUI_TranslationDlg( SMESHGUI* theModule, const cha //================================================================================= SMESHGUI_TranslationDlg::~SMESHGUI_TranslationDlg() { - // no need to delete child widgets, Qt does it all for us } //================================================================================= @@ -375,7 +327,7 @@ void SMESHGUI_TranslationDlg::Init (bool ResetControls) SpinBox2_2->SetValue(0.0); SpinBox2_3->SetValue(0.0); - ((QRadioButton*) ActionGroup->find( MOVE_ELEMS_BUTTON ))->setChecked(TRUE); + ActionGroup->button( MOVE_ELEMS_BUTTON )->setChecked(true); CheckBoxMesh->setChecked(false); // MakeGroupsCheck->setChecked(false); // MakeGroupsCheck->setEnabled(false); @@ -444,6 +396,10 @@ void SMESHGUI_TranslationDlg::ConstructorsClicked (int constructorId) onSelectMesh(true); connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + QApplication::instance()->processEvents(); + updateGeometry(); + resize( minimumSize() ); } //================================================================================= @@ -456,7 +412,7 @@ void SMESHGUI_TranslationDlg::ClickOnApply() return; if (myNbOkElements) { - QStringList aListElementsId = QStringList::split(" ", myElementsId, false); + QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts); SMESH::long_array_var anElementsId = new SMESH::long_array; @@ -475,11 +431,11 @@ void SMESHGUI_TranslationDlg::ClickOnApply() aVector.PS.z = SpinBox1_3->GetValue(); } - int actionButton = ActionGroup->id( ActionGroup->selected() ); + int actionButton = ActionGroup->checkedId(); bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ); try { SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); - QApplication::setOverrideCursor(Qt::waitCursor); + QApplication::setOverrideCursor(Qt::WaitCursor); switch ( actionButton ) { case MOVE_ELEMS_BUTTON: aMeshEditor->Translate(anElementsId, aVector, false); @@ -494,7 +450,7 @@ void SMESHGUI_TranslationDlg::ClickOnApply() case MAKE_MESH_BUTTON: SMESH::SMESH_Mesh_var mesh = aMeshEditor->TranslateMakeMesh(anElementsId, aVector, makeGroups, - LineEditNewMesh->text().latin1()); + LineEditNewMesh->text().toLatin1().data()); } QApplication::restoreOverrideCursor(); } catch (...) { @@ -546,16 +502,17 @@ void SMESHGUI_TranslationDlg::ClickOnHelp() if (app) app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); else { - QString platform; + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + platform)). + arg(myHelpFileName)); } } @@ -586,7 +543,7 @@ void SMESHGUI_TranslationDlg::onTextChange (const QString& theNewText) TColStd_MapOfInteger newIndices; - QStringList aListId = QStringList::split(" ", theNewText, false); + QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts); if (send == LineEditElements) { for (int i = 0; i < aListId.count(); i++) { @@ -665,7 +622,7 @@ void SMESHGUI_TranslationDlg::SelectionIntoArgument() MakeGroupsCheck->setChecked(false); MakeGroupsCheck->setEnabled(false); } - else if ( ActionGroup->id( ActionGroup->selected() ) != MOVE_ELEMS_BUTTON ) { + else if ( ActionGroup->checkedId() != MOVE_ELEMS_BUTTON ) { MakeGroupsCheck->setEnabled(true); } @@ -811,8 +768,8 @@ void SMESHGUI_TranslationDlg::SetEditCurrentArgument() //================================================================================= void SMESHGUI_TranslationDlg::DeactivateActiveDialog() { - if (GroupConstructors->isEnabled()) { - GroupConstructors->setEnabled(false); + if (ConstructorsBox->isEnabled()) { + ConstructorsBox->setEnabled(false); GroupArguments->setEnabled(false); GroupButtons->setEnabled(false); mySMESHGUI->ResetState(); @@ -828,7 +785,7 @@ void SMESHGUI_TranslationDlg::ActivateThisDialog() { /* Emit a signal to deactivate the active dialog */ mySMESHGUI->EmitSignalDeactivateDialog(); - GroupConstructors->setEnabled(true); + ConstructorsBox->setEnabled(true); GroupArguments->setEnabled(true); GroupButtons->setEnabled(true); @@ -846,7 +803,7 @@ void SMESHGUI_TranslationDlg::ActivateThisDialog() //================================================================================= void SMESHGUI_TranslationDlg::enterEvent (QEvent*) { - if (!GroupConstructors->isEnabled()) + if (!ConstructorsBox->isEnabled()) ActivateThisDialog(); } @@ -857,7 +814,7 @@ void SMESHGUI_TranslationDlg::enterEvent (QEvent*) void SMESHGUI_TranslationDlg::closeEvent (QCloseEvent*) { /* same than click on cancel button */ - this->ClickOnCancel(); + ClickOnCancel(); } //======================================================================= @@ -951,10 +908,10 @@ void SMESHGUI_TranslationDlg::setNewMeshName() } else { _PTR(SObject) meshSO = SMESH::FindSObject( myMesh ); - name = meshSO->GetName(); + name = meshSO->GetName().c_str(); } if ( !name.isEmpty() ) - LineEditNewMesh->setText( SMESH::UniqueMeshName( name.latin1(), "translated")); + LineEditNewMesh->setText( SMESH::UniqueMeshName( name, "translated")); } } @@ -964,9 +921,7 @@ void SMESHGUI_TranslationDlg::setNewMeshName() //================================================================================= int SMESHGUI_TranslationDlg::GetConstructorId() { - if (GroupConstructors != NULL && GroupConstructors->selected() != NULL) - return GroupConstructors->id(GroupConstructors->selected()); - return -1; + return GroupConstructors->checkedId(); } //================================================================================= @@ -979,9 +934,8 @@ void SMESHGUI_TranslationDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) - { - e->accept(); - ClickOnHelp(); - } + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + ClickOnHelp(); + } } diff --git a/src/SMESHGUI/SMESHGUI_TranslationDlg.h b/src/SMESHGUI/SMESHGUI_TranslationDlg.h index 31ebe1b5c..2bc68ca7e 100644 --- a/src/SMESHGUI/SMESHGUI_TranslationDlg.h +++ b/src/SMESHGUI/SMESHGUI_TranslationDlg.h @@ -1,44 +1,41 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_TranslationDlg.h +// Author : Michael ZORIN, Open CASCADE S.A.S. // -// File : SMESHGUI_TranslationDlg.h -// Author : Michael ZORIN -// Module : SMESH -// $Header: -#ifndef DIALOGBOX_TRANSLATION_H -#define DIALOGBOX_TRANSLATION_H +#ifndef SMESHGUI_TRANSLATIONDLG_H +#define SMESHGUI_TRANSLATIONDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include "LightApp_SelectionMgr.h" +// Qt includes +#include -#include "SMESH_LogicalFilter.hxx" - -// QT Includes -#include +// IDL includes +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) -class QGridLayout; class QButtonGroup; class QGroupBox; class QLabel; @@ -49,13 +46,9 @@ class QCheckBox; class SMESHGUI; class SMESHGUI_SpinBox; class SMESH_Actor; -class SVTK_ViewWindow; class SVTK_Selector; - -// IDL Headers -#include -#include CORBA_SERVER_HEADER(SMESH_Mesh) - +class LightApp_SelectionMgr; +class SMESH_LogicalFilter; //================================================================================= // class : SMESHGUI_TranslationDlg @@ -63,94 +56,86 @@ class SVTK_Selector; //================================================================================= class SMESHGUI_EXPORT SMESHGUI_TranslationDlg : public QDialog { - Q_OBJECT + Q_OBJECT public: - SMESHGUI_TranslationDlg( SMESHGUI*, - const char* name = 0, - bool modal = FALSE, - WFlags fl = 0); - ~SMESHGUI_TranslationDlg(); + SMESHGUI_TranslationDlg( SMESHGUI* ); + ~SMESHGUI_TranslationDlg(); private: - void Init (bool ResetControls = true); - void closeEvent (QCloseEvent*); - void enterEvent (QEvent*); /* mouse enter the QWidget */ - void hideEvent (QHideEvent*); /* ESC key */ - void keyPressEvent(QKeyEvent*); - int GetConstructorId(); - void setNewMeshName(); - - SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ - LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ - QString myElementsId; - int myNbOkElements; /* to check when elements are defined */ - - SVTK_Selector* mySelector; - - QWidget* myEditCurrentArgument; - - bool myBusy; - SMESH::SMESH_Mesh_var myMesh; - SMESH_Actor* myActor; - SMESH_LogicalFilter* myMeshOrSubMeshOrGroupFilter; - - QButtonGroup* GroupConstructors; - QRadioButton* RadioButton1; - QRadioButton* RadioButton2; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - QPushButton* buttonHelp; - QGroupBox* GroupArguments; - QLabel* TextLabelElements; - QPushButton* SelectElementsButton; - QLineEdit* LineEditElements; - QCheckBox* CheckBoxMesh; - QLabel* TextLabel1; - QPushButton* SelectButton1; - QLabel* TextLabel1_1; - SMESHGUI_SpinBox* SpinBox1_1; - QLabel* TextLabel1_2; - SMESHGUI_SpinBox* SpinBox1_2; - QLabel* TextLabel1_3; - SMESHGUI_SpinBox* SpinBox1_3; - QLabel* TextLabel2; - QPushButton* SelectButton2; - QLabel* TextLabel2_1; - SMESHGUI_SpinBox* SpinBox2_1; - QLabel* TextLabel2_2; - SMESHGUI_SpinBox* SpinBox2_2; - QLabel* TextLabel2_3; - SMESHGUI_SpinBox* SpinBox2_3; - //QCheckBox* CheckBoxCopy; - QButtonGroup* ActionGroup; - QCheckBox* MakeGroupsCheck; - QLineEdit* LineEditNewMesh; - - QString myHelpFileName; + void Init( bool = true ); + void closeEvent( QCloseEvent* ); + void enterEvent( QEvent* ); /* mouse enter the QWidget */ + void hideEvent( QHideEvent* ); /* ESC key */ + void keyPressEvent( QKeyEvent* ); + int GetConstructorId(); + void setNewMeshName(); + + SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ + LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ + QString myElementsId; + int myNbOkElements; /* to check when elements are defined */ + + SVTK_Selector* mySelector; + + QWidget* myEditCurrentArgument; + + bool myBusy; + SMESH::SMESH_Mesh_var myMesh; + SMESH_Actor* myActor; + SMESH_LogicalFilter* myMeshOrSubMeshOrGroupFilter; + + QGroupBox* ConstructorsBox; + QButtonGroup* GroupConstructors; + QRadioButton* RadioButton1; + QRadioButton* RadioButton2; + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QPushButton* buttonApply; + QPushButton* buttonHelp; + QGroupBox* GroupArguments; + QLabel* TextLabelElements; + QPushButton* SelectElementsButton; + QLineEdit* LineEditElements; + QCheckBox* CheckBoxMesh; + QLabel* TextLabel1; + QPushButton* SelectButton1; + QLabel* TextLabel1_1; + SMESHGUI_SpinBox* SpinBox1_1; + QLabel* TextLabel1_2; + SMESHGUI_SpinBox* SpinBox1_2; + QLabel* TextLabel1_3; + SMESHGUI_SpinBox* SpinBox1_3; + QLabel* TextLabel2; + QPushButton* SelectButton2; + QLabel* TextLabel2_1; + SMESHGUI_SpinBox* SpinBox2_1; + QLabel* TextLabel2_2; + SMESHGUI_SpinBox* SpinBox2_2; + QLabel* TextLabel2_3; + SMESHGUI_SpinBox* SpinBox2_3; + //QCheckBox* CheckBoxCopy; + QGroupBox* ActionBox; + QButtonGroup* ActionGroup; + QCheckBox* MakeGroupsCheck; + QLineEdit* LineEditNewMesh; + + QString myHelpFileName; - private slots: - - void ConstructorsClicked(int constructorId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnApply(); - void ClickOnHelp(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void onTextChange(const QString&); - void onSelectMesh(bool toSelectMesh); - void onActionClicked(int button); - -protected: - QGridLayout* SMESHGUI_TranslationDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupArgumentsLayout; +private slots: + void ConstructorsClicked( int ); + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnApply(); + void ClickOnHelp(); + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void DeactivateActiveDialog(); + void ActivateThisDialog(); + void onTextChange( const QString& ); + void onSelectMesh( bool ); + void onActionClicked( int ); }; -#endif // DIALOGBOX_TRANSLATION_H +#endif // SMESHGUI_TRANSLATIONDLG_H diff --git a/src/SMESHGUI/SMESHGUI_TransparencyDlg.cxx b/src/SMESHGUI/SMESHGUI_TransparencyDlg.cxx index ec40570ef..3a1458b0f 100644 --- a/src/SMESHGUI/SMESHGUI_TransparencyDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_TransparencyDlg.cxx @@ -1,31 +1,29 @@ -// SMESH SMESHGUI : GUI for SMESH component -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// SMESH SMESHGUI : GUI for SMESH component // +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_TransparencyDlg.cxx +// Author : Nicolas REJNERI, Open CASCADE S.A.S. // -// -// File : SMESHGUI_TransparencyDlg.cxx -// Author : Nicolas REJNERI -// Module : SMESH -// $Header$ +// SMESH includes #include "SMESHGUI_TransparencyDlg.h" #include "SMESHGUI.h" @@ -33,132 +31,119 @@ #include "SMESHGUI_Utils.h" #include "SMESH_Actor.h" -#include "SUIT_Desktop.h" -#include "SUIT_OverrideCursor.h" -#include "SUIT_Session.h" -#include "SUIT_MessageBox.h" +// SALOME GUI includes +#include +#include +#include +#include +#include -#include "SALOME_ListIO.hxx" -#include "SALOME_ListIteratorOfListIO.hxx" -#include "SALOME_InteractiveObject.hxx" +#include +#include -#include "SalomeApp_Study.h" -#include "LightApp_Application.h" -#include "LightApp_SelectionMgr.h" +#include +#include -#include "SVTK_ViewWindow.h" +#include -// QT Includes -#include -#include -#include -#include -#include +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include -using namespace std; +#define SPACING 6 +#define MARGIN 11 //================================================================================= // class : SMESHGUI_TransparencyDlg() // purpose : // //================================================================================= -SMESHGUI_TransparencyDlg::SMESHGUI_TransparencyDlg( SMESHGUI* theModule, - const char* name, - bool modal, - WFlags fl) - : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | - WStyle_Title | WStyle_SysMenu | WDestructiveClose ), - mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), - myViewWindow( SMESH::GetViewWindow( theModule ) ) +SMESHGUI_TransparencyDlg::SMESHGUI_TransparencyDlg( SMESHGUI* theModule ) + : QDialog( SMESH::GetDesktop( theModule ) ), + mySMESHGUI( theModule ), + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), + myViewWindow( SMESH::GetViewWindow( theModule ) ) { - if (!name) - setName("SMESHGUI_TransparencyDlg"); - setCaption(tr("SMESH_TRANSPARENCY_TITLE" )); - setSizeGripEnabled(TRUE); - QGridLayout* SMESHGUI_TransparencyDlgLayout = new QGridLayout(this); - SMESHGUI_TransparencyDlgLayout->setSpacing(6); - SMESHGUI_TransparencyDlgLayout->setMargin(11); + setModal( false ); + setAttribute( Qt::WA_DeleteOnClose, true ); + setWindowTitle( tr( "SMESH_TRANSPARENCY_TITLE" ) ); + setSizeGripEnabled( true ); + + QVBoxLayout* SMESHGUI_TransparencyDlgLayout = new QVBoxLayout( this ); + SMESHGUI_TransparencyDlgLayout->setSpacing( SPACING ); + SMESHGUI_TransparencyDlgLayout->setMargin( MARGIN ); /*************************************************************************/ - QGroupBox* GroupC1 = new QGroupBox(this, "GroupC1"); - GroupC1->setColumnLayout(0, Qt::Vertical); - GroupC1->layout()->setSpacing(0); - GroupC1->layout()->setMargin(0); - QGridLayout* GroupC1Layout = new QGridLayout(GroupC1->layout()); - GroupC1Layout->setAlignment(Qt::AlignTop); - GroupC1Layout->setSpacing(6); - GroupC1Layout->setMargin(11); - - TextLabelTransparent = new QLabel(GroupC1, "TextLabelTransparent"); - TextLabelTransparent->setText(tr("SMESH_TRANSPARENCY_TRANSPARENT" )); - TextLabelTransparent->setAlignment(AlignLeft); - GroupC1Layout->addWidget(TextLabelTransparent, 0, 0); - - ValueLab = new QLabel(GroupC1, "ValueLab"); - ValueLab->setAlignment(AlignCenter); - ValueLab->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); - QFont fnt = ValueLab->font(); fnt.setBold(true); ValueLab->setFont(fnt); - GroupC1Layout->addWidget(ValueLab, 0, 1); - - TextLabelOpaque = new QLabel(GroupC1, "TextLabelOpaque"); - TextLabelOpaque->setText(tr("SMESH_TRANSPARENCY_OPAQUE" )); - TextLabelOpaque->setAlignment(AlignRight); - GroupC1Layout->addWidget(TextLabelOpaque, 0, 2); - - Slider1 = new QSlider(0, 10, 1, 5, Horizontal, GroupC1, "Slider1"); - Slider1->setFocusPolicy(QWidget::NoFocus); - Slider1->setMinimumSize(300, 0); - Slider1->setTickmarks(QSlider::Above); - Slider1->setTickInterval(10); - Slider1->setTracking(true); - Slider1->setMinValue(0); - Slider1->setMaxValue(100); - Slider1->setLineStep(1); - Slider1->setPageStep(10); - GroupC1Layout->addMultiCellWidget(Slider1, 1, 1, 0, 2); + QGroupBox* GroupC1 = new QGroupBox( this ); + QGridLayout* GroupC1Layout = new QGridLayout( GroupC1 ); + GroupC1Layout->setSpacing( SPACING ); + GroupC1Layout->setMargin( MARGIN ); + + TextLabelTransparent = new QLabel( tr( "SMESH_TRANSPARENCY_TRANSPARENT" ), GroupC1 ); + TextLabelTransparent->setAlignment( Qt::AlignLeft ); + + ValueLab = new QLabel( GroupC1 ); + ValueLab->setAlignment( Qt::AlignCenter ); + ValueLab->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + QFont fnt = ValueLab->font(); fnt.setBold( true ); ValueLab->setFont( fnt ); + + TextLabelOpaque = new QLabel( tr( "SMESH_TRANSPARENCY_OPAQUE" ), GroupC1 ); + TextLabelOpaque->setAlignment( Qt::AlignRight ); + + Slider1 = new QSlider( Qt::Horizontal, GroupC1 ); + Slider1->setRange( 0, 100 ); + Slider1->setSingleStep( 1 ); + Slider1->setPageStep( 10 ); + Slider1->setTickPosition( QSlider::TicksAbove ); + Slider1->setTickInterval( 10 ); + Slider1->setTracking( true ); + Slider1->setFocusPolicy( Qt::NoFocus ); + Slider1->setMinimumWidth( 300 ); + + GroupC1Layout->addWidget( TextLabelTransparent, 0, 0 ); + GroupC1Layout->addWidget( ValueLab, 0, 1 ); + GroupC1Layout->addWidget( TextLabelOpaque, 0, 2 ); + GroupC1Layout->addWidget( Slider1, 1, 0, 1, 3 ); /*************************************************************************/ - QGroupBox* GroupButtons = new QGroupBox(this, "GroupButtons"); - GroupButtons->setColumnLayout(0, Qt::Vertical); - GroupButtons->layout()->setSpacing(0); - GroupButtons->layout()->setMargin(0); - QGridLayout* GroupButtonsLayout = new QGridLayout(GroupButtons->layout()); - GroupButtonsLayout->setAlignment(Qt::AlignTop); - GroupButtonsLayout->setSpacing(6); - GroupButtonsLayout->setMargin(11); - - buttonOk = new QPushButton(GroupButtons, "buttonOk"); - buttonOk->setText(tr("SMESH_BUT_CLOSE")); - buttonOk->setAutoDefault(TRUE); - buttonOk->setDefault(TRUE); - buttonHelp = new QPushButton(GroupButtons, "buttonHelp"); - buttonHelp->setText(tr("SMESH_BUT_HELP")); - buttonHelp->setAutoDefault(TRUE); - - //GroupButtonsLayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 0); - GroupButtonsLayout->addWidget(buttonOk, 0, 0); - GroupButtonsLayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1); - GroupButtonsLayout->addWidget(buttonHelp, 0, 2); - //GroupButtonsLayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 2); - - SMESHGUI_TransparencyDlgLayout->addWidget(GroupC1, 0, 0); - SMESHGUI_TransparencyDlgLayout->addWidget(GroupButtons, 1, 0); + QGroupBox* GroupButtons = new QGroupBox( this ); + QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons ); + GroupButtonsLayout->setSpacing( SPACING ); + GroupButtonsLayout->setMargin( MARGIN ); + + buttonOk = new QPushButton( tr( "SMESH_BUT_CLOSE" ), GroupButtons ); + buttonOk->setAutoDefault( true ); + buttonOk->setDefault( true ); + buttonHelp = new QPushButton( tr( "SMESH_BUT_HELP" ), GroupButtons ); + buttonHelp->setAutoDefault( true ); + + GroupButtonsLayout->addWidget( buttonOk ); + GroupButtonsLayout->addSpacing( 10 ); + GroupButtonsLayout->addStretch(); + GroupButtonsLayout->addWidget( buttonHelp ); + + /*************************************************************************/ + SMESHGUI_TransparencyDlgLayout->addWidget( GroupC1 ); + SMESHGUI_TransparencyDlgLayout->addWidget( GroupButtons ); // Initial state - this->onSelectionChanged(); + onSelectionChanged(); // signals and slots connections : after ValueHasChanged() - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); - connect(Slider1, SIGNAL(valueChanged(int)), this, SLOT(SetTransparency())); - connect(Slider1, SIGNAL(sliderMoved(int)), this, SLOT(ValueHasChanged())); - connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnOk())); - connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged())); + connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); + connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( ClickOnHelp() ) ); + connect( Slider1, SIGNAL( valueChanged( int ) ), this, SLOT( SetTransparency() ) ); + connect( Slider1, SIGNAL( sliderMoved( int ) ), this, SLOT( ValueHasChanged() ) ); + connect( mySMESHGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnOk() ) ); + connect( mySelectionMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) ); myHelpFileName = "transparency_page.html"; - - this->show(); } //================================================================================= @@ -167,7 +152,6 @@ SMESHGUI_TransparencyDlg::SMESHGUI_TransparencyDlg( SMESHGUI* theModule, //================================================================================= SMESHGUI_TransparencyDlg::~SMESHGUI_TransparencyDlg() { - // no need to delete child widgets, Qt does it all for us } //======================================================================= @@ -185,20 +169,22 @@ void SMESHGUI_TransparencyDlg::ClickOnOk() //================================================================================= void SMESHGUI_TransparencyDlg::ClickOnHelp() { - LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); - if (app) - app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); + LightApp_Application* app = (LightApp_Application*)( SUIT_Session::session()->activeApplication() ); + if ( app ) + app->onHelpContextModule( mySMESHGUI ? app->moduleName( mySMESHGUI->moduleName() ) : + QString( "" ), myHelpFileName ); else { - QString platform; + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", platform)).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ), + tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ). + arg( app->resourceMgr()->stringValue( "ExternalBrowser", + platform ) ). + arg( myHelpFileName ) ); } } @@ -209,19 +195,19 @@ void SMESHGUI_TransparencyDlg::ClickOnHelp() //================================================================================= void SMESHGUI_TransparencyDlg::SetTransparency() { - if( myViewWindow ) { + if ( myViewWindow ) { SUIT_OverrideCursor wc; - float opacity = this->Slider1->value() / 100.; + float opacity = Slider1->value() / 100.; SALOME_ListIO aList; - mySelectionMgr->selectedObjects(aList); + mySelectionMgr->selectedObjects( aList ); - SALOME_ListIteratorOfListIO It (aList); - for (;It.More(); It.Next()) { + SALOME_ListIteratorOfListIO It( aList ); + for ( ; It.More(); It.Next() ) { Handle(SALOME_InteractiveObject) IOS = It.Value(); - SMESH_Actor* anActor = SMESH::FindActorByEntry(IOS->getEntry()); - if (anActor) - anActor->SetOpacity(opacity); + SMESH_Actor* anActor = SMESH::FindActorByEntry( IOS->getEntry() ); + if ( anActor ) + anActor->SetOpacity( opacity ); } myViewWindow->Repaint(); } @@ -234,7 +220,7 @@ void SMESHGUI_TransparencyDlg::SetTransparency() //================================================================================= void SMESHGUI_TransparencyDlg::ValueHasChanged() { - ValueLab->setText(QString::number(this->Slider1->value()) + "%"); + ValueLab->setText( QString::number( Slider1->value() ) + "%") ; } //================================================================================= @@ -243,42 +229,44 @@ void SMESHGUI_TransparencyDlg::ValueHasChanged() //================================================================================= void SMESHGUI_TransparencyDlg::onSelectionChanged() { - if( myViewWindow ) { + if ( myViewWindow ) { int opacity = 100; SALOME_ListIO aList; - mySelectionMgr->selectedObjects(aList); + mySelectionMgr->selectedObjects( aList ); - if (aList.Extent() == 1) { + if ( aList.Extent() == 1 ) { Handle(SALOME_InteractiveObject) FirstIOS = aList.First(); - if (!FirstIOS.IsNull()) { - SMESH_Actor* anActor = SMESH::FindActorByEntry(FirstIOS->getEntry()); - if (anActor) - opacity = int(anActor->GetOpacity() * 100. + 0.5); + if ( !FirstIOS.IsNull() ) { + SMESH_Actor* anActor = SMESH::FindActorByEntry( FirstIOS->getEntry() ); + if ( anActor ) + opacity = int( anActor->GetOpacity() * 100. + 0.5 ); } - } else if (aList.Extent() > 1) { - SALOME_ListIteratorOfListIO It (aList); + } + else if ( aList.Extent() > 1 ) { + SALOME_ListIteratorOfListIO It( aList ); int setOp = -1; - for (; It.More(); It.Next()) { + for ( ; It.More(); It.Next() ) { Handle(SALOME_InteractiveObject) IO = It.Value(); - if (!IO.IsNull()) { - SMESH_Actor* anActor = SMESH::FindActorByEntry(IO->getEntry()); - if (anActor) { - int op = int(anActor->GetOpacity() * 100. + 0.5); - if (setOp < 0) + if ( !IO.IsNull() ) { + SMESH_Actor* anActor = SMESH::FindActorByEntry( IO->getEntry() ); + if ( anActor ) { + int op = int( anActor->GetOpacity() * 100. + 0.5 ); + if ( setOp < 0 ) setOp = op; - else if (setOp != op) { + else if ( setOp != op ) { setOp = 100; break; } } } } - if (setOp >= 0) + if ( setOp >= 0 ) opacity = setOp; - } else { + } + else { } - Slider1->setValue(opacity); + Slider1->setValue( opacity ); } ValueHasChanged(); } @@ -293,9 +281,8 @@ void SMESHGUI_TransparencyDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) - { - e->accept(); - ClickOnHelp(); - } + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + ClickOnHelp(); + } } diff --git a/src/SMESHGUI/SMESHGUI_TransparencyDlg.h b/src/SMESHGUI/SMESHGUI_TransparencyDlg.h index 0968e062b..bab5dfba8 100644 --- a/src/SMESHGUI/SMESHGUI_TransparencyDlg.h +++ b/src/SMESHGUI/SMESHGUI_TransparencyDlg.h @@ -1,44 +1,41 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_TransparencyDlg.h +// Author : Nicolas REJNERI, Open CASCADE S.A.S. // -// -// File : SMESHGUI_TransparencyDlg.h -// Author : Nicolas REJNERI -// Module : SMESH -// $Header$ -#ifndef DIALOGBOX_TRANSPARENCYDLG_H -#define DIALOGBOX_TRANSPARENCYDLG_H +#ifndef SMESHGUI_TRANSPARENCYDLG_H +#define SMESHGUI_TRANSPARENCYDLG_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -// QT Includes -#include +// Qt includes +#include class QLabel; class QPushButton; class QSlider; class LightApp_SelectionMgr; -class SVTK_Selector; class SVTK_ViewWindow; class SMESHGUI; @@ -48,41 +45,35 @@ class SMESHGUI; //================================================================================= class SMESHGUI_EXPORT SMESHGUI_TransparencyDlg : public QDialog { - Q_OBJECT + Q_OBJECT public: - SMESHGUI_TransparencyDlg( SMESHGUI*, - const char* name = 0, - bool modal = false, - WFlags fl = 0 ); - - ~SMESHGUI_TransparencyDlg(); + SMESHGUI_TransparencyDlg( SMESHGUI* ); + ~SMESHGUI_TransparencyDlg(); private: - void keyPressEvent(QKeyEvent*); - -private : + void keyPressEvent( QKeyEvent* ); +private: SMESHGUI* mySMESHGUI; LightApp_SelectionMgr* mySelectionMgr; SVTK_ViewWindow* myViewWindow; - QPushButton* buttonOk; - QPushButton* buttonHelp; - QLabel* TextLabelOpaque; - QLabel* ValueLab; - QLabel* TextLabelTransparent; - QSlider* Slider1; + QPushButton* buttonOk; + QPushButton* buttonHelp; + QLabel* TextLabelOpaque; + QLabel* ValueLab; + QLabel* TextLabelTransparent; + QSlider* Slider1; - QString myHelpFileName; + QString myHelpFileName; public slots: - - void ClickOnOk(); - void ClickOnHelp(); - void ValueHasChanged(); - void SetTransparency(); - void onSelectionChanged(); + void ClickOnOk(); + void ClickOnHelp(); + void ValueHasChanged(); + void SetTransparency(); + void onSelectionChanged(); }; -#endif // DIALOGBOX_TRANSPARENCYDLG_H +#endif // SMESHGUI_TRANSPARENCYDLG_H diff --git a/src/SMESHGUI/SMESHGUI_Utils.cxx b/src/SMESHGUI/SMESHGUI_Utils.cxx index 6ef3fddab..4462fa4cd 100644 --- a/src/SMESHGUI/SMESHGUI_Utils.cxx +++ b/src/SMESHGUI/SMESHGUI_Utils.cxx @@ -1,51 +1,48 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// SMESH SMESHGUI : GUI for SMESH component // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_Utils.cxx +// Author : Open CASCADE S.A.S. +// - -#include - +// SMESH includes #include "SMESHGUI_Utils.h" -#include "SMESHGUI.h" - -#include "OB_Browser.h" - -#include "SUIT_Desktop.h" -#include "SUIT_Application.h" -#include "SUIT_Session.h" -#include "SUIT_MessageBox.h" -#include "LightApp_SelectionMgr.h" -#include "SalomeApp_Application.h" -#include "SalomeApp_Module.h" -#include "SalomeApp_Study.h" - -#include "SALOME_ListIO.hxx" - -#include "SALOMEconfig.h" -#include CORBA_CLIENT_HEADER(GEOM_Gen) +#include "SMESHGUI.h" -#include "utilities.h" +// SALOME GUI includes +#include +#include +#include +#include -//using namespace std; +#include +#include +#include +#include -namespace SMESH{ +#include +namespace SMESH +{ SUIT_Desktop* GetDesktop(const CAM_Module* theModule) { @@ -87,7 +84,6 @@ namespace SMESH{ return anObj; } - SUIT_Study* GetActiveStudy() { SUIT_Application* app = SUIT_Session::session()->activeApplication(); @@ -130,7 +126,7 @@ namespace SMESH{ return _PTR(SObject)(); } - void SetName (_PTR(SObject) theSObject, const char* theName) + void SetName (_PTR(SObject) theSObject, const QString& theName) { _PTR(Study) aStudy = GetActiveStudyDocument(); if (aStudy->GetProperties()->IsLocked()) @@ -140,10 +136,10 @@ namespace SMESH{ aBuilder->FindOrCreateAttribute(theSObject, "AttributeName"); _PTR(AttributeName) aName = anAttr; if (aName) - aName->SetValue(theName); + aName->SetValue(theName.toLatin1().data()); } - void SetValue (_PTR(SObject) theSObject, const char* theValue) + void SetValue (_PTR(SObject) theSObject, const QString& theValue) { _PTR(Study) aStudy = GetActiveStudyDocument(); if (aStudy->GetProperties()->IsLocked()) @@ -153,10 +149,10 @@ namespace SMESH{ aBuilder->FindOrCreateAttribute(theSObject, "AttributeComment"); _PTR(AttributeComment) aComment = anAttr; if (aComment) - aComment->SetValue(theValue); + aComment->SetValue(theValue.toLatin1().data()); } - void setFileName (_PTR(SObject) theSObject, const char* theValue) + void setFileName (_PTR(SObject) theSObject, const QString& theValue) { _PTR(Study) aStudy = GetActiveStudyDocument(); if (aStudy->GetProperties()->IsLocked()) @@ -166,10 +162,10 @@ namespace SMESH{ aBuilder->FindOrCreateAttribute(theSObject, "AttributeExternalFileDef"); _PTR(AttributeExternalFileDef) aFileName = anAttr; if (aFileName) - aFileName->SetValue(theValue); + aFileName->SetValue(theValue.toLatin1().data()); } - void setFileType (_PTR(SObject) theSObject, const char* theValue) + void setFileType (_PTR(SObject) theSObject, const QString& theValue) { _PTR(Study) aStudy = GetActiveStudyDocument(); if (aStudy->GetProperties()->IsLocked()) @@ -179,7 +175,7 @@ namespace SMESH{ aBuilder->FindOrCreateAttribute(theSObject, "AttributeFileType"); _PTR(AttributeFileType) aFileType = anAttr; if (aFileType) - aFileType->SetValue(theValue); + aFileType->SetValue(theValue.toLatin1().data()); } CORBA::Object_var SObjectToObject (_PTR(SObject) theSObject, @@ -216,11 +212,11 @@ namespace SMESH{ return CORBA::Object::_nil(); } - CORBA::Object_var IORToObject (const char* theIOR) + CORBA::Object_var IORToObject (const QString& theIOR) { SalomeApp_Application* app = dynamic_cast (SUIT_Session::session()->activeApplication()); - return app->orb()->string_to_object(theIOR); + return app->orb()->string_to_object(theIOR.toLatin1().data()); } int GetNameOfSelectedIObjects(LightApp_SelectionMgr* theMgr, QString& theName) @@ -277,7 +273,7 @@ namespace SMESH{ _PTR(SObject) aSObj = anIter->Value(); if (i >= 4) { _PTR(ChildIterator) anIter1 = aStudy->NewChildIterator(aSObj); - for (; anIter1->More(); anIter1->Next()) { + for ( ; anIter1->More(); anIter1->Next()) { _PTR(SObject) aSObj1 = anIter1->Value(); anAttr = aBuilder->FindOrCreateAttribute(aSObj1, "AttributePixMap"); aPixmap = anAttr; @@ -293,7 +289,7 @@ namespace SMESH{ } } - void ShowHelpFile (QString theHelpFileName) + void ShowHelpFile (const QString& theHelpFileName) { LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); if (app) { @@ -302,19 +298,11 @@ namespace SMESH{ theHelpFileName); } else { - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(theHelpFileName), - QObject::tr("BUT_OK")); - } + SUIT_MessageBox::warning(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + "application")). + arg(theHelpFileName)); + } } - -// void UpdateObjBrowser (bool) -// { -// //SMESHGUI::activeStudy()->updateObjBrowser(true); -// //SalomeApp_Application* anApp = dynamic_cast -// // (SUIT_Session::session()->activeApplication()); -// //if (anApp) anApp->objectBrowser()->updateTree(); -// SMESHGUI::GetSMESHGUI()->updateObjBrowser(); -// } -} +} // end of namespace SMESH diff --git a/src/SMESHGUI/SMESHGUI_Utils.h b/src/SMESHGUI/SMESHGUI_Utils.h index 690cd2633..d34944d03 100644 --- a/src/SMESHGUI/SMESHGUI_Utils.h +++ b/src/SMESHGUI/SMESHGUI_Utils.h @@ -1,34 +1,43 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// SMESH SMESHGUI : GUI for SMESH component // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_Utils.h +// Author : Open CASCADE S.A.S. +// -#ifndef SMESHGUI_Utils_HeaderFile -#define SMESHGUI_Utils_HeaderFile +#ifndef SMESHGUI_UTILS_H +#define SMESHGUI_UTILS_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" +// CORBA includes #include -#include "SALOMEDSClient_definitions.hxx" -#include "SALOME_InteractiveObject.hxx" -#include "LightApp_DataOwner.h" +// SALOME KERNEL includes +#include -class QString; +// SALOME GUI includes +#include +#include class SUIT_ViewWindow; class SUIT_Desktop; @@ -44,19 +53,19 @@ class SalomeApp_Study; class SalomeApp_Module; class LightApp_SelectionMgr; -namespace SMESH { - +namespace SMESH +{ SMESHGUI_EXPORT SUIT_Desktop* - GetDesktop(const CAM_Module* theModule); + GetDesktop( const CAM_Module* ); SMESHGUI_EXPORT LightApp_SelectionMgr* - GetSelectionMgr(const SalomeApp_Module* theModule); + GetSelectionMgr( const SalomeApp_Module* ); SMESHGUI_EXPORT SalomeApp_Study* - GetAppStudy(const CAM_Module* theModule); + GetAppStudy( const CAM_Module* ); SMESHGUI_EXPORT SUIT_ResourceMgr* @@ -64,13 +73,13 @@ SMESHGUI_EXPORT SMESHGUI_EXPORT _PTR(Study) - GetCStudy(const SalomeApp_Study* theStudy); + GetCStudy( const SalomeApp_Study* ); SMESHGUI_EXPORT - CORBA::Object_var DataOwnerToObject(const LightApp_DataOwnerPtr& theOwner); + CORBA::Object_var DataOwnerToObject( const LightApp_DataOwnerPtr& ); template typename TInterface::_var_type - DataOwnerToInterface(const LightApp_DataOwnerPtr& theDataOwner) + DataOwnerToInterface( const LightApp_DataOwnerPtr& theDataOwner ) { CORBA::Object_var anObj = DataOwnerToObject(theDataOwner); if(!CORBA::is_nil(anObj)) @@ -78,7 +87,6 @@ SMESHGUI_EXPORT return TInterface::_nil(); } - SMESHGUI_EXPORT SUIT_Study* GetActiveStudy(); @@ -89,25 +97,25 @@ SMESHGUI_EXPORT _PTR(Study) GetActiveStudyDocument(); SMESHGUI_EXPORT - _PTR(SObject) FindSObject(CORBA::Object_ptr theObject); + _PTR(SObject) FindSObject( CORBA::Object_ptr ); SMESHGUI_EXPORT - void SetName (_PTR(SObject) theSObject, const char* theName); + void SetName( _PTR(SObject), const QString& ); SMESHGUI_EXPORT - void SetValue (_PTR(SObject) theSObject, const char* theValue); - void setFileType (_PTR(SObject) theSObject, const char* theValue); - void setFileName (_PTR(SObject) theSObject, const char* theValue); + void SetValue( _PTR(SObject), const QString& ); + void setFileType( _PTR(SObject), const QString& ); + void setFileName( _PTR(SObject), const QString& ); SMESHGUI_EXPORT - CORBA::Object_var SObjectToObject (_PTR(SObject) theSObject, - _PTR(Study) theStudy); + CORBA::Object_var SObjectToObject( _PTR(SObject), + _PTR(Study) ); SMESHGUI_EXPORT - CORBA::Object_var SObjectToObject(_PTR(SObject) theSObject); + CORBA::Object_var SObjectToObject( _PTR(SObject) ); template typename TInterface::_var_type - SObjectToInterface(_PTR(SObject) theSObject) + SObjectToInterface( _PTR(SObject) theSObject ) { CORBA::Object_var anObj = SObjectToObject(theSObject); if(!CORBA::is_nil(anObj)) @@ -116,10 +124,10 @@ SMESHGUI_EXPORT } SMESHGUI_EXPORT - CORBA::Object_var IObjectToObject(const Handle(SALOME_InteractiveObject)& theIO); + CORBA::Object_var IObjectToObject( const Handle(SALOME_InteractiveObject)& ); template typename TInterface::_var_type - IObjectToInterface(const Handle(SALOME_InteractiveObject)& theIO) + IObjectToInterface( const Handle(SALOME_InteractiveObject)& theIO ) { CORBA::Object_var anObj = IObjectToObject(theIO); if(!CORBA::is_nil(anObj)) @@ -128,28 +136,28 @@ SMESHGUI_EXPORT } SMESHGUI_EXPORT - CORBA::Object_var IORToObject(const char* theIOR); + CORBA::Object_var IORToObject( const QString& ); template typename TInterface::_var_type - IORToInterface(const char* theIOR) + IORToInterface( const QString& theIOR ) { - CORBA::Object_var anObj = IORToObject(theIOR); - if(!CORBA::is_nil(anObj)) - return TInterface::_narrow(anObj); + CORBA::Object_var anObj = IORToObject( theIOR ); + if ( !CORBA::is_nil( anObj ) ) + return TInterface::_narrow( anObj ); return TInterface::_nil(); } SMESHGUI_EXPORT - int GetNameOfSelectedIObjects (LightApp_SelectionMgr*, QString& theName); + int GetNameOfSelectedIObjects( LightApp_SelectionMgr*, QString& ); SMESHGUI_EXPORT - _PTR(SObject) GetMeshOrSubmesh (_PTR(SObject) theSObject); + _PTR(SObject) GetMeshOrSubmesh( _PTR(SObject) ); SMESHGUI_EXPORT - void ModifiedMesh (_PTR(SObject) theSObject, bool theIsNot, bool isEmptyMesh=false); + void ModifiedMesh( _PTR(SObject), bool, bool = false ); SMESHGUI_EXPORT - void ShowHelpFile (QString theHelpFileName); + void ShowHelpFile( const QString& ); } -#endif +#endif // SMESHGUI_UTILS_H diff --git a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx index d8144f320..1a3f71f69 100644 --- a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx @@ -1,37 +1,46 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// SMESH SMESHGUI : GUI for SMESH component // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_VTKUtils.cxx +// Author : Open CASCADE S.A.S. // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com - +// SMESH includes #include "SMESHGUI_VTKUtils.h" + +#include "SMESHGUI.h" #include "SMESHGUI_Utils.h" #include "SMESHGUI_Filter.h" -#include "SMESHGUI.h" -#include "SMESH_Actor.h" -#include "SMESH_ActorUtils.h" -#include "SMESH_ObjectDef.h" +#include +#include +#include #include +// SALOME GUI includes #include #include -#include #include +#include +#include #include #include @@ -44,34 +53,26 @@ #include #include +// SALOME KERNEL includes #include +// IDL includes #include -#include CORBA_CLIENT_HEADER(SMESH_Gen) #include CORBA_CLIENT_HEADER(SMESH_Mesh) #include CORBA_CLIENT_HEADER(SMESH_Group) -#include CORBA_CLIENT_HEADER(SMESH_Hypothesis) - -#include -#include -// VTK +// VTK includes #include #include #include -// OCCT +// OCCT includes #include #include -// STL -#include -using namespace std; - - -namespace SMESH { - - typedef map TVisualObjCont; +namespace SMESH +{ + typedef std::map TVisualObjCont; static TVisualObjCont VISUAL_OBJ_CONT; //============================================================================= @@ -104,7 +105,7 @@ namespace SMESH { SUIT_ViewManager* aViewManager = app ? app->getViewManager(SVTK_Viewer::Type(), true) : 0; if ( aViewManager ) { - QPtrVector views = aViewManager->getViews(); + QVector views = aViewManager->getViews(); for ( int iV = 0; iV < views.count(); ++iV ) { if ( SMESH_Actor* actor = FindActorByEntry( views[iV], theEntry)) { if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(views[iV])) @@ -138,7 +139,7 @@ namespace SMESH { for ( int iM = 0; iM < viewMgrs.count(); ++iM ) { SUIT_ViewManager* aViewManager = viewMgrs.at( iM ); if ( aViewManager && aViewManager->getType() == SVTK_Viewer::Type()) { - QPtrVector views = aViewManager->getViews(); + QVector views = aViewManager->getViews(); for ( int iV = 0; iV < views.count(); ++iV ) { if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(views[iV])) { vtkRenderer *aRenderer = vtkWnd->getRenderer(); @@ -180,7 +181,7 @@ namespace SMESH { SUIT_ViewManager* aViewManager = viewMgrs.at( iM ); if ( aViewManager && aViewManager->getType() == SVTK_Viewer::Type() && aViewManager->study()->id() == studyID ) { - QPtrVector views = aViewManager->getViews(); + QVector views = aViewManager->getViews(); for ( int iV = 0; iV < views.count(); ++iV ) { if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(views[iV])) { vtkRenderer *aRenderer = vtkWnd->getRenderer(); @@ -225,9 +226,8 @@ namespace SMESH { // after or at showing this message, so we do an additional check of available memory // char* buf = new char[100*1024]; // delete [] buf; - SUIT_MessageBox::warn1 (SMESHGUI::desktop(), QObject::tr("SMESH_WRN_WARNING"), - QObject::tr("SMESH_VISU_PROBLEM"), - QObject::tr("SMESH_BUT_OK")); + SUIT_MessageBox::warning(SMESHGUI::desktop(), QObject::tr("SMESH_WRN_WARNING"), + QObject::tr("SMESH_VISU_PROBLEM")); } catch (...) { // no more memory at all: last resort cout<< "SMESHGUI_VTKUtils::OnVisuException(), exception even at showing a message!!!" < views = theMgr->getViews(); - if( views.containsRef( theWindow ) ) + QVector views = theMgr->getViews(); + if( views.contains( theWindow ) ) return GetVtkViewWindow( theWindow ); else return NULL; @@ -650,7 +648,7 @@ namespace SMESH { vtkActorCollection *aCollection = aRenderer->GetActors(); aCollection->InitTraversal(); while(vtkActor *anAct = aCollection->GetNextActor()) - if(SMESH_Actor *anActor = dynamic_cast(anAct)) + if(dynamic_cast(anAct)) return false; } return true; @@ -754,7 +752,7 @@ namespace SMESH { } }else{ SALOME_ListIteratorOfListIO anIter( selected ); - for(; anIter.More(); anIter.Next()){ + for( ; anIter.More(); anIter.Next()){ Handle(SALOME_InteractiveObject) anIO = anIter.Value(); if ( !Update(anIO,true) ) break; // avoid multiple warinings if visu failed @@ -796,7 +794,7 @@ namespace SMESH { return; } - QPtrVector views = vm->getViews(); + QVector views = vm->getViews(); SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( theModule ); if( !mgr ) @@ -885,7 +883,7 @@ namespace SMESH { void RemoveFilters(SVTK_Selector* theSelector) { - for ( int id = SMESHGUI_NodeFilter; theSelector && id < SMESHGUI_LastFilter; id++ ) + for ( int id = SMESH::NodeFilter; theSelector && id < SMESH::LastFilter; id++ ) theSelector->RemoveFilter( id ); } @@ -963,7 +961,7 @@ namespace SMESH { anIdContainer.insert(aMapIndex(i)); TIdContainer::const_iterator anIter = anIdContainer.begin(); - for(; anIter != anIdContainer.end(); anIter++) + for( ; anIter != anIdContainer.end(); anIter++) theName += QString(" %1").arg(*anIter); return aMapIndex.Extent(); @@ -1048,7 +1046,7 @@ namespace SMESH { for( int i = 1; i <= aMapIndex.Extent(); i++) anIdContainer.insert(aMapIndex(i)); TIdContainer::const_iterator anIter = anIdContainer.begin(); - for(; anIter != anIdContainer.end(); anIter++){ + for( ; anIter != anIdContainer.end(); anIter++){ theName += QString(" %1").arg(*anIter); } return aMapIndex.Extent(); @@ -1142,4 +1140,4 @@ namespace SMESH { } } -} +} // end of namespace SMESH diff --git a/src/SMESHGUI/SMESHGUI_VTKUtils.h b/src/SMESHGUI/SMESHGUI_VTKUtils.h index dc1ed57a9..96685910e 100644 --- a/src/SMESHGUI/SMESHGUI_VTKUtils.h +++ b/src/SMESHGUI/SMESHGUI_VTKUtils.h @@ -1,48 +1,48 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// SMESH SMESHGUI : GUI for SMESH component // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : SMESHGUI_VTKUtils.h +// Author : Open CASCADE S.A.S. // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -#ifndef SMESHGUI_VTKUtils_HeaderFile -#define SMESHGUI_VTKUtils_HeaderFile +#ifndef SMESHGUI_VTKUTILS_H +#define SMESHGUI_VTKUTILS_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include "SALOMEDSClient_definitions.hxx" -#include "SALOME_InteractiveObject.hxx" -#include "VTKViewer_Filter.h" - -#include "SMESH_Object.h" #include "SMESHGUI_Utils.h" +#include -#include - -#include "SALOMEconfig.h" -#include CORBA_CLIENT_HEADER(SALOMEDS) +// SALOME KERNEL includes +#include -#include - -class QString; +// SALOME GUI includes +#include +#include class TColStd_IndexedMapOfInteger; class SALOMEDSClient_Study; -class SUIT_Study; class SUIT_ViewWindow; class SUIT_ViewManager; @@ -56,25 +56,24 @@ class SMESHGUI; class SMESH_Actor; class SALOME_Actor; -namespace SMESH { - +namespace SMESH +{ //---------------------------------------------------------------------------- typedef pair TKeyOfVisualObj; SMESHGUI_EXPORT - TVisualObjPtr GetVisualObj(int theStudyId, - const char* theEntry); + TVisualObjPtr GetVisualObj( int, const char* ); SMESHGUI_EXPORT void OnVisuException(); // PAL16631 //---------------------------------------------------------------------------- SMESHGUI_EXPORT - SVTK_ViewWindow* GetViewWindow(const SalomeApp_Module* theModule = NULL, - bool createIfNotFound = false); + SVTK_ViewWindow* GetViewWindow( const SalomeApp_Module* = 0, + bool = false ); SMESHGUI_EXPORT - SVTK_ViewWindow* FindVtkViewWindow(SUIT_ViewManager*, SUIT_ViewWindow*); + SVTK_ViewWindow* FindVtkViewWindow( SUIT_ViewManager*, SUIT_ViewWindow* ); SMESHGUI_EXPORT - SVTK_ViewWindow* GetVtkViewWindow(SUIT_ViewWindow*); + SVTK_ViewWindow* GetVtkViewWindow( SUIT_ViewWindow* ); SMESHGUI_EXPORT SVTK_ViewWindow* GetCurrentVtkView(); @@ -83,121 +82,108 @@ SMESHGUI_EXPORT SMESHGUI_EXPORT void RepaintCurrentView(); SMESHGUI_EXPORT - void RepaintViewWindow(SVTK_ViewWindow*); + void RepaintViewWindow( SVTK_ViewWindow* ); SMESHGUI_EXPORT - void RenderViewWindow(SVTK_ViewWindow*); + void RenderViewWindow( SVTK_ViewWindow* ); SMESHGUI_EXPORT void FitAll(); //---------------------------------------------------------------------------- SMESHGUI_EXPORT - SMESH_Actor* FindActorByEntry (SUIT_ViewWindow*, const char* theEntry); + SMESH_Actor* FindActorByEntry( SUIT_ViewWindow*, const char* ); SMESHGUI_EXPORT - SMESH_Actor* FindActorByEntry (const char* theEntry); + SMESH_Actor* FindActorByEntry( const char* ); SMESHGUI_EXPORT - SMESH_Actor* FindActorByObject (CORBA::Object_ptr theObject); + SMESH_Actor* FindActorByObject( CORBA::Object_ptr ); //---------------------------------------------------------------------------- SMESHGUI_EXPORT - SMESH_Actor* CreateActor (_PTR(Study), const char*, int = false); + SMESH_Actor* CreateActor( _PTR(Study), const char*, int = false ); SMESHGUI_EXPORT - void DisplayActor (SUIT_ViewWindow*, SMESH_Actor* theActor); + void DisplayActor( SUIT_ViewWindow*, SMESH_Actor* ); SMESHGUI_EXPORT - void RemoveActor (SUIT_ViewWindow*, SMESH_Actor* theActor); + void RemoveActor( SUIT_ViewWindow*, SMESH_Actor* ); SMESHGUI_EXPORT - void RemoveVisuData(int studyID); + void RemoveVisuData( int ); //---------------------------------------------------------------------------- - enum EDisplaing {eDisplayAll, eDisplay, eDisplayOnly, eErase, eEraseAll}; + enum EDisplaing { eDisplayAll, eDisplay, eDisplayOnly, eErase, eEraseAll }; + SMESHGUI_EXPORT - bool UpdateView (SUIT_ViewWindow*, - EDisplaing theAction, - const char* theEntry = "" ); + bool UpdateView( SUIT_ViewWindow*, EDisplaing, const char* = "" ); SMESHGUI_EXPORT - bool UpdateView (EDisplaing theAction, - const char* theEntry = ""); + bool UpdateView( EDisplaing, const char* = "" ); SMESHGUI_EXPORT void UpdateView(); SMESHGUI_EXPORT - bool Update(const Handle(SALOME_InteractiveObject)& theIO, - bool theDisplay); - + bool Update( const Handle(SALOME_InteractiveObject)&, bool ); //---------------------------------------------------------------------------- SMESHGUI_EXPORT - void SetPointRepresentation(bool theIsVisible); + void SetPointRepresentation( bool ); SMESHGUI_EXPORT - void SetPickable(SMESH_Actor* theActor = NULL); + void SetPickable( SMESH_Actor* = 0 ); SMESHGUI_EXPORT void UpdateSelectionProp( SMESHGUI* ); - //---------------------------------------------------------------------------- SMESHGUI_EXPORT - SVTK_Selector* GetSelector (SUIT_ViewWindow* = GetActiveWindow()); + SVTK_Selector* GetSelector( SUIT_ViewWindow* = GetActiveWindow() ); SMESHGUI_EXPORT - void SetFilter (const Handle(VTKViewer_Filter)& theFilter, - SVTK_Selector* theSelector = GetSelector()); + void SetFilter( const Handle(VTKViewer_Filter)&, SVTK_Selector* = GetSelector() ); SMESHGUI_EXPORT - Handle(VTKViewer_Filter) GetFilter (int theId, SVTK_Selector* theSelector = GetSelector()); + Handle(VTKViewer_Filter) GetFilter( int, SVTK_Selector* = GetSelector() ); SMESHGUI_EXPORT - bool IsFilterPresent (int theId, SVTK_Selector* theSelector = GetSelector()); + bool IsFilterPresent( int, SVTK_Selector* = GetSelector() ); SMESHGUI_EXPORT - void RemoveFilter (int theId, SVTK_Selector* theSelector = GetSelector()); + void RemoveFilter( int, SVTK_Selector* = GetSelector() ); SMESHGUI_EXPORT - void RemoveFilters (SVTK_Selector* theSelector = GetSelector()); + void RemoveFilters( SVTK_Selector* = GetSelector()); SMESHGUI_EXPORT - bool IsValid (SALOME_Actor* theActor, int theCellId, - SVTK_Selector* theSelector = GetSelector()); + bool IsValid( SALOME_Actor*, int, SVTK_Selector* = GetSelector() ); //---------------------------------------------------------------------------- SMESHGUI_EXPORT - int GetNameOfSelectedNodes(SVTK_Selector* theSelector, - const Handle(SALOME_InteractiveObject)& theIO, - QString& theName); + int GetNameOfSelectedNodes( SVTK_Selector*, + const Handle(SALOME_InteractiveObject)&, + QString& ); SMESHGUI_EXPORT - int GetNameOfSelectedElements(SVTK_Selector* theSelector, - const Handle(SALOME_InteractiveObject)& theIO, - QString& theName); + int GetNameOfSelectedElements( SVTK_Selector*, + const Handle(SALOME_InteractiveObject)&, + QString& ); SMESHGUI_EXPORT - int GetEdgeNodes(SVTK_Selector* theSelector, - const TVisualObjPtr& theVisualObj, - int& theId1, - int& theId2); + int GetEdgeNodes( SVTK_Selector*, const TVisualObjPtr&, int&, int& ); //---------------------------------------------------------------------------- SMESHGUI_EXPORT - int GetNameOfSelectedNodes (LightApp_SelectionMgr*, - const Handle(SALOME_InteractiveObject)& theIO, - QString& theName); + int GetNameOfSelectedNodes( LightApp_SelectionMgr*, + const Handle(SALOME_InteractiveObject)&, + QString& ); SMESHGUI_EXPORT - int GetNameOfSelectedNodes (LightApp_SelectionMgr*, - QString& aName); + int GetNameOfSelectedNodes( LightApp_SelectionMgr*, QString& ); SMESHGUI_EXPORT - int GetNameOfSelectedElements (LightApp_SelectionMgr*, - const Handle(SALOME_InteractiveObject)& theIO, - QString& theName); + int GetNameOfSelectedElements( LightApp_SelectionMgr*, + const Handle(SALOME_InteractiveObject)&, + QString& ); SMESHGUI_EXPORT - int GetNameOfSelectedElements (LightApp_SelectionMgr*, - QString& aName); + int GetNameOfSelectedElements( LightApp_SelectionMgr*, QString& ); SMESHGUI_EXPORT - int GetSelected (LightApp_SelectionMgr*, - TColStd_IndexedMapOfInteger& theMap, - const bool theIsElement = true ); + int GetSelected( LightApp_SelectionMgr*, TColStd_IndexedMapOfInteger&, + const bool = true ); SMESHGUI_EXPORT - int GetEdgeNodes (LightApp_SelectionMgr*, int& theId1, int& theId2); + int GetEdgeNodes( LightApp_SelectionMgr*, int&, int& ); SMESHGUI_EXPORT - void SetControlsPrecision (const long theVal); + void SetControlsPrecision( const long ); }; -#endif +#endif // SMESHGUI_VTKUTILS_H diff --git a/src/SMESHGUI/SMESHGUI_WhatIsDlg.cxx b/src/SMESHGUI/SMESHGUI_WhatIsDlg.cxx index d7dd9579d..6db2934d3 100755 --- a/src/SMESHGUI/SMESHGUI_WhatIsDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_WhatIsDlg.cxx @@ -1,35 +1,32 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_WhatIsDlg.cxx +// Author : Vladimir TURIN, Open CASCADE S.A.S. // -// -// File : SMESHGUI_WhatIsDlg.cxx -// Author : Vladimir TURIN -// Module : SMESH -// $Header: +// SMESH includes #include "SMESHGUI_WhatIsDlg.h" #include "SMESHGUI.h" -#include "SMESHGUI_SpinBox.h" #include "SMESHGUI_Utils.h" #include "SMESHGUI_VTKUtils.h" #include "SMESHGUI_MeshUtils.h" @@ -41,161 +38,129 @@ #include "SMDS_Mesh.hxx" #include "SMDS_VolumeTool.hxx" -#include "SUIT_Desktop.h" -#include "SUIT_ResourceMgr.h" -#include "SUIT_Session.h" -#include "SUIT_MessageBox.h" - -#include "LightApp_Application.h" +// SALOME GUI includes +#include +#include +#include +#include -#include "SVTK_ViewModel.h" -#include "SVTK_Selection.h" -#include "SVTK_ViewWindow.h" -#include "SVTK_Selector.h" -#include "SALOME_ListIO.hxx" +#include +#include -#include "utilities.h" +#include +#include +#include +#include -// OCCT Includes +// OCCT includes #include -#include #include -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// IDL Headers -#include "SALOMEconfig.h" +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// IDL includes +#include #include CORBA_SERVER_HEADER(SMESH_Group) -#include CORBA_SERVER_HEADER(SMESH_MeshEditor) -using namespace std; +#define SPACING 6 +#define MARGIN 11 //================================================================================= // class : SMESHGUI_WhatIsDlg() // purpose : //================================================================================= -SMESHGUI_WhatIsDlg::SMESHGUI_WhatIsDlg( SMESHGUI* theModule, const char* name, - bool modal, WFlags fl) - : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | - WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose), +SMESHGUI_WhatIsDlg::SMESHGUI_WhatIsDlg( SMESHGUI* theModule ) + : QDialog( SMESH::GetDesktop( theModule ) ), mySMESHGUI( theModule ), mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) { - if (!name) - setName("SMESHGUI_WhatIsDlg"); - resize(300, 500); - setCaption(tr("SMESH_WHAT_IS_TITLE")); - setSizeGripEnabled(TRUE); - SMESHGUI_WhatIsDlgLayout = new QGridLayout(this); - SMESHGUI_WhatIsDlgLayout->setSpacing(6); - SMESHGUI_WhatIsDlgLayout->setMargin(11); + setModal( false ); + setAttribute( Qt::WA_DeleteOnClose, true ); + setWindowTitle(tr("SMESH_WHAT_IS_TITLE")); + setSizeGripEnabled(true); + QVBoxLayout* SMESHGUI_WhatIsDlgLayout = new QVBoxLayout(this); + SMESHGUI_WhatIsDlgLayout->setSpacing(SPACING); + SMESHGUI_WhatIsDlgLayout->setMargin(MARGIN); /***************************************************************/ - GroupMesh = new QButtonGroup(this, "GroupSelections"); - GroupMesh->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, GroupMesh->sizePolicy().hasHeightForWidth())); - GroupMesh->setTitle(tr("")); - GroupMesh->setColumnLayout(0, Qt::Vertical); - GroupMesh->layout()->setSpacing(0); - GroupMesh->layout()->setMargin(0); - GroupMeshLayout = new QGridLayout(GroupMesh->layout()); - GroupMeshLayout->setAlignment(Qt::AlignTop); - GroupMeshLayout->setSpacing(6); - GroupMeshLayout->setMargin(11); - MeshLabel = new QLabel(GroupMesh, "MeshLabel"); - MeshLabel->setText(tr("SMESH_NAME")); - GroupMeshLayout->addWidget(MeshLabel, 0, 0); - MeshName = new QLabel(GroupMesh, "MeshName"); - MeshName->setText(tr("")); - GroupMeshLayout->addWidget(MeshName, 0, 1); - SMESHGUI_WhatIsDlgLayout->addWidget(GroupMesh, 0, 0); + GroupMesh = new QGroupBox(this); + QHBoxLayout* GroupMeshLayout = new QHBoxLayout(GroupMesh); + GroupMeshLayout->setSpacing(SPACING); + GroupMeshLayout->setMargin(MARGIN); + + MeshLabel = new QLabel(tr("SMESH_NAME"), GroupMesh); + GroupMeshLayout->addWidget(MeshLabel); + MeshName = new QLineEdit(GroupMesh); + MeshName->setReadOnly(true); + GroupMeshLayout->addWidget(MeshName); /***************************************************************/ - GroupSelections = new QButtonGroup(this, "GroupSelections"); - GroupSelections->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, GroupSelections->sizePolicy().hasHeightForWidth())); - GroupSelections->setTitle(tr("ENTITY_TYPE" )); - GroupSelections->setExclusive(TRUE); - GroupSelections->setColumnLayout(0, Qt::Vertical); - GroupSelections->layout()->setSpacing(0); - GroupSelections->layout()->setMargin(0); - GroupSelectionsLayout = new QGridLayout(GroupSelections->layout()); - GroupSelectionsLayout->setAlignment(Qt::AlignTop); - GroupSelectionsLayout->setSpacing(6); - GroupSelectionsLayout->setMargin(11); - RadioButtonNodes = new QRadioButton(GroupSelections, "RadioButtonNodes"); - RadioButtonNodes->setText(tr("SMESH_NODES")); - GroupSelectionsLayout->addWidget(RadioButtonNodes, 0, 0); - RadioButtonElements = new QRadioButton(GroupSelections, "RadioButtonElements"); - RadioButtonElements->setText(tr("SMESH_ELEMENTS")); - GroupSelectionsLayout->addWidget(RadioButtonElements, 0, 1 ); - SMESHGUI_WhatIsDlgLayout->addWidget(GroupSelections, 1, 0); + GroupSelections = new QGroupBox(tr("ENTITY_TYPE"), this); + QButtonGroup* GroupSel = new QButtonGroup(this); + QHBoxLayout* GroupSelectionsLayout = new QHBoxLayout(GroupSelections); + GroupSelectionsLayout->setSpacing(SPACING); + GroupSelectionsLayout->setMargin(MARGIN); + + RadioButtonNodes = new QRadioButton(tr("SMESH_NODES"), GroupSelections); + GroupSelectionsLayout->addWidget(RadioButtonNodes); + GroupSel->addButton(RadioButtonNodes, 0); + RadioButtonElements = new QRadioButton(tr("SMESH_ELEMENTS"), GroupSelections); + GroupSelectionsLayout->addWidget(RadioButtonElements); + GroupSel->addButton(RadioButtonElements, 1); /***************************************************************/ - GroupArguments = new QGroupBox(this, "GroupArguments"); - GroupArguments->setTitle(tr("SMESH_INFORMATION")); - GroupArguments->setColumnLayout(0, Qt::Vertical); - GroupArguments->layout()->setSpacing(0); - GroupArguments->layout()->setMargin(0); - GroupArgumentsLayout = new QGridLayout(GroupArguments->layout()); - GroupArgumentsLayout->setAlignment(Qt::AlignTop); - GroupArgumentsLayout->setSpacing(6); - GroupArgumentsLayout->setMargin(11); + GroupArguments = new QGroupBox(tr("SMESH_INFORMATION"), this); + QGridLayout* GroupArgumentsLayout = new QGridLayout(GroupArguments); + GroupArgumentsLayout->setSpacing(SPACING); + GroupArgumentsLayout->setMargin(MARGIN); // Controls for elements selection - TextLabelElements = new QLabel(GroupArguments, "TextLabelElements"); - TextLabelElements->setText(tr("SMESH_ID_ELEMENTS" )); - TextLabelElements->setFixedWidth(74); + TextLabelElements = new QLabel(tr("SMESH_ID_ELEMENTS"), GroupArguments); GroupArgumentsLayout->addWidget(TextLabelElements, 0, 0); - LineEditElements = new QLineEdit(GroupArguments, "LineEditElements"); - LineEditElements->setValidator(new SMESHGUI_IdValidator(this, "validator")); - GroupArgumentsLayout->addMultiCellWidget(LineEditElements, 0, 0, 2, 7); + LineEditElements = new QLineEdit(GroupArguments); + LineEditElements->setValidator(new SMESHGUI_IdValidator(this)); + GroupArgumentsLayout->addWidget(LineEditElements, 0, 1); // information text browser - Info = new QTextBrowser(GroupArguments, "Info"); - Info->setHScrollBarMode(QScrollView::AlwaysOff); - Info->setVScrollBarMode(QScrollView::AlwaysOff); - GroupArgumentsLayout->addMultiCellWidget(Info, 1, 1, 0, 7); - - SMESHGUI_WhatIsDlgLayout->addWidget(GroupArguments, 2, 0); + Info = new QTextBrowser(GroupArguments); + Info->setMinimumSize(200, 150); + GroupArgumentsLayout->addWidget(Info, 1, 0, 1, 2); /***************************************************************/ - GroupButtons = new QGroupBox(this, "GroupButtons"); - GroupButtons->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth())); - GroupButtons->setTitle(tr("" )); - GroupButtons->setColumnLayout(0, Qt::Vertical); - GroupButtons->layout()->setSpacing(0); - GroupButtons->layout()->setMargin(0); - GroupButtonsLayout = new QGridLayout(GroupButtons->layout()); - GroupButtonsLayout->setAlignment(Qt::AlignTop); - GroupButtonsLayout->setSpacing(6); - GroupButtonsLayout->setMargin(11); - buttonHelp = new QPushButton(GroupButtons, "buttonHelp"); - buttonHelp->setText(tr("SMESH_BUT_HELP" )); - buttonHelp->setAutoDefault(TRUE); - GroupButtonsLayout->addWidget(buttonHelp, 0, 3); - QSpacerItem* spacer_9 = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - GroupButtonsLayout->addItem(spacer_9, 0, 1); - buttonOk = new QPushButton(GroupButtons, "buttonOk"); - buttonOk->setText(tr("SMESH_BUT_OK" )); - buttonOk->setAutoDefault(TRUE); - buttonOk->setDefault(TRUE); - GroupButtonsLayout->addWidget(buttonOk, 0, 0); - SMESHGUI_WhatIsDlgLayout->addWidget(GroupButtons, 3, 0); - - GroupArguments->show(); - RadioButtonNodes->setChecked(TRUE); + GroupButtons = new QGroupBox(this); + QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons); + GroupButtonsLayout->setSpacing(SPACING); + GroupButtonsLayout->setMargin(MARGIN); + + buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons); + buttonOk->setAutoDefault(true); + buttonOk->setDefault(true); + buttonHelp = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons); + buttonHelp->setAutoDefault(true); + + GroupButtonsLayout->addWidget(buttonOk); + GroupButtonsLayout->addSpacing(10); + GroupButtonsLayout->addStretch(); + GroupButtonsLayout->addWidget(buttonHelp); + + SMESHGUI_WhatIsDlgLayout->addWidget(GroupMesh); + SMESHGUI_WhatIsDlgLayout->addWidget(GroupSelections); + SMESHGUI_WhatIsDlgLayout->addWidget(GroupArguments); + SMESHGUI_WhatIsDlgLayout->addWidget(GroupButtons); + + RadioButtonNodes->setChecked(true); mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); @@ -205,7 +170,7 @@ SMESHGUI_WhatIsDlg::SMESHGUI_WhatIsDlg( SMESHGUI* theModule, const char* name, SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH); SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter (GROUP); - QPtrList aListOfFilters; + QList aListOfFilters; if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter); if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter); @@ -217,16 +182,15 @@ SMESHGUI_WhatIsDlg::SMESHGUI_WhatIsDlg( SMESHGUI* theModule, const char* name, Init(); /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); - connect(GroupSelections, SIGNAL(clicked(int)), SLOT(SelectionsClicked(int))); + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); + connect(GroupSel, SIGNAL(buttonClicked(int)), SLOT(SelectionsClicked(int))); - connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); - connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); + connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); /* to close dialog if study change */ - connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); + connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); connect(LineEditElements, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&))); - this->show(); /* displays Dialog */ SelectionsClicked(0); SelectionIntoArgument(); @@ -238,7 +202,6 @@ SMESHGUI_WhatIsDlg::SMESHGUI_WhatIsDlg( SMESHGUI* theModule, const char* name, //================================================================================= SMESHGUI_WhatIsDlg::~SMESHGUI_WhatIsDlg() { - // no need to delete child widgets, Qt does it all for us } //================================================================================= @@ -334,10 +297,11 @@ void SMESHGUI_WhatIsDlg::ClickOnHelp() if (app) app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); else { - SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), - QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). - arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(myHelpFileName), - QObject::tr("BUT_OK")); + SUIT_MessageBox::warning(this, tr("WRN_WARNING"), + tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", + "application")). + arg(myHelpFileName)); } } @@ -360,7 +324,7 @@ void SMESHGUI_WhatIsDlg::onTextChange (const QString& theNewText) TColStd_MapOfInteger newIndices; - QStringList aListId = QStringList::split(" ", theNewText, false); + QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts); for (int i = 0; i < aListId.count(); i++) { const SMDS_MeshElement * e = RadioButtonNodes->isChecked()? @@ -449,7 +413,7 @@ void SMESHGUI_WhatIsDlg::SelectionIntoArgument() anInfo=tr("ENTITY_TYPE") + ": "; if(e->GetType() == SMDSAbs_Node) { anInfo+=tr("MESH_NODE")+"\n"; - const SMDS_MeshNode *en = (SMDS_MeshNode*) e; + //const SMDS_MeshNode *en = (SMDS_MeshNode*) e; // VSR: not used! } else if(e->GetType() == SMDSAbs_Edge) { anInfo+=tr("SMESH_EDGE")+"\n"; anInfo+=tr("SMESH_MESHINFO_TYPE")+": "; @@ -525,11 +489,11 @@ void SMESHGUI_WhatIsDlg::SelectionIntoArgument() gp_XYZ anXYZ(0.,0.,0.); SMDS_ElemIteratorPtr nodeIt = e->nodesIterator(); int nbNodes = 0; - for(; nodeIt->more(); nbNodes++) { + for( ; nodeIt->more(); nbNodes++) { const SMDS_MeshNode* node = static_cast( nodeIt->next() ); anXYZ.Add( gp_XYZ( node->X(), node->Y(), node->Z() ) ); } - anXYZ.Divide(e->NbNodes()) ; + anXYZ.Divide(e->NbNodes()); anInfo+=QString("X=%1\nY=%2\nZ=%3\n").arg(anXYZ.X()).arg(anXYZ.Y()).arg(anXYZ.Z()); Info->setText(anInfo); } @@ -572,7 +536,7 @@ void SMESHGUI_WhatIsDlg::ActivateThisDialog() mySMESHGUI->SetActiveDialogBox((QDialog*)this); - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + if ( SMESH::GetViewWindow( mySMESHGUI )) SelectionsClicked(RadioButtonNodes->isChecked()?0:1); SelectionIntoArgument(); @@ -595,7 +559,7 @@ void SMESHGUI_WhatIsDlg::enterEvent (QEvent*) void SMESHGUI_WhatIsDlg::closeEvent (QCloseEvent*) { /* same than click on cancel button */ - this->ClickOnCancel(); + ClickOnCancel(); } //======================================================================= @@ -618,9 +582,8 @@ void SMESHGUI_WhatIsDlg::keyPressEvent( QKeyEvent* e ) if ( e->isAccepted() ) return; - if ( e->key() == Key_F1 ) - { - e->accept(); - ClickOnHelp(); - } + if ( e->key() == Qt::Key_F1 ) { + e->accept(); + ClickOnHelp(); + } } diff --git a/src/SMESHGUI/SMESHGUI_WhatIsDlg.h b/src/SMESHGUI/SMESHGUI_WhatIsDlg.h index af1c4ef3d..d79e7fda7 100755 --- a/src/SMESHGUI/SMESHGUI_WhatIsDlg.h +++ b/src/SMESHGUI/SMESHGUI_WhatIsDlg.h @@ -1,60 +1,49 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESHGUI : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_WhatIsDlg.h +// Author : Vladimir TURIN, Open CASCADE S.A.S. // -// File : SMESHGUI_WhatIsDlg.h -// Author : Vladimir TURIN -// Module : SMESH -// $Header: #ifndef SMESHGUI_WHATISDLG_H #define SMESHGUI_WHATISDLG_H -#include "LightApp_SelectionMgr.h" +// Qt includes +#include -#include "SMESH_LogicalFilter.hxx" - -// QT Includes -#include +// IDL includes +#include +#include CORBA_SERVER_HEADER(SMESH_Mesh) -class QGridLayout; -class QButtonGroup; class QGroupBox; class QLabel; class QLineEdit; class QPushButton; class QRadioButton; -class QCheckBox; class QTextBrowser; class SMESHGUI; -class SMESHGUI_SpinBox; class SMESH_Actor; -class SVTK_ViewWindow; class SVTK_Selector; - -// IDL Headers -#include -#include CORBA_SERVER_HEADER(SMESH_Mesh) - +class LightApp_SelectionMgr; +class SMESH_LogicalFilter; //================================================================================= // class : SMESHGUI_WhatIsDlg @@ -63,22 +52,17 @@ class SVTK_Selector; class SMESHGUI_WhatIsDlg : public QDialog { Q_OBJECT - + public: - - SMESHGUI_WhatIsDlg( SMESHGUI*, - const char* name = 0, - bool modal = FALSE, - WFlags fl = 0); + SMESHGUI_WhatIsDlg( SMESHGUI* ); ~SMESHGUI_WhatIsDlg(); private: - - void Init (bool ResetControls = true); - void closeEvent (QCloseEvent*); - void enterEvent (QEvent*); /* mouse enter the QWidget */ - void hideEvent (QHideEvent*); /* ESC key */ - void keyPressEvent(QKeyEvent*); + void Init( bool = true ); + void closeEvent( QCloseEvent* ); + void enterEvent( QEvent* ); /* mouse enter the QWidget */ + void hideEvent( QHideEvent* ); /* ESC key */ + void keyPressEvent( QKeyEvent* ); SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */ LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ @@ -90,41 +74,32 @@ private: SMESH_Actor* myActor; SMESH_LogicalFilter* myMeshOrSubMeshOrGroupFilter; - QButtonGroup* GroupSelections; - QRadioButton* RadioButtonNodes; - QRadioButton* RadioButtonElements; - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonHelp; - QGroupBox* GroupArguments; - QGroupBox* GroupMesh; - QLabel* TextLabelElements; - QLineEdit* LineEditElements; - QLabel* MeshLabel; - QLabel* MeshName; - - QTextBrowser* Info; + QGroupBox* GroupSelections; + QRadioButton* RadioButtonNodes; + QRadioButton* RadioButtonElements; + QGroupBox* GroupButtons; + QPushButton* buttonOk; + QPushButton* buttonHelp; + QGroupBox* GroupArguments; + QGroupBox* GroupMesh; + QLabel* TextLabelElements; + QLineEdit* LineEditElements; + QLabel* MeshLabel; + QLineEdit* MeshName; + + QTextBrowser* Info; - QString myHelpFileName; + QString myHelpFileName; private slots: - - void SelectionsClicked(int selectionId); - void ClickOnOk(); - void ClickOnCancel(); - void ClickOnHelp(); - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void onTextChange(const QString&); - -protected: - - QGridLayout* SMESHGUI_WhatIsDlgLayout; - QGridLayout* GroupSelectionsLayout; - QGridLayout* GroupMeshLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupArgumentsLayout; + void SelectionsClicked( int ); + void ClickOnOk(); + void ClickOnCancel(); + void ClickOnHelp(); + void SelectionIntoArgument(); + void DeactivateActiveDialog(); + void ActivateThisDialog(); + void onTextChange( const QString& ); }; #endif // SMESHGUI_WHATISDLG_H diff --git a/src/SMESHGUI/SMESHGUI_XmlHandler.cxx b/src/SMESHGUI/SMESHGUI_XmlHandler.cxx index 2fa20059d..a0859ceef 100644 --- a/src/SMESHGUI/SMESHGUI_XmlHandler.cxx +++ b/src/SMESHGUI/SMESHGUI_XmlHandler.cxx @@ -1,47 +1,38 @@ -// SMESH SMESHGUI : reading of xml file with list of available hypotheses and algorithms -// Copyright (C) 2003 CEA +// SMESH SMESHGUI : reading of xml file with list of available hypotheses and algorithms // -// This library is free software; you can redistribute it and/or -// // modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// Copyright (C) 2003 CEA // - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_XmlHandler.cxx +// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. // -// File : SMESHGUI_XmlHandler.cxx -// Author : Julia DOROVSKIKH -// Module : SMESH -// $Header$ -#define INCLUDE_MENUITEM_DEF - -// QT Include -#include -#include +// SMESH includes +#include "SMESHGUI_XmlHandler.h" #include "SMESHGUI.h" -#include "SUIT_ResourceMgr.h" -#include "SUIT_Desktop.h" - -#include "SMESHGUI_XmlHandler.h" #include "SMESHGUI_Hypotheses.h" -#include "SMESHGUI_Utils.h" -#include "utilities.h" +// SALOME GUI includes +#include "SUIT_ResourceMgr.h" -using namespace std; +// SALOME KERNEL includes +#include /*! Constructor @@ -65,7 +56,7 @@ SMESHGUI_XmlHandler::~SMESHGUI_XmlHandler() bool SMESHGUI_XmlHandler::startDocument() { myErrorProt = ""; - return TRUE; + return true; } /*! @@ -109,7 +100,7 @@ bool SMESHGUI_XmlHandler::startElement (const QString&, const QString&, QString aResName = atts.value("resources"); if (aResName != "") { - MESSAGE("Loading Resources " << aResName); + MESSAGE("Loading Resources " << aResName.toLatin1().data()); SUIT_ResourceMgr* resMgr = SMESHGUI::resourceMgr(); resMgr->loadTranslator("resources",aResName+"_msg_en.qm"); resMgr->loadTranslator("resources",aResName+"_images.qm"); @@ -137,10 +128,10 @@ bool SMESHGUI_XmlHandler::startElement (const QString&, const QString&, QString aDimStr = atts.value("dim"); aDimStr = aDimStr.remove( ' ' ); - QStringList aDimList = QStringList::split( ',', aDimStr ); + QStringList aDimList = aDimStr.split( ',', QString::SkipEmptyParts ); QStringList::iterator anIter; bool isOk; - QValueList aDim; + QList aDim; for ( anIter = aDimList.begin(); anIter != aDimList.end(); ++anIter ) { int aVal = (*anIter).toInt( &isOk ); @@ -156,7 +147,7 @@ bool SMESHGUI_XmlHandler::startElement (const QString&, const QString&, QString aStr = atts.value( name[i] ); if ( !aStr.isEmpty() ) { aStr.remove( ' ' ); - attr[ i ] = QStringList::split( ',', aStr ); + attr[ i ] = aStr.split( ',', QString::SkipEmptyParts ); } } @@ -167,11 +158,11 @@ bool SMESHGUI_XmlHandler::startElement (const QString&, const QString&, if (qName == "algorithm") { - myAlgorithmsMap[(char*)aHypAlType.latin1()] = aHypData; + myAlgorithmsMap[aHypAlType.toLatin1().data()] = aHypData; } else { - myHypothesesMap[(char*)aHypAlType.latin1()] = aHypData; + myHypothesesMap[aHypAlType.toLatin1().data()] = aHypData; } } } @@ -190,16 +181,16 @@ bool SMESHGUI_XmlHandler::startElement (const QString&, const QString&, QString aHypos = isHypo ? atts.value("hypos") : atts.value("algos"); aHypos = aHypos.remove( ' ' ); QStringList* aHypoList = isHypo ? & aHypoSet->HypoList : & aHypoSet->AlgoList; - *aHypoList = QStringList::split( ',', aHypos ); + *aHypoList = aHypos.split( ',', QString::SkipEmptyParts ); } } } else { // error - return FALSE; + return false; } - return TRUE; + return true; } @@ -208,7 +199,7 @@ bool SMESHGUI_XmlHandler::startElement (const QString&, const QString&, */ bool SMESHGUI_XmlHandler::endElement (const QString&, const QString&, const QString&) { - return TRUE; + return true; } @@ -218,10 +209,10 @@ bool SMESHGUI_XmlHandler::endElement (const QString&, const QString&, const QStr bool SMESHGUI_XmlHandler::characters (const QString& ch) { // we are not interested in whitespaces - QString ch_simplified = ch.simplifyWhiteSpace(); + QString ch_simplified = ch.simplified(); if ( ch_simplified.isEmpty() ) - return TRUE; - return TRUE; + return true; + return true; } diff --git a/src/SMESHGUI/SMESHGUI_XmlHandler.h b/src/SMESHGUI/SMESHGUI_XmlHandler.h index b71f59e58..f3582ed29 100644 --- a/src/SMESHGUI/SMESHGUI_XmlHandler.h +++ b/src/SMESHGUI/SMESHGUI_XmlHandler.h @@ -1,69 +1,71 @@ -// SMESH SMESHGUI : reading of xml file with list of available hypotheses and algorithms +// SMESH SMESHGUI : reading of xml file with list of available hypotheses and algorithms // -// Copyright (C) 2003 CEA +// Copyright (C) 2003 CEA // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : SMESHGUI_XmlHandler.h +// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. // -// File : SMESHGUI_XmlHandler.cxx -// Author : Julia DOROVSKIKH -// Module : SMESH -// $Header$ -#ifndef SMESHGUI_XmlHandler_HeaderFile -#define SMESHGUI_XmlHandler_HeaderFile +#ifndef SMESHGUI_XMLHANDLER_H +#define SMESHGUI_XMLHANDLER_H +// SMESH includes #include "SMESH_SMESHGUI.hxx" -#include "SMESHGUI_Hypotheses.h" +// Qt includes +#include -#include +// STL includes +#include #include #include +class HypothesisData; +class HypothesesSet; + class SMESHGUI_EXPORT SMESHGUI_XmlHandler : public QXmlDefaultHandler { - public: +public: SMESHGUI_XmlHandler(); virtual ~SMESHGUI_XmlHandler(); - bool startDocument(); - bool startElement( const QString& namespaceURI, const QString& localName, - const QString& qName, const QXmlAttributes& atts ); - bool endElement( const QString& namespaceURI, const QString& localName, const QString& qName ); - bool characters( const QString& ch ); + bool startDocument(); + bool startElement( const QString&, const QString&, + const QString&, const QXmlAttributes& ); + bool endElement( const QString&, const QString&, const QString& ); + bool characters( const QString& ); - QString errorString(); - QString errorProtocol(); - bool fatalError (const QXmlParseException& exception); + QString errorString(); + QString errorProtocol(); + bool fatalError( const QXmlParseException& ); - public: +public: std::map myHypothesesMap; std::map myAlgorithmsMap; - std::list myListOfHypothesesSets; + std::list myListOfHypothesesSets; - private: - QString myErrorProt; - QString myPluginName; - QString myServerLib; - QString myClientLib; +private: + QString myErrorProt; + QString myPluginName; + QString myServerLib; + QString myClientLib; }; - -#endif +#endif // SMESHGUI_XMLHANDLER_H diff --git a/src/SMESHGUI/SMESHGUI_aParameter.h b/src/SMESHGUI/SMESHGUI_aParameter.h deleted file mode 100644 index 5bb79a04a..000000000 --- a/src/SMESHGUI/SMESHGUI_aParameter.h +++ /dev/null @@ -1,470 +0,0 @@ -// SMESH SMESHGUI : GUI for SMESH component -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// -// -// -// File : SMESHGUI_aParameter.h -// Module : SMESH -// $Header$ - -#ifndef SMESHGUI_aParameter_H -#define SMESHGUI_aParameter_H - -#include -#include -#include -#include - -#include -#include CORBA_SERVER_HEADER(SMESH_Mesh) - -class QWidget; -class SMESHGUI_aParameter; - -typedef boost::shared_ptr SMESHGUI_aParameterPtr; - -/*! - * \brief This class is the base class of all parameters - */ -class SMESHGUI_aParameter -{ -public: - typedef bool (*VALIDATION_FUNC)( SMESHGUI_aParameter* ); - - SMESHGUI_aParameter(const QString& label, const bool = false ); - virtual ~SMESHGUI_aParameter(); - - enum Type { INT, DOUBLE, STRING, ENUM, BOOL, TABLE }; - virtual Type GetType() const = 0; - virtual bool GetNewInt( int & Value ) const = 0; - virtual bool GetNewDouble( double & Value ) const = 0; - virtual bool GetNewText( QString & Value ) const = 0; - virtual void TakeValue( QWidget* ) = 0; - virtual QWidget* CreateWidget( QWidget* ) const = 0; - virtual void InitializeWidget( QWidget* ) const = 0; - - bool needPreview() const; - - /*! - * \brief Returns string representation of signal emitted when value in corrsponding widget is changed - */ - virtual QString sigValueChanged() const; - - QString & Label(); - -protected: - QString _label; - bool _needPreview; -}; - -/*! - * \brief This class provides parameter with integer value - */ -class SMESHGUI_intParameter: public SMESHGUI_aParameter -{ -public: - SMESHGUI_intParameter(const int initValue = 0, - const QString& label = QString::null, - const int bottom = 0, - const int top = 1000, - const bool = false ); - int & InitValue() { return _initValue; } - int & Top() { return _top; } - int & Bottom() { return _bottom; } - virtual Type GetType() const; - virtual bool GetNewInt( int & Value ) const; - virtual bool GetNewDouble( double & Value ) const; - virtual bool GetNewText( QString & Value ) const; - virtual void TakeValue( QWidget* ); - virtual QWidget* CreateWidget( QWidget* ) const; - virtual void InitializeWidget( QWidget* ) const; - - virtual QString sigValueChanged() const; - -protected: - int _top, _bottom; - int _initValue, _newValue; -}; - -/*! - * \brief This class provides parameter with double value - */ -class SMESHGUI_doubleParameter: public SMESHGUI_aParameter -{ -public: - SMESHGUI_doubleParameter(const double initValue = 0.0, - const QString& label = QString::null, - const double bottom = -1E6, - const double top = +1E6, - const double step = 1.0, - const int decimals = 3, - const bool = false); - double & InitValue() { return _initValue; } - double & Top() { return _top; } - double & Bottom() { return _bottom; } - double & Step() { return _step; } - int & Decimals() { return _decimals; } - virtual Type GetType() const; - virtual bool GetNewInt( int & Value ) const; - virtual bool GetNewDouble( double & Value ) const; - virtual bool GetNewText( QString & Value ) const; - virtual QWidget* CreateWidget( QWidget* ) const; - virtual void InitializeWidget( QWidget* ) const; - virtual void TakeValue( QWidget* ); - - virtual QString sigValueChanged() const; - -protected: - double _top, _bottom, _step; - double _initValue, _newValue; - int _decimals; -}; - -/*! - * \brief This class provides parameter with string value - */ -class SMESHGUI_strParameter: public SMESHGUI_aParameter -{ -public: - SMESHGUI_strParameter( const QString& initValue = "", - const QString& label = QString::null, - const bool = false ); - QString& InitValue() { return _initValue; } - virtual Type GetType() const; - virtual bool GetNewInt( int & Value ) const; - virtual bool GetNewDouble( double & Value ) const; - virtual bool GetNewText( QString & Value ) const; - virtual QWidget* CreateWidget( QWidget* ) const; - virtual void InitializeWidget( QWidget* ) const; - virtual void TakeValue( QWidget* ); - - virtual QString sigValueChanged() const; - -protected: - QString _initValue, _newValue; -}; - - -/*! - * \brief This class represents the base parameter which contains dependency of - * shown state of other parameters on value of current - */ -class SMESHGUI_dependParameter: public SMESHGUI_aParameter -{ -public: - /*! - * \brief This map describes what parameters must be shown when this parameter has value as key - * The list contains some indices of parameters (for example, order in some list) - * Value is integer based 0. If map is empty, it means that there is no dependencies. - */ - typedef QValueList< int > IntList; - typedef QMap< int, IntList > ShownMap; - -public: - SMESHGUI_dependParameter( const QString& = QString::null, const bool = false ); - - const ShownMap& shownMap() const; - ShownMap& shownMap(); - -private: - ShownMap myShownMap; -}; - -/*! - * \brief This class represents parameter which can have value from fixed set - */ -class SMESHGUI_enumParameter: public SMESHGUI_dependParameter -{ -public: - /*! - * \brief Creates parameter with set of values 'values', default value 'init' and title 'label' - * Every value can be described both by integer based 0 or by string value - */ - SMESHGUI_enumParameter( const QStringList& values, - const int init = 0, - const QString& label = QString::null, - const bool = false ); - virtual ~SMESHGUI_enumParameter(); - - /*! - * \brief Returns count of possible values - */ - int Count() const; - - int& InitValue() { return myInitValue; } - virtual Type GetType() const; - virtual bool GetNewInt( int& ) const; - virtual bool GetNewDouble( double& ) const; - virtual bool GetNewText( QString& ) const; - virtual QWidget* CreateWidget( QWidget* ) const; - virtual void InitializeWidget( QWidget* ) const; - virtual void TakeValue( QWidget* ); - - virtual QString sigValueChanged() const; - -protected: - int myInitValue, myValue; - QStringList myValues; -}; - - -/*! - * \brief This class represents parameter which can have value true or false - */ -class SMESHGUI_boolParameter: public SMESHGUI_dependParameter -{ -public: - SMESHGUI_boolParameter( const bool = false, - const QString& = QString::null, - const bool = false ); - virtual ~SMESHGUI_boolParameter(); - - bool& InitValue() { return myInitValue; } - virtual Type GetType() const; - virtual bool GetNewInt( int& ) const; - virtual bool GetNewDouble( double& ) const; - virtual bool GetNewText( QString& ) const; - virtual QWidget* CreateWidget( QWidget* ) const; - virtual void InitializeWidget( QWidget* ) const; - virtual void TakeValue( QWidget* ); - - virtual QString sigValueChanged() const; - -protected: - bool myInitValue, myValue; -}; - - -class QButton; -class SMESHGUI_tableParameter; - - -/*! - * \brief This class represents custom table. It has only double values and - editor for every cell has validator - */ -class SMESHGUI_Table : public QTable -{ - Q_OBJECT - -public: - SMESHGUI_Table( const SMESHGUI_tableParameter*, int numRows, int numCols, QWidget* = 0, const char* = 0 ); - virtual ~SMESHGUI_Table(); - -/*! - * \brief Hides current editor of cell - */ - void stopEditing(); - - virtual QSize sizeHint() const; - -/*! - * \brief Returns parameters of double validator corresponding to cell (row,col) - */ - void validator( const int row, const int col, double&, double&, int& ); - -/*! - * \brief Sets the double validator parameters to every cell in row range [rmin,rmax] - * and column range [cmin,cmax]. - * If rmin=-1 then rmin is set to 0, if rmax=-1 then rmax = last row. - * Analogically cmin and cmax are set - */ - void setValidator( const double, const double, const int, - const int rmin = -1, const int rmax = -1, - const int cmin = -1, const int cmax = -1 ); - -protected: - virtual void keyPressEvent( QKeyEvent* ); - virtual bool eventFilter( QObject*, QEvent* ); - virtual QWidget* createEditor( int, int, bool ) const; - -private: - SMESHGUI_tableParameter* myParam; -}; - - -/*! - * \brief This class represents frame for table and buttons - */ -class SMESHGUI_TableFrame : public QFrame -{ - Q_OBJECT - -public: -/*! - * \brief Values corresponding to buttons for table resize - */ - typedef enum { ADD_COLUMN, REMOVE_COLUMN, ADD_ROW, REMOVE_ROW } Button; - -public: - SMESHGUI_TableFrame( const SMESHGUI_tableParameter*, QWidget* ); - ~SMESHGUI_TableFrame(); - - SMESHGUI_Table* table() const; - -/*! - * \brief Changes shown state of some button for table resize - */ - void setShown( const Button, const bool ); - -/*! - * \brief Returns shown state of some button for table resize - */ - bool isShown( const Button ) const; - -private: - QButton* button( const Button ) const; - -private slots: - void onButtonClicked(); - -signals: -/*! - * \brief This signal is emitted if some of button for table resize is clicked - * Second parameter is current column for ADD_COLUMN, REMOVE_COLUMN buttons - * and current row for ADD_ROW, REMOVE_ROW buttons. Take into account that - * this object resize table ( returned by table() ) automatically - */ - void toEdit( SMESHGUI_TableFrame::Button, int ); - void valueChanged( int, int ); - -private: - QButton *myAddColumn, *myRemoveColumn, *myAddRow, *myRemoveRow; - SMESHGUI_Table* myTable; -}; - - -/*! - * \brief This class represents parameter which can have two-dimensional array of values - */ -class SMESHGUI_tableParameter: public QObject, public SMESHGUI_aParameter -{ - Q_OBJECT - -public: -/*! - * \brief Creates table parameter with default value 'init' and title 'label'. - * The default value means that by default the table is filled with default value - * and if new column or row is added then it is filled with default value - */ - SMESHGUI_tableParameter( const double init = 0.0, - const QString& label = QString::null, - const bool preview = false ); - virtual ~SMESHGUI_tableParameter(); - - virtual Type GetType() const; - virtual bool GetNewInt( int& ) const; - virtual bool GetNewDouble( double& ) const; - virtual bool GetNewText( QString& ) const; - virtual QWidget* CreateWidget( QWidget* ) const; - virtual void InitializeWidget( QWidget* ) const; - virtual void TakeValue( QWidget* ); - - static void sortData( SMESH::double_array& ); - -/*! - * \brief Updates look of widget in accordance with all parameters of this object - */ - void update( QWidget* ) const; - -/*! - * \brief Returns data taken from widget. Please don't forget to call TakeValue before. - */ - void data( SMESH::double_array& ) const; - -/*! - * \brief Sets data. The InitializeWidget must be called in order to change values in widget - */ - void setData( const SMESH::double_array& ); - -/*! - * \brief Sets count of columns and updates widget - */ - void setColCount( const int, QWidget* = 0 ); - -/*! - * \brief Sets count of rows and updates widget - */ - void setRowCount( const int, QWidget* = 0 ); - -/*! - * \brief Binds count of columns to some parameter and updates widget. Take into account that - * if this parameter is changed, the update() must be called to resize table - */ - void setColCount( const SMESHGUI_aParameterPtr, QWidget* = 0 ); - -/*! - * \brief Binds count of rows to some parameter and updates widget. Take into account that - * if this parameter is changed, the update() must be called to resize table - */ - void setRowCount( const SMESHGUI_aParameterPtr, QWidget* = 0 ); - -/*! - * \brief Enables or disables to change count of columns by buttons - */ - void setEditCols( const bool ); - -/*! - * \brief Enables or disables to change count of rows by buttons - */ - void setEditRows( const bool ); - - virtual QString sigValueChanged() const; - - void setValidator( const int col, const double, const double, const int ); - void validator( const int col, double&, double&, int& ) const; - -/*! - * \brief These methods allow to read and change name of column - */ - void setColName( const int, const QString& ); - QString colName( const int ) const; - -private slots: - void onEdit( SMESHGUI_TableFrame::Button, int ); - void onEdit( SMESHGUI_Table*, SMESHGUI_TableFrame::Button, int ); - -private: - void setItems( QWidget*, int = -1, int = -1, int = -1, int = -1 ) const; - -private: - typedef struct - { - double myMin, myMax; - int myDecimals; - } ValidatorInfo; - - typedef QMap ValidatorsMap; - -private: - int myColsInt, myRowsInt; - SMESHGUI_aParameterPtr myCols, myRows; - double myInitValue; - SMESH::double_array myData; - ValidatorsMap myValidators; - bool myEditCols, myEditRows; - QMap< int, QString > myColNames; - - friend class SMESHGUI_Table; -}; - -#endif // SMESHGUI_aParameter.h - diff --git a/src/SMESHGUI/SMESH_SMESHGUI.hxx b/src/SMESHGUI/SMESH_SMESHGUI.hxx index 29a4e6e95..94800066f 100755 --- a/src/SMESHGUI/SMESH_SMESHGUI.hxx +++ b/src/SMESHGUI/SMESH_SMESHGUI.hxx @@ -1,30 +1,28 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// File : SMESH_SMESHGUI.hxx +// Author : Alexander BORODIN, Open CASCADE S.A.S. // -// File : SMESH_SMESHGUI.hxx -// Author : Alexander A. BORODIN -// Module : SMESH -#ifndef _SMESH_SMESHGUI_HXX_ -#define _SMESH_SMESHGUI_HXX_ +#ifndef SMESH_SMESHGUI_HXX +#define SMESH_SMESHGUI_HXX #ifdef WNT #if defined SMESHGUI_EXPORTS @@ -36,4 +34,4 @@ #define SMESHGUI_EXPORT #endif -#endif +#endif // SMESH_SMESHGUI_HXX diff --git a/src/SMESHGUI/SMESH_icons.ts b/src/SMESHGUI/SMESH_icons.ts new file mode 100644 index 000000000..4a79f605b --- /dev/null +++ b/src/SMESHGUI/SMESH_icons.ts @@ -0,0 +1,222 @@ + + + + @default + + ICON_APPEND + mesh_add.png + + + ICON_CONSTRUCT_GROUP + mesh_make_group.png + + + ICON_DLG_ADD_ALGORITHM + mesh_set_algo.png + + + ICON_DLG_ADD_HYPOTHESIS + mesh_set_hypo.png + + + ICON_DLG_ADD_SUBMESH + mesh_add_sub.png + + + ICON_DLG_CONNECTIVITY + mesh_connectivity.png + + + ICON_DLG_EDGE + mesh_line.png + + + ICON_DLG_EDIT_MESH + mesh_edit.png + + + ICON_DLG_HEXAS + mesh_hexa.png + + + ICON_DLG_INIT_MESH + mesh_init.png + + + ICON_DLG_MESH_DIAGONAL + mesh_diagonal.png + + + ICON_DLG_MESH_ORIENTATION + mesh_orientation.png + + + ICON_DLG_MESH_ROTATION + mesh_rotation.png + + + ICON_DLG_MOVE_NODE + mesh_move_node.png + + + ICON_DLG_NODE + mesh_vertex.png + + + ICON_DLG_QUADRANGLE + mesh_quad.png + + + ICON_DLG_QUADRATIC_EDGE + mesh_quad_edge.png + + + ICON_DLG_QUADRATIC_HEXAHEDRON + mesh_quad_hexahedron.png + + + ICON_DLG_QUADRATIC_PENTAHEDRON + mesh_quad_pentahedron.png + + + ICON_DLG_QUADRATIC_PYRAMID + mesh_quad_pyramid.png + + + ICON_DLG_QUADRATIC_QUADRANGLE + mesh_quad_quadrangle.png + + + ICON_DLG_QUADRATIC_TETRAHEDRON + mesh_quad_tetrahedron.png + + + ICON_DLG_QUADRATIC_TRIANGLE + mesh_quad_triangle.png + + + ICON_DLG_REM_ELEMENT + mesh_rem_element.png + + + ICON_DLG_REM_NODE + mesh_rem_node.png + + + ICON_DLG_RENUMBERING_ELEMENTS + mesh_renumbering_elements.png + + + ICON_DLG_RENUMBERING_NODES + mesh_renumbering_nodes.png + + + ICON_DLG_SMOOTHING + mesh_smoothing.png + + + ICON_DLG_TETRAS + mesh_tetra.png + + + ICON_DLG_TRIANGLE + mesh_triangle.png + + + ICON_EDIT_GROUP + mesh_edit_group.png + + + ICON_OBJBROWSER_SMESH + mesh.png + + + ICON_PATTERN_2d + mesh_algo_mefisto.png + + + ICON_PATTERN_3d + mesh_algo_hexa.png + + + ICON_PATTERN_SAMPLE_2D + pattern_sample_2d.png + + + ICON_PATTERN_SAMPLE_3D + pattern_sample_3D.png + + + ICON_REMOVE + mesh_remove.png + + + ICON_SELECT + select1.png + + + ICON_SMESH_MERGE_NODES + mesh_merge_nodes.png + + + ICON_SMESH_SEWING_BORDERTOSIDE + mesh_sew_bordertoside.png + + + ICON_SMESH_SEWING_CONFORM_FREEBORDERS + mesh_sew_conform_freeborders.png + + + ICON_SMESH_SEWING_FREEBORDERS + mesh_sew_freeborders.png + + + ICON_SMESH_SEWING_SIDEELEMENTS + mesh_sew_sideelements.png + + + ICON_SMESH_SYMMETRY_AXIS + mesh_symmetry_axis.png + + + ICON_SMESH_SYMMETRY_PLANE + mesh_symmetry_plane.png + + + ICON_SMESH_SYMMETRY_POINT + mesh_symmetry_point.png + + + ICON_SMESH_TRANSLATION_POINTS + mesh_translation_points.png + + + ICON_SMESH_TRANSLATION_VECTOR + mesh_translation_vector.png + + + ICON_SMESH_TREE_ALGO + mesh_tree_algo.png + + + ICON_SMESH_TREE_GROUP + mesh_tree_group.png + + + ICON_SMESH_TREE_HYPO + mesh_tree_hypo.png + + + ICON_SMESH_TREE_MESH + mesh_tree_mesh.png + + + ICON_SMESH_TREE_MESH_IMPORTED + mesh_tree_importedmesh.png + + + ICON_SMESH_TREE_MESH_WARN + mesh_tree_mesh_warn.png + + + diff --git a/src/SMESHGUI/SMESH_images.ts b/src/SMESHGUI/SMESH_images.ts new file mode 100644 index 000000000..30aa0216d --- /dev/null +++ b/src/SMESHGUI/SMESH_images.ts @@ -0,0 +1,406 @@ + + + + @default + + ICON_ADV_INFO + advanced_mesh_info.png + + + ICON_ANGLE + mesh_angle.png + + + ICON_APPEND + mesh_add.png + + + ICON_AREA + mesh_area.png + + + ICON_ASPECT + mesh_aspect.png + + + ICON_ASPECT_3D + mesh_aspect_3d.png + + + ICON_BUILD_COMPOUND + mesh_build_compound.png + + + ICON_COMPUTE + mesh_compute.png + + + ICON_CONNECTION + mesh_multi_edges.png + + + ICON_CONNECTION_2D + mesh_multi_edges_2d.png + + + ICON_CONSTRUCT_GROUP + mesh_make_group.png + + + ICON_CONV_TO_QUAD + mesh_conv_to_quad.png + + + ICON_CUT + mesh_cutGroups.png + + + ICON_CUTQUAD + mesh_cutquad.png + + + ICON_DELETE + delete.png + + + ICON_DEL_GROUP + mesh_deleteGroups.png + + + ICON_DLG_ADD_ALGORITHM + mesh_set_algo.png + + + ICON_DLG_ADD_HYPOTHESIS + mesh_set_hypo.png + + + ICON_DLG_ADD_SUBMESH + mesh_add_sub.png + + + ICON_DLG_BUILD_COMPOUND_MESH + mesh_build_compound.png + + + ICON_DLG_CONNECTIVITY + mesh_connectivity.png + + + ICON_DLG_EDGE + mesh_line.png + + + ICON_DLG_EDIT_MESH + mesh_edit.png + + + ICON_DLG_HEXAS + mesh_hexa.png + + + ICON_DLG_INIT_MESH + mesh_init.png + + + ICON_DLG_MERGE_ELEMENTS + mesh_merge_elements.png + + + ICON_DLG_MESH_DIAGONAL + mesh_diagonal.png + + + ICON_DLG_MESH_ORIENTATION + mesh_orientation.png + + + ICON_DLG_MESH_ROTATION + mesh_rotation.png + + + ICON_DLG_MESH_THROU_POINT + mesh_node_to_point.png + + + ICON_DLG_MOVE_NODE + mesh_move_node.png + + + ICON_DLG_NODE + mesh_vertex.png + + + ICON_DLG_POLYGON + mesh_polygon.png + + + ICON_DLG_POLYHEDRON + mesh_polyhedron.png + + + ICON_DLG_QUADRANGLE + mesh_quad.png + + + ICON_DLG_QUADRATIC_EDGE + mesh_quad_edge.png + + + ICON_DLG_QUADRATIC_HEXAHEDRON + mesh_quad_hexahedron.png + + + ICON_DLG_QUADRATIC_PENTAHEDRON + mesh_quad_pentahedron.png + + + ICON_DLG_QUADRATIC_PYRAMID + mesh_quad_pyramid.png + + + ICON_DLG_QUADRATIC_QUADRANGLE + mesh_quad_quadrangle.png + + + ICON_DLG_QUADRATIC_TETRAHEDRON + mesh_quad_tetrahedron.png + + + ICON_DLG_QUADRATIC_TRIANGLE + mesh_quad_triangle.png + + + ICON_DLG_REM_ELEMENT + mesh_rem_element.png + + + ICON_DLG_REM_NODE + mesh_rem_node.png + + + ICON_DLG_RENUMBERING_ELEMENTS + mesh_renumbering_elements.png + + + ICON_DLG_RENUMBERING_NODES + mesh_renumbering_nodes.png + + + ICON_DLG_SMOOTHING + mesh_smoothing.png + + + ICON_DLG_TETRAS + mesh_tetra.png + + + ICON_DLG_TRIANGLE + mesh_triangle.png + + + ICON_EDIT_GROUP + mesh_edit_group.png + + + ICON_EXTRUSION + mesh_extrusion.png + + + ICON_EXTRUSION_ALONG + mesh_extrusionpath.png + + + ICON_FILE_OPEN + open.png + + + ICON_FREE_EDGE + mesh_free_edges.png + + + ICON_FREE_EDGE_2D + mesh_free_edges_2d.png + + + ICON_HYPO + mesh_hypo_length.png + + + ICON_HYPO_EDIT + mesh_hypo_edit.png + + + ICON_INTERSECT + mesh_intersectGroups.png + + + ICON_LENGTH + mesh_length.png + + + ICON_LENGTH_2D + mesh_length_2d.png + + + ICON_MAP + mesh_pattern.png + + + ICON_OBJBROWSER_SMESH + mesh.png + + + ICON_PATTERN_2d + mesh_algo_mefisto.png + + + ICON_PATTERN_3d + mesh_algo_hexa.png + + + ICON_PATTERN_SAMPLE_2D + pattern_sample_2d.png + + + ICON_PATTERN_SAMPLE_3D + pattern_sample_3D.png + + + ICON_POINTS + mesh_points.png + + + ICON_REMOVE + mesh_remove.png + + + ICON_REVOLUTION + mesh_revolution.png + + + ICON_SELECT + select1.png + + + ICON_SHADE + mesh_shading.png + + + ICON_SHRINK + mesh_shrink.png + + + ICON_SKEW + mesh_skew.png + + + ICON_SMESH_MERGE_NODES + mesh_merge_nodes.png + + + ICON_SMESH_SEWING_BORDERTOSIDE + mesh_sew_bordertoside.png + + + ICON_SMESH_SEWING_CONFORM_FREEBORDERS + mesh_sew_conform_freeborders.png + + + ICON_SMESH_SEWING_FREEBORDERS + mesh_sew_freeborders.png + + + ICON_SMESH_SEWING_SIDEELEMENTS + mesh_sew_sideelements.png + + + ICON_SMESH_SYMMETRY_AXIS + mesh_symmetry_axis.png + + + ICON_SMESH_SYMMETRY_PLANE + mesh_symmetry_plane.png + + + ICON_SMESH_SYMMETRY_POINT + mesh_symmetry_point.png + + + ICON_SMESH_TRANSLATION_POINTS + mesh_translation_points.png + + + ICON_SMESH_TRANSLATION_VECTOR + mesh_translation_vector.png + + + ICON_SMESH_TREE_ALGO + mesh_tree_algo.png + + + ICON_SMESH_TREE_GROUP + mesh_tree_group.png + + + ICON_SMESH_TREE_HYPO + mesh_tree_hypo.png + + + ICON_SMESH_TREE_MESH + mesh_tree_mesh.png + + + ICON_SMESH_TREE_MESH_IMPORTED + mesh_tree_importedmesh.png + + + ICON_SMESH_TREE_MESH_PARTIAL + mesh_tree_mesh_partial.png + + + ICON_SMESH_TREE_MESH_WARN + mesh_tree_mesh_warn.png + + + ICON_STD_INFO + standard_mesh_info.png + + + ICON_TAPER + mesh_taper.png + + + ICON_UNION + mesh_unionGroups.png + + + ICON_UNION2TRI + mesh_union2tri.png + + + ICON_UNIONTRI + mesh_uniontri.png + + + ICON_UPDATE + mesh_update.png + + + ICON_VOLUME_3D + mesh_volume_3d.png + + + ICON_WARP + mesh_wrap.png + + + ICON_WHAT_IS + mesh_whatis.png + + + ICON_WIRE + mesh_wireframe.png + + + diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts new file mode 100644 index 000000000..4595fc15d --- /dev/null +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -0,0 +1,4246 @@ + + + + @default + + AREA_ELEMENTS + Area + + + ASPECTRATIO_3D_ELEMENTS + Aspect Ratio 3D + + + ASPECTRATIO_ELEMENTS + Aspect Ratio + + + COL_ALGO_HEADER + Algorithm + + + COL_ERROR_HEADER + Error + + + COL_SHAPE_HEADER + SubShape + + + COMPERR_ALGO_FAILED + Algorithm failed + + + COMPERR_BAD_INPUT_MESH + Invalid input mesh + + + COMPERR_BAD_SHAPE + Unexpected geometry + + + COMPERR_EXCEPTION + Unknown exception + + + COMPERR_MEMORY_PB + Memory allocation problem + + + COMPERR_OCC_EXCEPTION + OCC exception + + + COMPERR_OK + No errors + + + COMPERR_SLM_EXCEPTION + SALOME exception + + + COMPERR_STD_EXCEPTION + std::exception + + + DIRECT_GEOM_SELECTION + Direct geometry selection + + + ELEMENT_ID + Element ID + + + FREE_BORDERS + Free Borders + + + GEOMETRY_NAME + Geometry name + + + GEOM_BY_MESH_ELEM_SELECTION + Find geometry by mesh element selection + + + GLOBAL_ALGO + Global + + + INF_SELECT_OBJECT + Select an object + + + LENGTH2D_EDGES + Length 2D + + + LENGTH_EDGES + Length + + + LOCAL_ALGO + Local + + + MEN_ADD + Add + + + MEN_ADV_INFO + Advanced Mesh Infos + + + MEN_ALL + All + + + MEN_AREA + Area + + + MEN_ASPECT + Aspect Ratio + + + MEN_ASPECT_3D + Aspect Ratio 3D + + + MEN_AUTO_COLOR + Auto color + + + MEN_AUTO_UPD + Automatic update + + + MEN_BUILD_COMPOUND + Build Compound + + + MEN_CLIP + Clipping + + + MEN_COLORS + Colors / Size + + + MEN_COMPUTE + Compute + + + MEN_CONNECTION + Borders at Multi-Connection + + + MEN_CONNECTION_2D + Borders at Multi-Connection 2D + + + MEN_CONSTRUCT_GROUP + Construct Group + + + MEN_CONV_TO_QUAD + Convert to/from quadratic + + + MEN_CREATE_GROUP + Create Group + + + MEN_CREATE_MESH + Create Mesh + + + MEN_CREATE_SUBMESH + Create Sub-mesh + + + MEN_CTRL + Controls + + + MEN_CUT + Cutting of quadrangles + + + MEN_CUT_GROUP + Cut Groups + + + MEN_DAT + DAT file + + + MEN_DELETE + Delete + + + MEN_DEL_GROUP + Delete Groups + + + MEN_DISABLE_AUTO_COLOR + Disable auto color + + + MEN_DISPLAY_ONLY + Show only + + + MEN_DISPMODE + Display mode + + + MEN_DISP_ENT + Display entity + + + MEN_EDGE + Edge + + + MEN_EDGES + Edges + + + MEN_EDIT + Edit + + + MEN_EDIT_GROUP + Edit Group + + + MEN_EDIT_HYPO + Edit Hypothesis + + + MEN_EDIT_MESHSUBMESH + Edit Mesh/Sub-mesh + + + MEN_EXPORT + Export + + + MEN_EXPORT_DAT + Export to DAT file + + + MEN_EXPORT_MED + Export to MED file + + + MEN_EXPORT_STL + Export to STL file + + + MEN_EXPORT_UNV + Export to UNV file + + + MEN_EXTRUSION + Extrusion + + + MEN_EXTRUSION_ALONG + Extrusion along a path + + + MEN_FACES + Faces + + + MEN_FILE + File + + + MEN_FREE_BORDER + Free Borders + + + MEN_FREE_EDGE + Free Edges + + + MEN_GLOBAL_HYPO + Global Hypothesis + + + MEN_HEXA + Hexahedron + + + MEN_HIDE + Hide + + + MEN_HYPO + Hypotheses + + + MEN_IMPORT + Import + + + MEN_INT_GROUP + Intersect Groups + + + MEN_INV + Diagonal Inversion + + + MEN_LENGTH + Length + + + MEN_LENGTH_2D + Length 2D + + + MEN_MAP + Pattern mapping + + + MEN_MED + MED file + + + MEN_MERGE + Merge nodes + + + MEN_MERGE_ELEMENTS + Merge elements + + + MEN_MESH + Mesh + + + MEN_MESH_THROU_POINT + Mesh to pass through a point + + + MEN_MIN_ANG + Minimum Angle + + + MEN_MODIFY + Modification + + + MEN_MOVE + Move Node + + + MEN_NODE + Node + + + MEN_NODES + Nodes + + + MEN_NUM + Numbering + + + MEN_NUM_ELEMENTS + Display Elements # + + + MEN_NUM_NODES + Display Nodes # + + + MEN_ORIENT + Orientation + + + MEN_POLYGON + Polygon + + + MEN_POLYHEDRON + Polyhedron + + + MEN_PRECISION + Precision + + + MEN_PREF + Preferences + + + MEN_QUAD + Quadrangle + + + MEN_QUADRATIC_EDGE + Quadratic Edge + + + MEN_QUADRATIC_HEXAHEDRON + Quadratic Hexahedron + + + MEN_QUADRATIC_PENTAHEDRON + Quadratic Pentahedron + + + MEN_QUADRATIC_PYRAMID + Quadratic Pyramid + + + MEN_QUADRATIC_QUADRANGLE + Quadratic Quadrangle + + + MEN_QUADRATIC_TETRAHEDRON + Quadratic Tetrahedron + + + MEN_QUADRATIC_TRIANGLE + Quadratic Triangle + + + MEN_QUALITY + Quality controls + + + MEN_REMOVE + Remove + + + MEN_REMOVE_ELEMENTS + Elements + + + MEN_REMOVE_NODES + Nodes + + + MEN_RENAME + Rename + + + MEN_RENUM + Renumbering + + + MEN_RENUM_ELEMENTS + Elements + + + MEN_RENUM_NODES + Nodes + + + MEN_RESET + Reset + + + MEN_REVOLUTION + Revolution + + + MEN_ROT + Rotation + + + MEN_SCALAR_BAR + Scalar bar + + + MEN_SCALAR_BAR_PROP + Scalar bar Properties + + + MEN_SELECTION + Selection + + + MEN_SEL_FILTER_LIB + Selection filters library + + + MEN_SEW + Sewing + + + MEN_SHADE + Shading + + + MEN_SHOW + Show + + + MEN_SHRINK + Shrink + + + MEN_SKEW + Skew + + + MEN_SMOOTH + Smoothing + + + MEN_STD_INFO + Standard Mesh Infos + + + MEN_STL + STL file + + + MEN_SYM + Symmetry + + + MEN_TAPER + Taper + + + MEN_TETRA + Tetrahedron + + + MEN_TOOLS + Tools + + + MEN_TRANS + Translation + + + MEN_TRANSF + Transformation + + + MEN_TRANSP + Transparency + + + MEN_TRIANGLE + Triangle + + + MEN_UNASSIGN + Unassign + + + MEN_UNION + Union of triangles + + + MEN_UNION2 + Union of two triangles + + + MEN_UNV + UNV file + + + MEN_UN_GROUP + Union Groups + + + MEN_UPDATE + Update + + + MEN_VIEW + View + + + MEN_VOLUMES + Volumes + + + MEN_VOLUME_3D + Volume + + + MEN_WARP + Warping angle + + + MEN_WHAT_IS + Mesh Element Info + + + MEN_WIRE + Wireframe + + + MESHERS_FILE_CANT_OPEN + Can not open resource file + + + MESHERS_FILE_CHECK_VARIABLE + Check environment variable SMESH_MeshersList + + + MESHERS_FILE_NO_VARIABLE + Environment variable SMESH_MeshersList is not defined + + + MESH_IS_NOT_SELECTED + There is no selected mesh\nPlease, select a mesh and try again + + + MESH_NODE + Node + + + MESH_NODE_TITLE + Add Node + + + MINIMUMANGLE_ELEMENTS + Minimum Angle + + + MULTI2D_BORDERS + Borders at Multi-Connections 2D + + + MULTI_BORDERS + Borders at Multi-Connections + + + NODE_ID + Node ID + + + NON_SMESH_OBJECTS_SELECTED + There are objects selected which do not belong to %1 component. + + + PREVIEW + Preview + + + SKEW_ELEMENTS + Skew + + + SMESHGUI_INVALID_PARAMETERS + Parameters are not correctly specified\nPlease enter correct values and try again + + + SMESH_ADD_ALGORITHM + Algorithms + + + SMESH_ADD_ALGORITHM_TITLE + Algorithms Assignation + + + SMESH_ADD_EDGE + Add Edge + + + SMESH_ADD_EDGE_TITLE + Add Edge + + + SMESH_ADD_HEXAS + Add Hexahedron + + + SMESH_ADD_HEXAS_TITLE + Add Hexahedron + + + SMESH_ADD_HYPOTHESIS + Hypothesis + + + SMESH_ADD_HYPOTHESIS_TITLE + Hypothesis Assignation + + + SMESH_ADD_HYP_WRN + \"%1\" assigned but:\n + + + SMESH_ADD_POLYGON + Add polygon + + + SMESH_ADD_POLYGON_TITLE + Add polygon + + + SMESH_ADD_QUADRANGLE + Add Quadrangle + + + SMESH_ADD_QUADRANGLE_TITLE + Add Quadrangle + + + SMESH_ADD_QUADRATIC_EDGE_TITLE + Add Quadratic Edge + + + SMESH_ADD_QUADRATIC_HEXAHEDRON_TITLE + Add Quadratic Hexahedron + + + SMESH_ADD_QUADRATIC_PENTAHEDRON_TITLE + Add Quadratic Pentahedron + + + SMESH_ADD_QUADRATIC_PYRAMID_TITLE + Add Quadratic Pyramid + + + SMESH_ADD_QUADRATIC_QUADRANGLE_TITLE + Add Quadratic Quadrangle + + + SMESH_ADD_QUADRATIC_TETRAHEDRON_TITLE + Add Quadratic Tetrahedron + + + SMESH_ADD_QUADRATIC_TRIANGLE_TITLE + Add Quadratic Triangle + + + SMESH_ADD_SUBMESH + SubMesh Construction + + + SMESH_ADD_TETRAS + Add Tetrahedron + + + SMESH_ADD_TETRAS_TITLE + Add Tetrahedron + + + SMESH_ADD_TRIANGLE + Add Triangle + + + SMESH_ADD_TRIANGLE_TITLE + Add Triangle + + + SMESH_ANGLE + Angle + + + SMESH_ARGUMENTS + Arguments + + + SMESH_AUTO_GROUPS + Automatically create groups + + + SMESH_AVAILABLE + Available + + + SMESH_AVAILABLE_ALGORITHMS + Available algorithms + + + SMESH_AVAILABLE_HYPOTHESES + Available hypotheses + + + SMESH_AXIS + Axis + + + SMESH_BAD_SELECTION + No valid selection + + + SMESH_BOUNDARYEDGES + Boundary Edges + + + SMESH_BUILD_COMPOUND_TITLE + Create a Compound + + + SMESH_BUT_ADD + A&dd + + + SMESH_BUT_APPLY + &Apply + + + SMESH_BUT_CANCEL + &Cancel + + + SMESH_BUT_CLOSE + &Close + + + SMESH_BUT_CREATE + Create + + + SMESH_BUT_DELETE + Delete + + + SMESH_BUT_FILTER + Set &Filters + + + SMESH_BUT_HELP + &Help + + + SMESH_BUT_NEW + New + + + SMESH_BUT_NO + &No + + + SMESH_BUT_OK + &Ok + + + SMESH_BUT_REMOVE + &Remove + + + SMESH_BUT_SORT + &Sort List + + + SMESH_BUT_YES + &Yes + + + SMESH_CANT_ADD_HYP + Can not assign \"%1\":\n + + + SMESH_CANT_RM_HYP + Can not unassign \"%1\":\n + + + SMESH_CHECK_COLOR + Color + + + SMESH_CLIPPING_FROM + From <--- + + + SMESH_CLIPPING_INTO + ---> Into + + + SMESH_CLIPPING_TITLE + Change Clipping + + + SMESH_COMPUTE_SUCCEED + Mesh computation succeed + + + SMESH_CONTENT + Content + + + SMESH_CONTINUE_MESH_VISUALIZATION + It seems that there is not enough memory to show the mesh\n + + + SMESH_COORDINATES + Coordinates + + + SMESH_COPY_ELEMENTS + Copy Elements + + + SMESH_COPY_GROUPS + Copy groups + + + SMESH_CREATE_ALGORITHMS + Create algorithms + + + SMESH_CREATE_COPY + Create a copy + + + SMESH_CREATE_GROUP_TITLE + Create Group + + + SMESH_CREATE_HYPOTHESES + Create hypotheses + + + SMESH_CREATE_MESH + Create a new mesh + + + SMESH_CREATE_POLYHEDRAL_VOLUME_TITLE + Create polyhedral volume + + + SMESH_DIAGONAL + Diagonal Inversion + + + SMESH_DIAGONAL_INVERSION_TITLE + Diagonal Inversion + + + SMESH_DISTANCE + Distance + + + SMESH_DRS_1 + MED file contains no mesh with the given name + + + SMESH_DRS_2 + + + + SMESH_DRS_3 + Some elements were skipped due to incorrect file data + + + SMESH_DRS_4 + The file is incorrect,\n + + + SMESH_DRS_EMPTY + The file is empty,\n + + + SMESH_DX + dX + + + SMESH_DY + dY + + + SMESH_DZ + dZ + + + SMESH_EDGE + Edge + + + SMESH_EDGES_CONNECTIVITY_TITLE + Edges Connectivity + + + SMESH_EDIT_GROUP_TITLE + Edit Group + + + SMESH_EDIT_HYPOTHESES + Hypotheses Assignation + + + SMESH_EDIT_USED + Used + + + SMESH_ELEMENTS + Elements + + + SMESH_ELEMENTS_COLOR + Mesh Element Color + + + SMESH_ELEMENTS_TYPE + Elements Type + + + SMESH_ELEMENT_TYPE + Element Type + + + SMESH_ERROR + Error + + + SMESH_ERR_SCALARBAR_PARAMS + Warning! The parameters is incorrect + + + SMESH_EXPORT_FAILED + Mesh export failed.\nProbably, there is not enough space on disk. + + + SMESH_EXPORT_MED_DUPLICATED_GRP + There are duplicated group names in mesh \"%1\".\n + + + SMESH_EXPORT_MED_V2_1 + During export mesh with name - \"%1\" to MED 2.1\n + + + SMESH_EXPORT_STL1 + Mesh - \"%1\" does not contain triangles + + + SMESH_EXPORT_STL2 + Mesh - \"%1\" contains another than triangles elements, + + + SMESH_EXPORT_UNV + During export mesh with name - \"%1\" to UNV\n + + + SMESH_EXTRUSION + Extrusion + + + SMESH_FACE + Face + + + SMESH_FEATUREANGLE + Feature Angle + + + SMESH_FEATUREEDGES + Feature Edges + + + SMESH_FONT_ARIAL + Arial + + + SMESH_FONT_BOLD + Bold + + + SMESH_FONT_COURIER + Courier + + + SMESH_FONT_ITALIC + Italic + + + SMESH_FONT_SCALARBAR + Font + + + SMESH_FONT_SHADOW + Shadow + + + SMESH_FONT_TIMES + Times + + + SMESH_GEOM_GROUP + Geometry group + + + SMESH_GROUP + Group + + + SMESH_GROUP_GEOMETRY + Group on geometry + + + SMESH_GROUP_SELECTED + %1 Groups + + + SMESH_GROUP_STANDALONE + Standalone group + + + SMESH_GROUP_TYPE + Group type + + + SMESH_HEIGHT + Height: + + + SMESH_HEXAS + Hexahedron + + + SMESH_HILIGHT_COLOR + Highlight Color + + + SMESH_HORIZONTAL + Horizontal + + + SMESH_HYPOTHESES + Hypotheses + + + SMESH_HYP_1 + Algorithm misses a hypothesis + + + SMESH_HYP_10 + Hypothesis and submesh dimensions mismatch + + + SMESH_HYP_11 + Shape is neither the main one, nor its subshape, nor a valid group + + + SMESH_HYP_12 + Geomerty mismatches algorithm's expectation + + + SMESH_HYP_2 + There are concurrent hypotheses on a shape + + + SMESH_HYP_3 + Hypothesis has a bad parameter value + + + SMESH_HYP_4 + Submesh is ignored as there is another algorithm of upper dimension generating %1D elements + + + SMESH_HYP_5 + Algorithm hides algorithm(s) of lower dimension by generating all-dimensions elements + + + SMESH_HYP_6 + Unknown fatal error at hypothesis definition + + + SMESH_HYP_7 + Hypothesis is not suitable in the current context + + + SMESH_HYP_8 + Non-conform mesh is produced using applied hypotheses + + + SMESH_HYP_9 + Such dimention hypothesis is already assigned to the shape + + + SMESH_ID_DIAGONAL + Id Edges + + + SMESH_ID_ELEMENTS + Id Elements + + + SMESH_ID_FACES + Id Faces + + + SMESH_ID_NODES + Id Nodes + + + SMESH_INFORMATION + Information + + + SMESH_INIT + Mesh + + + SMESH_INIT_MESH + Mesh Construction + + + SMESH_INSUFFICIENT_DATA + Insufficient input value + + + SMESH_LABELS + Labels: + + + SMESH_LABELS_COLORS_SCALARBAR + Colors && Labels + + + SMESH_LENGTH + Length + + + SMESH_MAKE_GROUPS + Generate groups + + + SMESH_MANIFOLDEDGES + Manifold Edges + + + SMESH_MAX + Max + + + SMESH_MEN_ALGORITHMS + Algorithms + + + SMESH_MEN_APPLIED_ALGORIHTMS + Applied Algorithms + + + SMESH_MEN_APPLIED_HYPOTHESIS + Applied Hypotheses + + + SMESH_MEN_COMPONENT + SMESH + + + SMESH_MEN_HYPOTHESIS + Hypotheses + + + SMESH_MEN_SubMeshesOnCompound + SubMeshes On Compound + + + SMESH_MEN_SubMeshesOnEdge + SubMeshes On Edge + + + SMESH_MEN_SubMeshesOnFace + SubMeshes On Face + + + SMESH_MEN_SubMeshesOnSolid + SubMeshes On Solid + + + SMESH_MEN_SubMeshesOnVertex + SubMeshes On Vertex + + + SMESH_MERGE_ELEMENTS + Merge elements + + + SMESH_MERGE_NODES + Merge nodes + + + SMESH_MESH + Mesh + + + SMESH_MESHINFO_ALL_TYPES + Heterogenous + + + SMESH_MESHINFO_EDGES + Edges + + + SMESH_MESHINFO_ELEMENTS + Elements + + + SMESH_MESHINFO_ENTITIES + Entities + + + SMESH_MESHINFO_FACES + Faces + + + SMESH_MESHINFO_HEXAS + Hexahedrons + + + SMESH_MESHINFO_NAME + Name + + + SMESH_MESHINFO_NODES + Nodes + + + SMESH_MESHINFO_ORDER0 + Total + + + SMESH_MESHINFO_ORDER1 + Linear + + + SMESH_MESHINFO_ORDER2 + Quadratic + + + SMESH_MESHINFO_POLYEDRES + Polyhedrons + + + SMESH_MESHINFO_POLYGONES + Polygons + + + SMESH_MESHINFO_PRISMS + Prisms + + + SMESH_MESHINFO_PYRAS + Pyramids + + + SMESH_MESHINFO_QUADRANGLES + Quadrangles + + + SMESH_MESHINFO_TETRAS + Tetrahedrons + + + SMESH_MESHINFO_TITLE + Mesh Infos + + + SMESH_MESHINFO_TOTAL + Total + + + SMESH_MESHINFO_TRIANGLES + Triangles + + + SMESH_MESHINFO_TYPE + Type + + + SMESH_MESHINFO_VOLUMES + Volumes + + + SMESH_MIN + Min + + + SMESH_MOVE + Move + + + SMESH_MOVE_ELEMENTS + Move Elements + + + SMESH_MOVE_NODES_TITLE + Move Node + + + SMESH_NAME + Name + + + SMESH_NODES + Nodes + + + SMESH_NONMANIFOLDEDGES + Non Manifold Edges + + + SMESH_NORMAL + Normal + + + SMESH_NO_MESH_VISUALIZATION + There is not enough memory to show the mesh + + + SMESH_NUMBEROFCOLORS + Nb of colors: + + + SMESH_NUMBEROFLABELS + Nb of labels: + + + SMESH_NUMBEROFSTEPS + Number of steps: + + + SMESH_OBJECTS_SELECTED + %1_objects + + + SMESH_OBJECT_ALGORITHM + Algorithm + + + SMESH_OBJECT_GEOM + Geometrical Object + + + SMESH_OBJECT_HYPOTHESIS + Hypothesis + + + SMESH_OBJECT_MESH + Mesh + + + SMESH_OBJECT_MESHorSUBMESH + Mesh or SubMesh + + + SMESH_OPERATION_FAILED + Operation failed + + + SMESH_ORIENTATION + Orientation + + + SMESH_ORIENTATION_ELEMENTS_TITLE + Change Orientation + + + SMESH_OUTLINE_COLOR + Mesh Object Color + + + SMESH_PARAMETERS + Parameters + + + SMESH_PLANE + Plane + + + SMESH_POINT + Point + + + SMESH_POINT_1 + Point 1 + + + SMESH_POINT_2 + Point 2 + + + SMESH_POLYEDRE_CREATE_ERROR + Polyedron creation error + + + SMESH_POLYEDRON + Polyhedron + + + SMESH_POLYGON + Polygon + + + SMESH_POSITION_SIZE_SCALARBAR + Origin && Size + + + SMESH_PRECISION + Precision + + + SMESH_PREFERENCES_SCALARBAR + Scalar Bar Preferences + + + SMESH_PREF_SELECTION + Preferences - Selection + + + SMESH_PRESELECTION + Preselection + + + SMESH_PRISM + Prism + + + SMESH_PROPERTIES_SCALARBAR + Scalar Bar Properties + + + SMESH_PYRAMID + Pyramid + + + SMESH_QUADRANGLE + Quadrangle + + + SMESH_QUADRATIC_EDGE + Quadratic Edge + + + SMESH_QUADRATIC_HEXAHEDRON + Quadratic Hexahedron + + + SMESH_QUADRATIC_PENTAHEDRON + Quadratic Pentahedron + + + SMESH_QUADRATIC_PYRAMID + Quadratic Pyramid + + + SMESH_QUADRATIC_QUADRANGLE + Quadratic Quadrangle + + + SMESH_QUADRATIC_TETRAHEDRON + Quadratic Tetrahedron + + + SMESH_QUADRATIC_TRIANGLE + Quadratic Triangle + + + SMESH_RANGE_MAX + Max value: + + + SMESH_RANGE_MIN + Min value: + + + SMESH_RANGE_SCALARBAR + Scalar Range + + + SMESH_REALLY_DELETE + Do you really want to delete object(s) ? + + + SMESH_REMOVE + Remove + + + SMESH_REMOVE_ELEMENTS_TITLE + Remove Elements + + + SMESH_REMOVE_NODES_TITLE + Remove Nodes + + + SMESH_RENUMBERING + Renumbering + + + SMESH_RENUMBERING_ELEMENTS_TITLE + Renumbering elements + + + SMESH_RENUMBERING_NODES_TITLE + Renumbering nodes + + + SMESH_REVERSE + Reverse + + + SMESH_REVOLUTION + Revolution + + + SMESH_RM_HYP_WRN + \"%1\" unassigned but:\n + + + SMESH_ROTATION + Rotation + + + SMESH_ROTATION_TITLE + Rotation about an axis + + + SMESH_SCALARBAR + Scalar Bar + + + SMESH_SEGMENTS + Segments + + + SMESH_SELECTION + Selection + + + SMESH_SELECT_FROM + Select From + + + SMESH_SELECT_WHOLE_MESH + Select whole mesh, submesh or group + + + SMESH_SET_COLOR + Color group + + + SMESH_SEWING + Sewing + + + SMESH_SMOOTHING + Smoothing + + + SMESH_STANDARD_MESHINFO_TITLE + Standard Mesh Infos + + + SMESH_SUBMESH + SubMesh + + + SMESH_SUBMESH_SELECTED + %1 SubMeshes + + + SMESH_SYMMETRY + Symmetry + + + SMESH_TETRAS + Tetrahedron + + + SMESH_TITLE + Title: + + + SMESH_TOLERANCE + Tolerance + + + SMESH_TRANSLATION + Translation + + + SMESH_TRANSPARENCY_OPAQUE + ---> Opaque + + + SMESH_TRANSPARENCY_TITLE + Change Transparency + + + SMESH_TRANSPARENCY_TRANSPARENT + Transparent <--- + + + SMESH_TRIANGLE + Triangle + + + SMESH_UPDATEVIEW + Update View + + + SMESH_VALUE + Value + + + SMESH_VECTOR + Vector + + + SMESH_VERTICAL + Vertical + + + SMESH_VISU_PROBLEM + Mesh visualization failed, probably due to lack of memory + + + SMESH_VISU_PROBLEM_CLEAR + Mesh visualization failed, no memory even to show a message,\n + + + SMESH_VOLUME + Volume + + + SMESH_WARNING + Warning + + + SMESH_WHAT_IS_TITLE + Mesh Element Info + + + SMESH_WIDTH + Width: + + + SMESH_WRN_ALGORITHM_ALREADYEXIST + Algorithm already exists + + + SMESH_WRN_COMPUTE_FAILED + Mesh computation failed + + + SMESH_WRN_EMPTY_NAME + Empty name is not valid + + + SMESH_WRN_HYPOTHESIS_ALREADYEXIST + Hypothesis already exists + + + SMESH_WRN_HYPOTHESIS_NOTEXIST + Hypothesis or Algorithm not exists + + + SMESH_WRN_MISSING_PARAMETERS + Missing parameters + + + SMESH_WRN_NO_AVAILABLE_DATA + No available data in selection + + + SMESH_WRN_SELECTIONMODE_DIAGONAL + Activate Link Selection Mode + + + SMESH_WRN_SELECTIONMODE_ELEMENTS + Activate Elements Selection Mode + + + SMESH_WRN_SELECTIONMODE_NODES + Activate Nodes Selection Mode + + + SMESH_WRN_VIEWER_VTK + Study frame with VTK Viewer must be activated + + + SMESH_WRN_WARNING + Warning + + + SMESH_X + X + + + SMESH_X_SCALARBAR + X: + + + SMESH_Y + Y + + + SMESH_Y_SCALARBAR + Y: + + + SMESH_Z + Z + + + STATE_ALGO_MISSING + %3 %2D algorithm is missing + + + STATE_HYP_BAD_GEOMETRY + %3 %2D algorithm \"%1\" is assigned to geometry mismatching its expectation + + + STATE_HYP_BAD_PARAMETER + Hypothesis of %3 %2D algorithm \"%1\" has a bad parameter value + + + STATE_HYP_MISSING + %3 %2D algorithm \"%1\" misses %4D hypothesis + + + STATE_HYP_NOTCONFORM + %3 %2D algorithm \"%1\" would produce not conform mesh: global \"Not Conform Mesh Allowed\" hypotesis is missing + + + STB_ADV_INFO + Advanced Mesh Infos + + + STB_ALL + All + + + STB_AREA + Area + + + STB_ASPECT + Aspect Ratio + + + STB_ASPECT_3D + Aspect Ratio 3D + + + STB_AUTO_COLOR + Auto color + + + STB_AUTO_UPD + Automatic update + + + STB_BUILD_COMPOUND + Build Compound Mesh + + + STB_CLIP + Clipping + + + STB_COLORS + Colors / Size + + + STB_COMPUTE + Compute + + + STB_CONNECTION + Borders at Multi-Connection + + + STB_CONNECTION_2D + Borders at Multi-Connection 2D + + + STB_CONSTRUCT_GROUP + Construct Group + + + STB_CONV_TO_QUAD + Convert to/from quadratic + + + STB_CREATE_GROUP + Create Group + + + STB_CREATE_MESH + Create Mesh + + + STB_CREATE_SUBMESH + Create Sub-mesh + + + STB_CUT + Cutting of quadrangles + + + STB_CUT_GROUP + Cut Groups + + + STB_DAT + Import DAT file + + + STB_DELETE + Delete + + + STB_DEL_GROUP + Delete Groups + + + STB_DISABLE_AUTO_COLOR + Disable auto color + + + STB_DISPLAY_ONLY + Show only + + + STB_DISP_ENT + Display entity + + + STB_EDGE + Edge + + + STB_EDGES + Edges + + + STB_EDIT_GROUP + Edit Group + + + STB_EDIT_HYPO + Edit Hypothesis + + + STB_EDIT_MESHSUBMESH + Edit Mesh/Sub-mesh + + + STB_EXPORT_DAT + Export to DAT file + + + STB_EXPORT_MED + Export to MED file + + + STB_EXPORT_STL + Export to STL file + + + STB_EXPORT_UNV + Export to UNV file + + + STB_EXTRUSION + Extrusion + + + STB_EXTRUSION_ALONG + Extrusion along a path + + + STB_FACES + Faces + + + STB_FREE_BORDER + Free Borders + + + STB_FREE_EDGE + Free Edges + + + STB_GLOBAL_HYPO + Global Hypothesis + + + STB_HEXA + Hexahedron + + + STB_HIDE + Hide + + + STB_INT_GROUP + Intersect Groups + + + STB_INV + Diagonal Inversion + + + STB_LENGTH + Length + + + STB_LENGTH_2D + Length 2D + + + STB_MAP + Pattern mapping + + + STB_MED + Import MED file + + + STB_MERGE + Merge nodes + + + STB_MERGE_ELEMENTS + Merge elements + + + STB_MESH_THROU_POINT + Mesh to pass through a point + + + STB_MIN_ANG + Minimum Angle + + + STB_MOVE + Move Node + + + STB_NODE + Node + + + STB_NODES + Nodes + + + STB_NUM_ELEMENTS + Display Elements + + + STB_NUM_NODES + Display Nodes + + + STB_ORIENT + Orientation + + + STB_POLYGON + Polygon + + + STB_POLYHEDRON + Polyhedron + + + STB_PRECISION + Precision + + + STB_QUAD + Quadrangle + + + STB_QUADRATIC_EDGE + Quadratic Edge + + + STB_QUADRATIC_HEXAHEDRON + Quadratic Hexahedron + + + STB_QUADRATIC_PENTAHEDRON + Quadratic Pentahedron + + + STB_QUADRATIC_PYRAMID + Quadratic Pyramid + + + STB_QUADRATIC_QUADRANGLE + Quadratic Quadrangle + + + STB_QUADRATIC_TETRAHEDRON + Quadratic Tetrahedron + + + STB_QUADRATIC_TRIANGLE + Quadratic Triangle + + + STB_REMOVE_ELEMENTS + Remove elements + + + STB_REMOVE_NODES + Remove nodes + + + STB_RENAME + Rename + + + STB_RENUM_ELEMENTS + Renumbering elements + + + STB_RENUM_NODES + Renumbering nodes + + + STB_RESET + Reset + + + STB_REVOLUTION + Revolution + + + STB_ROT + Rotation + + + STB_SCALAR_BAR + Scalar bar + + + STB_SCALAR_BAR_PROP + Scalar bar Properties + + + STB_SELECTION + Selection + + + STB_SEL_FILTER_LIB + Selection filters library + + + STB_SEW + Sewing + + + STB_SHADE + Shading + + + STB_SHOW + Show + + + STB_SHRINK + Shrink + + + STB_SKEW + Skew + + + STB_SMOOTH + Smoothing + + + STB_STD_INFO + Standard Mesh Infos + + + STB_SYM + Symmetry + + + STB_TAPER + Taper + + + STB_TETRA + Tetrahedron + + + STB_TRANS + Translation + + + STB_TRANSP + Transparency + + + STB_TRIANGLE + Triangle + + + STB_UNASSIGN + Unassign + + + STB_UNION + Union of triangles + + + STB_UNION2 + Union of two triangles + + + STB_UNV + Import UNV file + + + STB_UN_GROUP + Union Groups + + + STB_UPDATE + Update + + + STB_VOLUMES + Volumes + + + STB_VOLUME_3D + Volume + + + STB_WARP + Warping angle + + + STB_WHAT_IS + Mesh Element Info + + + STB_WIRE + Wireframe + + + TAPER_ELEMENTS + Taper + + + TB_ADD_REMOVE + Add/Remove Toolbar + + + TB_CTRL + Controls Toolbar + + + TB_DISP_MODE + Display Mode Toolbar + + + TB_HYPO + Hypotheses Toolbar + + + TB_MESH + Mesh Toolbar + + + TB_MODIFY + Modification Toolbar + + + TOP_ADV_INFO + Advanced Mesh Infos + + + TOP_ALL + All + + + TOP_AREA + Area + + + TOP_ASPECT + Aspect Ratio + + + TOP_ASPECT_3D + Aspect Ratio 3D + + + TOP_AUTO_COLOR + Auto color + + + TOP_AUTO_UPD + Automatic update + + + TOP_BUILD_COMPOUND + Build Compound Mesh + + + TOP_CLIP + Clipping + + + TOP_COLORS + Colors / Size + + + TOP_COMPUTE + Compute + + + TOP_CONNECTION + Borders at Multi-Connection + + + TOP_CONNECTION_2D + Borders at Multi-Connection 2D + + + TOP_CONSTRUCT_GROUP + Construct Group + + + TOP_CONV_TO_QUAD + Convert to/from quadratic + + + TOP_CREATE_GROUP + Create Group + + + TOP_CREATE_MESH + Create Mesh + + + TOP_CREATE_SUBMESH + Create Sub-mesh + + + TOP_CUT + Cutting of quadrangles + + + TOP_CUT_GROUP + Cut Groups + + + TOP_DAT + Import DAT file + + + TOP_DELETE + Delete + + + TOP_DEL_GROUP + Delete Groups + + + TOP_DISABLE_AUTO_COLOR + Disable auto color + + + TOP_DISPLAY_ONLY + Show only + + + TOP_DISP_ENT + Display entity + + + TOP_EDGE + Edge + + + TOP_EDGES + Edges + + + TOP_EDIT_GROUP + Edit Group + + + TOP_EDIT_HYPO + Edit Hypothesis + + + TOP_EDIT_MESHSUBMESH + Edit Mesh/Sub-mesh + + + TOP_EXPORT_DAT + Export to DAT file + + + TOP_EXPORT_MED + Export to MED file + + + TOP_EXPORT_STL + Export to STL file + + + TOP_EXPORT_UNV + Export to UNV file + + + TOP_EXTRUSION + Extrusion + + + TOP_EXTRUSION_ALONG + Extrusion along a path + + + TOP_FACES + Faces + + + TOP_FREE_BORDER + Free Borders + + + TOP_FREE_EDGE + Free Edges + + + TOP_GLOBAL_HYPO + Global Hypothesis + + + TOP_HEXA + Hexahedron + + + TOP_HIDE + Hide + + + TOP_INT_GROUP + Intersect Groups + + + TOP_INV + Diagonal Inversion + + + TOP_LENGTH + Length + + + TOP_LENGTH_2D + Length 2D + + + TOP_MAP + Pattern mapping + + + TOP_MED + Import MED file + + + TOP_MERGE + Merge nodes + + + TOP_MERGE_ELEMENTS + Merge elements + + + TOP_MESH_THROU_POINT + Mesh to pass through a point + + + TOP_MIN_ANG + Minimum Angle + + + TOP_MOVE + Move Node + + + TOP_NODE + Node + + + TOP_NODES + Nodes + + + TOP_NUM_ELEMENTS + Display Elements + + + TOP_NUM_NODES + Display Nodes + + + TOP_ORIENT + Orientation + + + TOP_POLYGON + Polygon + + + TOP_POLYHEDRON + Polyhedron + + + TOP_PRECISION + Precision + + + TOP_QUAD + Quadrangle + + + TOP_QUADRATIC_EDGE + Quadratic Edge + + + TOP_QUADRATIC_HEXAHEDRON + Quadratic Hexahedron + + + TOP_QUADRATIC_PENTAHEDRON + Quadratic Pentahedron + + + TOP_QUADRATIC_PYRAMID + Quadratic Pyramid + + + TOP_QUADRATIC_QUADRANGLE + Quadratic Quadrangle + + + TOP_QUADRATIC_TETRAHEDRON + Quadratic Tetrahedron + + + TOP_QUADRATIC_TRIANGLE + Quadratic Triangle + + + TOP_REMOVE_ELEMENTS + Remove elements + + + TOP_REMOVE_NODES + Remove nodes + + + TOP_RENAME + Rename + + + TOP_RENUM_ELEMENTS + Renumbering elements + + + TOP_RENUM_NODES + Renumbering nodes + + + TOP_RESET + Reset + + + TOP_REVOLUTION + Revolution + + + TOP_ROT + Rotation + + + TOP_SCALAR_BAR + Scalar bar + + + TOP_SCALAR_BAR_PROP + Scalar bar Properties + + + TOP_SELECTION + Selection + + + TOP_SEL_FILTER_LIB + Selection filters library + + + TOP_SEW + Sewing + + + TOP_SHADE + Shading + + + TOP_SHOW + Show + + + TOP_SHRINK + Shrink + + + TOP_SKEW + Skew + + + TOP_SMOOTH + Smoothing + + + TOP_STD_INFO + Standard Mesh Infos + + + TOP_SYM + Symmetry + + + TOP_TAPER + Taper + + + TOP_TETRA + Tetrahedron + + + TOP_TRANS + Translation + + + TOP_TRANSP + Transparency + + + TOP_TRIANGLE + Triangle + + + TOP_UNASSIGN + Unassign + + + TOP_UNION + Union of triangles + + + TOP_UNION2 + Union of two triangles + + + TOP_UNV + Import UNV file + + + TOP_UN_GROUP + Union Groups + + + TOP_UPDATE + Update + + + TOP_VOLUMES + Volumes + + + TOP_VOLUME_3D + Volume + + + TOP_WARP + Warping angle + + + TOP_WHAT_IS + Mesh Element Info + + + TOP_WIRE + Wireframe + + + VOLUME_3D_ELEMENTS + Area + + + WARP_ELEMENTS + Warping + + + + SMESHGUI + + NOT_A_VTK_VIEWER + This command is available in VTK viewer only\nPlease, create VTK viewer and try again + + + PREF_AUTO_GROUPS + Automatically create groups for MED export + + + PREF_AUTO_UPDATE + Automatic update + + + PREF_BACKFACE + Back face + + + PREF_COLOR + Color + + + PREF_DISPLAY_ENTITY + Display entity + + + PREF_DISPLAY_MODE + Display mode + + + PREF_ELEMENTS + Elements + + + PREF_ELEMENT_COLOR + Element color + + + PREF_FILL + Fill + + + PREF_GROUP_ELEMENTS + Elements + + + PREF_GROUP_EXPORT + Mesh export + + + PREF_GROUP_NODES + Nodes + + + PREF_GROUP_PRECISION + Precision + + + PREF_GROUP_PRESELECTION + Preselection + + + PREF_GROUP_QUALITY + Quality controls + + + PREF_GROUP_SELECTION + Selection + + + PREF_GROUP_UPDATE + Update + + + PREF_HIGHLIGHT_COLOR + Highlight color + + + PREF_LABELS_COLOR + Labels color + + + PREF_NODES + Nodes + + + PREF_OBJECTS + Objects + + + PREF_OBJECT_COLOR + Object color + + + PREF_OUTLINE + Outline + + + PREF_PRECISION_USE + Use precision + + + PREF_PRECISION_VALUE + Number of digits after point + + + PREF_RENUMBER + Automatic renumbering + + + PREF_SHRINK_COEFF + Shrink coef. + + + PREF_SIZE + Size + + + PREF_TAB_GENERAL + General + + + PREF_TAB_MESH + Mesh + + + PREF_TAB_SELECTION + Selection + + + PREF_TITLE_COLOR + Title color + + + PREF_WIDTH + Width + + + + SMESHGUI_AddQuadraticElementDlg + + SMESH_ADD_QUADRATIC_EDGE + Add Quadratic Edge + + + SMESH_ADD_QUADRATIC_HEXAHEDRON + Add Quadratic Hexahedron + + + SMESH_ADD_QUADRATIC_PENTAHEDRON + Add Quadratic Pentahedron + + + SMESH_ADD_QUADRATIC_PYRAMID + Add Quadratic Pyramid + + + SMESH_ADD_QUADRATIC_QUADRANGLE + Add Quadratic Quadrangle + + + SMESH_ADD_QUADRATIC_TETRAHEDRON + Add Quadratic Tetrahedron + + + SMESH_ADD_QUADRATIC_TRIANGLE + Add Quadratic Triangle + + + SMESH_CORNER_NODES + Corner Nodes: + + + SMESH_FIRST + First + + + SMESH_LAST + Last + + + SMESH_MIDDLE + Middle + + + + SMESHGUI_BuildCompoundDlg + + COMPOUND + Compound + + + COMPOUND_MESH + Compound_Mesh + + + CREATE_COMMON_GROUPS + Create common groups for initial meshes + + + MERGE_NODES_AND_ELEMENTS + Merge coincident nodes and elements + + + MESHES + Meshes + + + PROCESSING_IDENTICAL_GROUPS + Processing identical groups + + + RENAME + Rename + + + RESULT_NAME + Result name + + + UNITE + Unite + + + + SMESHGUI_ChangeOrientationDlg + + CAPTION + Modification of orientation + + + + SMESHGUI_ComputeDlg + + CAPTION + Compute mesh failed + + + CONSTRUCTOR + Compute mesh + + + ERRORS + Errors + + + MEMORY_LACK + Memory allocation problem + + + PUBLISH_SHAPE + Publish SubShape + + + SHOW_SHAPE + Show SubShape + + + + SMESHGUI_ConvToQuadDlg + + CAPTION + Convert to/from quadratic + + + MEDIUMNDS + Medium nodes on geometry + + + MESH + Mesh + + + RADIOBTN_1 + Convert to quadratic + + + RADIOBTN_2 + Convert from quadratic + + + + SMESHGUI_ConvToQuadOp + + MESH_IS_NOT_SELECTED + Mesh is not selected\nPlease specify it and try again + + + REF_IS_NULL + No valid mesh object selected + + + + SMESHGUI_CreatePatternDlg + + CAPTION + Pattern Creation + + + DEFAULT_2D + Pattern_2d + + + DEFAULT_3D + Pattern_3d + + + ERROR_OF_CREATION + Internal error occurs during pattern creation\nPlease verify validity of entered information + + + ERROR_OF_SAVING + Internal error occurs during pattern saving. Please verify\n\free disk space and your write permission to this file + + + ERR_LOADF_CANT_PROJECT + Impossible to perform projection of nodes to the face + + + ERR_LOADF_CLOSED_FACE + It is impossible to create pattern from face having seam edge + + + ERR_LOADF_NARROW_FACE + It is impossible to create pattern from narrow face + + + ERR_LOADV_BAD_SHAPE + Pattern can be created from closed shell or solid with 6 faces only + + + ERR_LOADV_COMPUTE_PARAMS + It is impossible to compute point parameters + + + ERR_LOAD_EMPTY_SUBMESH + There are no elements to create pattern + + + MESH_OR_SUBMESH + Mesh or SubMesh + + + PATTERN + Pattern + + + PATTERN_FILT + Pattern files(*.smp) + + + PATTERN_NAME + Pattern name + + + PATTERN_TYPE + Pattern type + + + PROJECT + Project nodes on the face + + + SAVE + Save... + + + SAVE_PATTERN + Save Pattern + + + + SMESHGUI_CreatePolyhedralVolumeDlg + + FACES_BY_NODES + Faces by nodes + + + SMESH_POLYEDRE_CREATE_ERROR + Polyhedron creation error. + + + SMESH_POLYEDRE_PREVIEW + Polyhedron preview + + + + SMESHGUI_CuttingOfQuadsDlg + + CAPTION + Cutting of quadrangles + + + + SMESHGUI_DeleteGroupDlg + + CAPTION + Delete groups with contents + + + NO_SELECTED_GROUPS + There are no selected groups\nPlease select a groups and try again + + + SELECTED_GROUPS + Selected groups + + + + SMESHGUI_EditMeshDlg + + COINCIDENT_ELEMENTS + Coincident elements + + + COINCIDENT_NODES + Coincident nodes + + + DETECT + Detect + + + EDIT_SELECTED_GROUP + Edit selected group + + + SELECT_ALL + Select all + + + + SMESHGUI_ExtrusionAlongPathDlg + + BAD_SHAPE_TYPE + The shape selected for the path is not edge + + + CANT_GET_TANGENT + Can't get tangent for one of the path nodes + + + EXTRUSION_1D + Extrusion of 1D elements + + + EXTRUSION_2D + Extrusion of 2D elements + + + EXTRUSION_ALONG_PATH + Extrusion along a path + + + EXTR_BAD_STARTING_NODE + Wrong path starting node + + + LINEAR_ANGLES + Linear variation of the angles + + + NO_ELEMENTS_SELECTED + No mesh elements are selected for extrusion + + + SELECTED_PATH_IS_NOT_EDGE + Path mesh should be of edge type + + + SMESH_ANGLES + Rotation Angles + + + SMESH_BASE_POINT + Base Point + + + SMESH_PATH + Path + + + SMESH_PATH_MESH + Mesh + + + SMESH_PATH_SHAPE + Shape (edge) + + + SMESH_PATH_START + Start node + + + SMESH_USE_ANGLES + Use Angles + + + SMESH_USE_BASE_POINT + Use Base Point + + + WRONG_ANGLES_NUMBER + The number of angles should correspond to the number of path nodes + + + + SMESHGUI_ExtrusionDlg + + EXTRUSION_1D + Extrusion of 1D elements + + + EXTRUSION_2D + Extrusion of 2D elements + + + EXTRUSION_ALONG_LINE + Extrusion along a line + + + + SMESHGUI_FilterDlg + + BAD_SHAPE_NAME + There is no \"%1\" geometrical object in the current study\nPlease select valid object and try again + + + CURRENT_GROUP + Current Group + + + EDGES_TLT + Filter for Edges + + + FACES_TLT + Filter for Faces + + + MESH + Mesh + + + NODES_TLT + Filter for Nodes + + + SELECTION + Initial Selection + + + SET_IN_VIEWER + Insert filter in viewer + + + SHAPE_IS_NOT_A_CYLINDER + \"%1\" is not a cylinderical face\nPlease select a cylindrical face and try again + + + SHAPE_IS_NOT_A_FACE + \"%1\" is not a face\nPlease select a face and try again + + + SHAPE_IS_NOT_A_PLANE + \"%1\" is not a plane\nPlease select a plane and try again + + + SOURCE + Source + + + TLT + Selection filter + + + VOLUMES_TLT + Filter for Volumes + + + + SMESHGUI_FilterLibraryDlg + + ADD + Add + + + ADD_TO_TLT + Add selection filter to library + + + ALL_FILES_FILTER + All Files (*.*) + + + ASSIGN_NEW_NAME + Library already contains filter with name \"%1\"\nNew name \"%2\" is assigned to added filter + + + COPY_FROM_TLT + Copy selection filter from library + + + DELETE + Delete + + + EDGE + Edge + + + EDIT_LIB_TLT + Selection filter library + + + ELEMENT + Element + + + EMPTY_FILTER_NAME + Name of the filter is empty\nPlease enter a non-empty name + + + ERROR_FILTER_NAME + Name of the filter is not unique\nPlease enter other name + + + ERROR_LOAD + It is impossible to load library\nPlease check library file name and attributes + + + ERROR_OF_ADDING + Internal error occurs during adiing new filter in library.\nPlease verify validity of entered information + + + ERROR_OF_COPYING + Internal error occurs during copying filter from library.\nPlease verify validity of entered information + + + ERROR_OF_DELETING + Internal error occurs during deleting filter from library.\nPlease verify validity of entered information + + + ERROR_OF_EDITING + Internal error occurs during editing filter library.\nPlease verify validity of entered information + + + ERROR_OF_SAVING + Internal error occurs during saving filter library\nPlease check input data and try again + + + FACE + Face + + + FILTER + Filter + + + FILTER_NAME + Filter name + + + FILTER_NAMES + Names of filters + + + LIBRARY_FILE + Library file name + + + LIBRARY_IS_NOT_LOADED + Library is not loaded. Please load library and try again + + + LIB_NAME + FilterLib.xml + + + NODE + Node + + + NO_PERMISSION + You do not have write permission to this file + + + OPEN_LIBRARY + Open library + + + SELECTION + Selection + + + VOLUME + Volume + + + XML_FILT + XML files(*.xml) + + + + SMESHGUI_FilterTable + + ADD + Add + + + ADDITIONAL_PARAMETERS + Additional parameters + + + ADD_TO + Add to... + + + AND + And + + + AREA + Area + + + ASPECT_RATIO + Aspect ratio + + + ASPECT_RATIO_3D + Aspect ratio 3D + + + BAD_ORIENTED_VOLUME + Bad oriented volume + + + BELONG_TO_CYLINDER + Belong to Cylinder + + + BELONG_TO_GENSURFACE + Belong to Surface + + + BELONG_TO_GEOM + Belong to Geom + + + BELONG_TO_PLANE + Belong to Plane + + + BINARY + Binary + + + CLEAR + Clear + + + COMPARE + Compare + + + COPY_FROM + Copy from... + + + CRITERION + Criterion + + + EDGES + Edges + + + ENTITY_TYPE + Entity type + + + EQUAL_TO + Equal to + + + ERROR + Threshold value is not correctly specified\nPlease enter correct value and try again + + + FACES + Faces + + + FILTER + Filter + + + FREE_BORDERS + Free borders + + + FREE_EDGES + Free edges + + + ID + ID + + + INSERT + Insert + + + LENGTH + Length + + + LESS_THAN + Less than + + + LYING_ON_GEOM + Lying on Geom + + + MINIMUM_ANGLE + Minimum angle + + + MORE_THAN + More than + + + MULTIEDGES_ERROR + Threshold value of borders at multi-connections can not be equal 1\nPlease enter correct value and try again + + + MULTI_BORDERS + Borders at multi-connections + + + NODES + Nodes + + + NOT + Not + + + OR + Or + + + RANGE_OF_IDS + Range of IDs + + + REMOVE + Remove + + + SKEW + Skew + + + TAPER + Taper + + + THRESHOLD_VALUE + Threshold value + + + UNARY + Unary + + + VOLUMES + Volumes + + + VOLUME_3D + Volume + + + WARPING + Warping + + + + SMESHGUI_GroupOpDlg + + ARGUMENTS + Arguments + + + CUT_OF_TWO_GROUPS + Cut of two groups + + + DIFF_MESHES + Arguments of operation are not correctly specified\nGroups correspond to a different meshes\nPlease specify valid arguments and try again + + + DIFF_TYPES + Arguments of operation are not correctly specified\nGroups contain elements of different types\nPlease specify valid arguments and try again + + + EMPTY_NAME + Name of group to be created is not valid\nPlease specify non-empty name and try again + + + INCORRECT_ARGUMENTS + Arguments of operation are not specified\nPlease specify them and try again + + + INTERSECTION_OF_TWO_GROUPS + Intersection of two groups + + + MAIN_OBJECT + Main object + + + NAME + Name + + + OBJECT_1 + Object 1 + + + OBJECT_2 + Object 2 + + + RESULT_NAME + Result name + + + TOOL_OBJECT + Tool object + + + UNION_OF_TWO_GROUPS + Union of two groups + + + + SMESHGUI_MakeNodeAtPointDlg + + AUTO_SEARCH + Automatic search + + + CAPTION + Mesh to pass through a point + + + CREATE_NEW_METHOD + Create a node + + + MESH_PASS_THROUGH_POINT + Make a node at point + + + METHOD + Method + + + MOVE_EXISTING_METHOD + Move a node + + + NODE_2MOVE + Node to move + + + NODE_2MOVE_ID + ID + + + + SMESHGUI_MakeNodeAtPointOp + + INVALID_ID + Node ID is invalid + + + INVALID_MESH + Mesh to modify not selected + + + + SMESHGUI_MeshDlg + + CREATE_MESH + Create mesh + + + CREATE_SUBMESH + Create sub-mesh + + + DIM_0D + 0D + + + DIM_1D + 1D + + + DIM_2D + 2D + + + DIM_3D + 3D + + + EDIT_MESH_SUBMESH + Edit mesh/sub-mesh + + + GEOMETRY + Geometry + + + HYPOTHESES_SETS + Assign a set of hypotheses + + + MESH + Mesh + + + NAME + Name + + + + SMESHGUI_MeshOp + + ALGORITHM_WITHOUT_HYPOTHESIS + Algorithm is defined for %1 dimension but hypothesis is not defined + + + EDIT_SUBMESH_QUESTION + A submesh on the selected geometry already exists.\n Do you want to edit this submesh? + + + GEOMETRY_OBJECT_IS_NOT_DEFINED + Geometry object is not defined\nPlease specify it and try again + + + GEOMETRY_OBJECT_IS_NULL + Geometry object is null + + + HYPOTHESES_AND_ALGORITHMS_ARE_NOT_DEFINED + Hypotheses and algorithms are not defined + + + HYPOTHESIS_WITHOUT_ALGORITHM + Hypothesis is defined for %1 dimension but algorithm is not defined + + + IMPORTED_MESH + Mesh is not built on geometry + + + INVALID_SUBSHAPE + Geometry object is not a subshape of the shape to mesh + + + MESH_IS_NOT_DEFINED + Mesh is not defined\nPlease specify it and try again + + + MESH_IS_NULL + Mesh is null + + + NAME_OF_MESH_IS_EMPTY + Name of mesh is empty\nPlease enter valid name and try again + + + NAME_OF_SUBMESH_IS_EMPTY + Name of submesh is empty\nPlease enter valid name and try again + + + THERE_IS_NO_OBJECT_FOR_EDITING + There is no object for editing. Please\nselect mesh or sub-mesh and try again + + + + SMESHGUI_MeshPatternDlg + + 3D_BLOCK + 3D block + + + CAPTION + Pattern Mapping + + + CREATE_POLYEDRS_NEAR_BOUNDARY + Create polyhedrons near boundary + + + CREATE_POLYGONS_NEAR_BOUNDARY + Create polygons near boundary + + + ERROR_OF_LOADING + Loading of pattern from file failed. Probably file\nis corrupted or contains pattern of the other type + + + ERROR_OF_OPENING + It is impossible to open file. Please verify whether\nfile exists and your permission to this file + + + ERROR_OF_READING + It is impossible to load pattern\nPlease verify file's contents + + + ERR_READ_3D_COORD + It is impossible to load pattern\nCoordinates of 3D points out of [0,1] range + + + ERR_READ_BAD_INDEX + It is impossible to load pattern\nInvalid index of point detected + + + ERR_READ_BAD_KEY_POINT + It is impossible to load pattern\nKey-point not on a boundary + + + ERR_READ_ELEM_POINTS + It is impossible to load pattern\ninvalid number of points in element + + + ERR_READ_NB_POINTS + It is impossible to load pattern\nIt is impossible to read number of points from file + + + ERR_READ_NO_ELEMS + It is impossible to load pattern\nThere are no elements in it + + + ERR_READ_NO_KEYPOINT + It is impossible to load pattern\nThere are no key-points in 2D one + + + ERR_READ_POINT_COORDS + It is impossible to load pattern\nIt is impossible to read point coordinates from file + + + ERR_READ_TOO_FEW_POINTS + It is impossible to load pattern. There are\n too few points in the file for pattern loading + + + FACE + Face + + + LOAD_PATTERN + Load pattern + + + MESH_FACES + Mesh faces + + + MESH_VOLUMES + Mesh volumes + + + NEW + New... + + + NODE_1 + Node 1 + + + NODE_2 + Node 2 + + + PATTERN + Pattern + + + PATTERN_FILT + Pattern files(*.smp) + + + PATTERN_TYPE + Pattern type + + + PREVIEW + Preview + + + REFINE + Refine selected mesh elements + + + REVERSE + Reverse order of key-points + + + VERTEX + Vertex + + + VERTEX1 + Vertex 1 + + + VERTEX2 + Vertex 2 + + + + SMESHGUI_MeshTab + + ADD_HYPOTHESIS + Add. Hypothesis + + + ALGORITHM + Algorithm + + + HYPOTHESIS + Hypothesis + + + NONE + <None> + + + + SMESHGUI_MoveNodesDlg + + CAPTION + Move node + + + NODE_ID_IS_NOT_DEFINED + Node ID is not defined + + + + SMESHGUI_MultiEditDlg + + ADD + Add + + + FILTER + Filter + + + REMOVE + Remove + + + SELECT_FROM + Select from + + + SORT_LIST + Sort list + + + SPLIT_JOIN_CRITERION + Criterion + + + TO_ALL + Apply to all + + + USE_DIAGONAL_1_3 + Use diagonal 1-3 + + + USE_DIAGONAL_2_4 + Use diagonal 2-4 + + + USE_NUMERIC_FUNC + Use numeric functor + + + + SMESHGUI_PrecisionDlg + + CAPTION + Precision for mesh quality controls + + + NOT_USE + Do not use + + + PRECISION + Number of digits after point + + + + SMESHGUI_RevolutionDlg + + ANGLE_BY_STEP + Use Angle by Step + + + PREVIEW + Preview + + + REVOLUTION_1D + Revolution of 1D elements + + + REVOLUTION_2D + Revolution of 2D elements + + + REVOLUTION_AROUND_AXIS + Revolution around an axis + + + TOTAL_ANGLE + Use Total Angle + + + + SMESHGUI_SewingDlg + + BORDER + Border + + + BORDER_1 + Border 1 + + + BORDER_2 + Border 2 + + + CREATE_POLYEDRS_NEAR_BOUNDARY + Replace affected volumes by polyedres + + + CREATE_POLYGONS_INSTEAD_SPLITTING + Create polygons instead of splitting + + + ERROR_1 + Free Border1 not found by the selected nodes + + + ERROR_2 + Free Border2 not found by the selected nodes + + + ERROR_3 + Free Border1 and Border2 not found by the selected nodes + + + ERROR_4 + No path from the first side node to the last side node have been found + + + ERROR_5 + Not allowed to splite volumes on the side! + + + ERROR_6 + Different number of elements selected on the sides + + + ERROR_7 + Element sets are topologically different or given nodes are inconvenient + + + ERROR_8 + Nodes on the side 1 are either not linked or not laying on the element set boundary + + + ERROR_9 + Nodes on the side 2 are either not linked or not laying on the element set boundary + + + FIRST_NODE_ID + First Node ID + + + LAST_NODE_ID + Last Node ID + + + MERGE_EQUAL_ELEMENTS + Merge equal elements + + + NODE1_TO_MERGE + Node 1 To Merge + + + NODE2_TO_MERGE + Node 2 To Merge + + + SECOND_NODE_ID + Second Node ID + + + SEW_BORDER_TO_SIDE + Sew Border To Side + + + SEW_CONFORM_FREE_BORDERS + Sew Conform Free Borders + + + SEW_FREE_BORDERS + Sew Free Borders + + + SEW_SIDE_ELEMENTS + Sew Side Elements + + + SIDE + Side + + + SIDE_1 + Side 1 + + + SIDE_2 + Side 2 + + + + SMESHGUI_ShapeByMeshDlg + + CAPTION + Find geometry by mesh element + + + + SMESHGUI_SingleEditDlg + + EDGE_BETWEEN + Edge between neighboring triangles + + + + SMESHGUI_SmoothingDlg + + CENTROIDAL + Centroidal + + + FIXED_NODES_IDS + Fixed nodes ids + + + IS_PARAMETRIC + in parametric space + + + ITERATION_LIMIT + Iteration limit + + + LAPLACIAN + Laplacian + + + MAX_ASPECT_RATIO + Max. aspect ratio + + + METHOD + Method + + + + SMESHGUI_TrianglesInversionDlg + + CAPTION + Diagonal inversion + + + + SMESHGUI_UnionOfTrianglesDlg + + CAPTION + Union of triangles + + + MAXIMUM_ANGLE + Maximum bending angle + + + + SMESHGUI_UnionOfTwoTrianglesDlg + + CAPTION + Union of two triangles + + + + SMESHGUI_WhatIsDlg + + ENTITY_TYPE + Element type + + + GRAVITY_CENTER + Gravity center + + + diff --git a/src/SMESH_I/Makefile.am b/src/SMESH_I/Makefile.am index 51f6177f0..95cd7c5a3 100644 --- a/src/SMESH_I/Makefile.am +++ b/src/SMESH_I/Makefile.am @@ -100,6 +100,7 @@ libSMESHEngine_la_CPPFLAGS = \ libSMESHEngine_la_LDFLAGS = \ + $(CORBA_LIBS) \ ../../idl/libSalomeIDLSMESH.la \ ../SMESH/libSMESHimpl.la \ ../Controls/libSMESHControls.la \ @@ -111,16 +112,15 @@ libSMESHEngine_la_LDFLAGS = \ -lSalomeLifeCycleCORBA \ -lTOOLSDS \ -lSalomeGenericObj \ - $(GEOM_LDFLAGS) \ - -lGEOMClient \ $(MED_LDFLAGS) \ -lMEDWrapper_V2_2 \ $(CAS_LDPATH) \ -lTKCDF \ -lTKBO \ - -lTKShHealing \ - $(CORBA_LIBS) + -lTKShHealing +# $(GEOM_LDFLAGS) \ +# -lGEOMClient SMESHEngine_CPPFLAGS = \ $(libSMESHEngine_la_CPPFLAGS) diff --git a/src/SMESH_SWIG_WITHIHM/Makefile.am b/src/SMESH_SWIG_WITHIHM/Makefile.am index 7988a23ea..8dd054ff6 100644 --- a/src/SMESH_SWIG_WITHIHM/Makefile.am +++ b/src/SMESH_SWIG_WITHIHM/Makefile.am @@ -1,29 +1,27 @@ -# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# SMESH SMESHGUI : GUI for SMESH component +# +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS # +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. # +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# File : Makefile.am +# Author : Alexander BORODIN, Open CASCADE S.A.S. # -# File : Makefile.in -# Author : Nicolas REJNERI, Paul RASCLE -# Modified by : Alexander BORODIN (OCN) - autotools usage -# Module : SMESH -# $Header$ include $(top_srcdir)/adm_local/unix/make_common_starter.am @@ -52,6 +50,10 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am # this option puts it to dist #BUILT_SOURCES = swig_wrap.cpp +salomeinclude_HEADERS = \ + libSMESH_Swig.h \ + libSMESH_Swig.i + SWIG_FLAGS = \ @SWIG_FLAGS@ \ -I$(srcdir) \ @@ -69,7 +71,7 @@ libSMESH_Swig.py: swig_wrap.cpp libSMESH_Swigcmodule_la_SOURCES = \ $(BUILT_SOURCES) \ $(SWIG_SOURCES) \ - ../SMESHGUI/SMESHGUI_Swig.cxx + libSMESH_Swig.cxx nodist_libSMESH_Swigcmodule_la_SOURCES = \ swig_wrap.cpp diff --git a/src/SMESHGUI/SMESHGUI_Swig.cxx b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx similarity index 89% rename from src/SMESHGUI/SMESHGUI_Swig.cxx rename to src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx index ee4705c0e..3dc3f5e39 100644 --- a/src/SMESHGUI/SMESHGUI_Swig.cxx +++ b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.cxx @@ -1,68 +1,59 @@ -// SMESH SMESHGUI : GUI for SMESH component +// SMESH SMESH : GUI for SMESH component // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : libSMESH_Swig.cxx +// Author : Nicolas REJNERI, Open CASCADE S.A.S. // -// File : SMESH_Swig.cxx -// Author : Nicolas REJNERI -// Module : SMESH -// $Header$ - -#include "SMESHGUI_Swig.hxx" -#include "Utils_ORB_INIT.hxx" -#include "Utils_SINGLETON.hxx" +// SMESH includes +#include "libSMESH_Swig.h" -#include "SMESHGUI.h" -#include "SMESHGUI_Utils.h" -#include "SMESHGUI_GEOMGenUtils.h" -#include "SMESHGUI_Displayer.h" +#include +#include +#include -// SALOME Includes -#include "SUIT_ResourceMgr.h" -#include "SUIT_Session.h" -#include "SUIT_ViewModel.h" -#include "VTKViewer_ViewModel.h" +// SALOME KERNEL includes +#include +#include +#include -#include "SALOME_Event.hxx" -#include "SALOME_NamingService.hxx" -#include "SalomeApp_Application.h" -#include "SALOMEDSClient_ClientFactory.hxx" +#include -#include "utilities.h" +// SALOME GUI includes +#include +#include +#include +#include -// Open CASCADE Includes -#include +// OCCT includes +#include -// QT Includes -#include +// Qt includes +#include -// IDL Headers +// IDL includes #include #include CORBA_SERVER_HEADER(SMESH_Gen) -#include CORBA_SERVER_HEADER(SMESH_Mesh) #include CORBA_SERVER_HEADER(SMESH_Hypothesis) -using namespace std; - static CORBA::ORB_var anORB; namespace @@ -90,10 +81,10 @@ namespace aDomainRoot = theStudyBuilder->NewObjectToTag(theSComponentMesh,theDomainRootTag); SALOMEDS::GenericAttribute_var anAttr = theStudyBuilder->FindOrCreateAttribute(aDomainRoot,"AttributeName"); SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr); - aName->SetValue(theName.latin1()); + aName->SetValue(theName.toLatin1().data()); anAttr = theStudyBuilder->FindOrCreateAttribute(aDomainRoot,"AttributePixMap"); SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); - aPixmap->SetPixMap(thePixmap.latin1()); + aPixmap->SetPixMap(thePixmap.toLatin1().data()); anAttr = theStudyBuilder->FindOrCreateAttribute(aDomainRoot,"AttributeSelectable"); SALOMEDS::AttributeSelectable_var aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr); aSelAttr->SetSelectable(false); @@ -154,7 +145,7 @@ namespace SMESH::SMESH_Hypothesis_var aDomainItem = SMESH::SMESH_Hypothesis::_narrow(anObject.in()); CORBA::String_var aType = aDomainItem->GetName(); QString aPixmapName = theDomainPixmap + "_" + aType.in(); - aPixmap->SetPixMap(aPixmapName.latin1()); + aPixmap->SetPixMap(aPixmapName.toLatin1().data()); anAttr = theStudyBuilder->FindOrCreateAttribute(aSObject,"AttributeIOR"); SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); anIOR->SetValue(theIOR.c_str()); @@ -214,13 +205,13 @@ namespace SALOMEDS::GenericAttribute_var anAttr = theStudyBuilder->FindOrCreateAttribute(anAppliedDomainSO,"AttributeName"); SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr); - aName->SetValue(theAppliedDomainMEN.latin1()); + aName->SetValue(theAppliedDomainMEN.toLatin1().data()); anAttr = theStudyBuilder->FindOrCreateAttribute(anAppliedDomainSO,"AttributeSelectable"); SALOMEDS::AttributeSelectable_var aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr); aSelAttr->SetSelectable(false); anAttr = theStudyBuilder->FindOrCreateAttribute(anAppliedDomainSO,"AttributePixMap"); SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); - aPixmap->SetPixMap(theAppliedDomainICON.latin1()); + aPixmap->SetPixMap(theAppliedDomainICON.toLatin1().data()); } SALOMEDS::SObject_var aSObject = theStudyBuilder->NewObject(anAppliedDomainSO); theStudyBuilder->Addreference(aSObject,aHypothesisSO); @@ -282,7 +273,7 @@ SMESH_Swig::SMESH_Swig() try { ORB_INIT &anORBInit = *SINGLETON_::Instance(); ASSERT(SINGLETON_::IsAlreadyExisting()); - myORB = anORBInit( 0 , 0 ); + myORB = anORBInit( 0, 0 ); } catch (...) { INFOS("internal error : orb not found"); } @@ -358,7 +349,7 @@ SMESH_Swig::Init(int theStudyID) aModule = anApp->loadModule("Mesh"); aSMESHGUI = dynamic_cast(aModule); } //SRN: BugID IPAL9186: end of a fix - aName->SetValue(aSMESHGUI->moduleName()); + aName->SetValue(aSMESHGUI->moduleName().toLatin1().data()); anAttr = myStudyBuilder->FindOrCreateAttribute(aSComponent,"AttributePixMap"); aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); aPixmap->SetPixMap( "ICON_OBJBROWSER_SMESH" ); @@ -524,7 +515,7 @@ const char* SMESH_Swig::AddSubMesh(const char* theMeshEntry, aSubMeshesRoot = myStudyBuilder->NewObjectToTag(aMeshSO,aShapeTag); anAttr = myStudyBuilder->FindOrCreateAttribute(aSubMeshesRoot,"AttributeName"); SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr); - aName->SetValue(aSubMeshName.latin1()); + aName->SetValue(aSubMeshName.toLatin1().data()); anAttr = myStudyBuilder->FindOrCreateAttribute(aSubMeshesRoot,"AttributeSelectable"); SALOMEDS::AttributeSelectable_var aSelAttr = SALOMEDS::AttributeSelectable::_narrow(anAttr); aSelAttr->SetSelectable(false); @@ -577,7 +568,7 @@ void SMESH_Swig::CreateAndDisplayActor( const char* Mesh_Entry ) SUIT_Session* aSession = SUIT_Session::session(); SUIT_Application* anApplication = aSession->activeApplication(); SalomeApp_Application* anApp = dynamic_cast(anApplication); - SUIT_ViewManager* vman = anApp->getViewManager(VTKViewer_Viewer::Type(),true); + /*SUIT_ViewManager* vman = */anApp->getViewManager(VTKViewer_Viewer::Type(),true); SMESHGUI_Displayer* aDisp = new SMESHGUI_Displayer(anApp); aDisp->Display(_entry,1); } diff --git a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.h b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.h new file mode 100644 index 000000000..8b5b3a77b --- /dev/null +++ b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.h @@ -0,0 +1,83 @@ +// SMESH SMESH : GUI for SMESH component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : libSMESH_Swig.h +// Author : Nicolas REJNERI, Open CASCADE S.A.S. +// + +#ifndef LIBSMESH_SWIG_H +#define LIBSMESH_SWIG_H + +#ifdef WNT +#if defined SMESHSWIG_EXPORTS + #define SMESHSWIG_EXPORT __declspec( dllexport ) + #else + #define SMESHSWIG_EXPORT __declspec( dllimport ) + #endif +#else + #define SMESHSWIG_EXPORT +#endif + +// IDL includes +#include +#include CORBA_SERVER_HEADER(SALOMEDS) + +class SMESHSWIG_EXPORT SMESH_Swig +{ +public: + SMESH_Swig(); + ~SMESH_Swig(); + + void Init( int ); + + const char* AddNewMesh( const char* ); + + const char* AddNewHypothesis( const char* ); + const char* AddNewAlgorithms( const char* ); + + void SetShape( const char*, const char* ); + + void SetHypothesis( const char*, const char* ); + void SetAlgorithms( const char*, const char* ); + + void UnSetHypothesis( const char* ); + + const char* AddSubMesh( const char*, const char*, int ); + const char* AddSubMeshOnShape( const char*, const char*, const char*, int ); + + void CreateAndDisplayActor( const char* ); + + void SetName( const char*, const char* ); + + /*! + * \brief Set mesh icon according to compute status + * \param Mesh_Entry - entry of a mesh + * \param isComputed - is mesh computed or not + */ + void SetMeshIcon( const char*, const bool, const bool ); + +private: + SALOMEDS::Study_var myStudy; + SALOMEDS::StudyBuilder_var myStudyBuilder; + SALOMEDS::SComponent_var mySComponentMesh; +}; + +#endif // LIBSMESH_SWIG_H diff --git a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.i b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.i index 247c0fc39..5f85aeac5 100644 --- a/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.i +++ b/src/SMESH_SWIG_WITHIHM/libSMESH_Swig.i @@ -1,30 +1,80 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// SMESH SMESHGUI : GUI for SMESH component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : libSMESH_Swig.i +// Author : Nicolas REJNERI, Open CASCADE S.A.S. // -// File : libGeometry_Swig.i -// Author : Nicolas REJNERI, Paul RASCLE -// Module : SMESH -// $Header$ %module libSMESH_Swig -%include "SMESHGUI_Swig.i" +%{ +#include "libSMESH_Swig.h" +%} + +/* Exception handler for all functions */ +%exception +{ + class PyAllowThreadsGuard + { + public: + // Py_BEGIN_ALLOW_THREADS + PyAllowThreadsGuard() { _save = PyEval_SaveThread(); } + // Py_END_ALLOW_THREADS + ~PyAllowThreadsGuard() { PyEval_RestoreThread(_save); } + private: + PyThreadState *_save; + }; + + PyAllowThreadsGuard guard; + + $action +} + +%include "typemaps.i" + +class SMESH_Swig +{ + public: + SMESH_Swig(); + ~SMESH_Swig(); + + void Init(int studyID); + + const char* AddNewMesh(const char* IOR); + const char* AddNewHypothesis(const char* IOR); + const char* AddNewAlgorithms(const char* IOR); + + void SetShape(const char* ShapeEntry, const char* MeshEntry); + + void SetHypothesis(const char* Mesh_Or_SubMesh_Entry, const char* Hypothesis_Entry); + void SetAlgorithms(const char* Mesh_Or_SubMesh_Entry, const char* Algorithms_Entry); + + void UnSetHypothesis(const char* Applied_Hypothesis_Entry ); + + const char* AddSubMesh (const char* Mesh_Entry, const char* SM_IOR, int ST); + const char* AddSubMeshOnShape (const char* Mesh_Entry, const char* GeomShape_Entry, const char* SM_IOR, int ST); + + void SetName(const char* Entry, const char* Name); + + void SetMeshIcon(const char* Mesh_Entry, const bool isComputed, const bool isEmpty); + void CreateAndDisplayActor( const char* Mesh_Entry ); +}; diff --git a/src/StdMeshersGUI/SMESH_StdMeshersGUI.hxx b/src/StdMeshersGUI/SMESH_StdMeshersGUI.hxx index 6171d9f84..988ae8d8b 100755 --- a/src/StdMeshersGUI/SMESH_StdMeshersGUI.hxx +++ b/src/StdMeshersGUI/SMESH_StdMeshersGUI.hxx @@ -1,31 +1,28 @@ -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// File : SMESH_StdMeshersGUI.hxx +// Author : Alexander BORODIN, Open CASCADE S.A.S. // -// File : SMESH_StdMeshersGUI.hxx -// Author : Alexander BORODIN -// Module : SMESH -// $Header: -#ifndef _SMESH_StdMeshersGUI_HXX_ -#define _SMESH_StdMeshersGUI_HXX_ +#ifndef SMESH_STDMESHERSGUI_HXX +#define SMESH_STDMESHERSGUI_HXX #ifdef WNT #if defined STDMESHERSGUI_EXPORTS @@ -37,4 +34,4 @@ #define STDMESHERSGUI_EXPORT #endif -#endif +#endif // SMESH_STDMESHERSGUI_HXX diff --git a/src/StdMeshersGUI/StdMeshersGUI.cxx b/src/StdMeshersGUI/StdMeshersGUI.cxx index 589a487df..821e1ace2 100644 --- a/src/StdMeshersGUI/StdMeshersGUI.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI.cxx @@ -1,34 +1,30 @@ -// SMESH StdMeshersGUI : GUI for plugged-in meshers +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// Copyright (C) 2003 CEA -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : StdMeshersGUI.cxx +// Author : Alexander SOLOVYOV, Open CASCADE S.A.S. // -// File : StdMeshersGUI.cxx -// Author : Alexander SOLOVYOV -// Module : SMESH -// $Header$ +// SMESH includes #include "StdMeshersGUI_StdHypothesisCreator.h" #include "StdMeshersGUI_NbSegmentsCreator.h" - //============================================================================= /*! GetHypothesisCreator * diff --git a/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.cxx b/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.cxx index 460dfb4d5..96a72747e 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.cxx @@ -17,9 +17,20 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : StdMeshersGUI_DistrPreview.cxx +// Author : Open CASCADE S.A.S. +// +// SMESH includes #include "StdMeshersGUI_DistrPreview.h" +// Qwt includes +#include +#include +#include +#include + +// OCCT includes #include #include @@ -45,25 +56,34 @@ StdMeshersGUI_DistrPreview::StdMeshersGUI_DistrPreview( QWidget* p, StdMeshers:: { myHypo = StdMeshers::StdMeshers_NumberOfSegments::_duplicate( h ); myVars.ChangeValue( 1 ) = new Expr_NamedUnknown( "t" ); - myDensity = insertCurve( QString() ); - myDistr = insertCurve( QString() ); - myMsg = insertMarker( new QwtPlotMarker( this ) ); - setMarkerPos( myMsg, 0.5, 0.5 ); - setMarkerLabelPen( myMsg, QPen( Qt::red, 1 ) ); - QFont f = markerFont( myMsg ); - f.setPointSize( 14 ); - f.setBold( true ); - setMarkerFont( myMsg, f ); - setCurvePen( myDensity, QPen( Qt::red, 1 ) ); + myDensity = new QwtPlotCurve( QString() ); + myDensity->attach( this ); + myDistr = new QwtPlotCurve( QString() ); + myDistr->attach( this ); + myMsg = new QwtPlotMarker(); + myMsg->attach( this ); + myMsg->setValue( 0.5, 0.5 ); + QwtText mt = myMsg->label(); + mt.setBackgroundPen( QPen( Qt::red, 1 ) ); + QFont f = mt.font(); + f.setPointSize( 14 ); f.setBold( true ); + mt.setFont( f ); + myMsg->setLabel( mt ); + myDensity->setPen( QPen( Qt::red, 1 ) ); QColor dc = Qt::blue; - setCurvePen( myDistr, QPen( dc, 1 ) ); - setCurveSymbol( myDistr, QwtSymbol( QwtSymbol::XCross, QBrush( dc ), QPen( dc ), QSize( 5, 5 ) ) ); - setAutoLegend( true ); - enableLegend( true ); - setLegendPos( Qwt::Bottom ); - setCurveTitle( myDensity, tr( "SMESH_DENSITY_FUNC" ) ); - setCurveTitle( myDistr, tr( "SMESH_DISTR" ) ); + myDistr->setPen( QPen( dc, 1 ) ); + myDistr->setSymbol( QwtSymbol( QwtSymbol::XCross, QBrush( dc ), QPen( dc ), QSize( 5, 5 ) ) ); + + QwtLegend* l = legend(); + if ( !l ) { + l = new QwtLegend( this ); + l->setFrameStyle( QFrame::Box | QFrame::Sunken ); + } + insertLegend( l, QwtPlot::BottomLegend ); + + myDensity->setTitle( tr( "SMESH_DENSITY_FUNC" ) ); + myDistr->setTitle( tr( "SMESH_DISTR" ) ); } StdMeshersGUI_DistrPreview::~StdMeshersGUI_DistrPreview() @@ -184,7 +204,7 @@ void StdMeshersGUI_DistrPreview::update() if( isTableFunc() ) arr = h->BuildDistributionTab( myTableFunc, myNbSeg, ( int )myConv ); else - arr = h->BuildDistributionExpr( myFunction.latin1(), myNbSeg, ( int )myConv ); + arr = h->BuildDistributionExpr( myFunction.toLatin1().data(), myNbSeg, ( int )myConv ); if( arr ) { distr = *arr; @@ -200,7 +220,11 @@ void StdMeshersGUI_DistrPreview::update() return; } else - setMarkerLabel( myMsg, QString() ); + { + QwtText mt = myMsg->label(); + mt.setText( QString() ); + myMsg->setLabel( mt ); + } int size = graph.length()/2; double* x = new double[size], *y = new double[size]; @@ -227,9 +251,9 @@ void StdMeshersGUI_DistrPreview::update() max_x = x[i]; } - setAxisScale( curveXAxis( myDensity ), min_x, max_x ); - setAxisScale( curveYAxis( myDensity ), min( 0.0, min_y ), max( 0.0, max_y ) ); - setCurveData( myDensity, x, y, size ); + setAxisScale( myDensity->xAxis(), min_x, max_x ); + setAxisScale( myDensity->yAxis(), min( 0.0, min_y ), max( 0.0, max_y ) ); + myDensity->setData( x, y, size ); if( x ) delete[] x; if( y ) @@ -244,7 +268,7 @@ void StdMeshersGUI_DistrPreview::update() x[i] = distr[i]; y[i] = 0; } - setCurveData( myDistr, x, y, size ); + myDistr->setData( x, y, size ); delete[] x; delete[] y; x = y = 0; @@ -261,11 +285,13 @@ void StdMeshersGUI_DistrPreview::update() void StdMeshersGUI_DistrPreview::showError() { - setAxisScale( curveXAxis( myDensity ), 0.0, 1.0 ); - setAxisScale( curveYAxis( myDensity ), 0.0, 1.0 ); - setCurveData( myDensity, 0, 0, 0 ); - setCurveData( myDistr, 0, 0, 0 ); - setMarkerLabel( myMsg, tr( "SMESH_INVALID_FUNCTION" ) ); + setAxisScale( myDensity->xAxis(), 0.0, 1.0 ); + setAxisScale( myDensity->yAxis(), 0.0, 1.0 ); + myDensity->setData( 0, 0, 0 ); + myDistr->setData( 0, 0, 0 ); + QwtText mt = myMsg->label(); + mt.setText( tr( "SMESH_INVALID_FUNCTION" ) ); + myMsg->setLabel( mt ); replot(); } @@ -299,7 +325,7 @@ bool StdMeshersGUI_DistrPreview::init( const QString& str ) OCC_CATCH_SIGNALS; #endif myExpr = ExprIntrp_GenExp::Create(); - myExpr->Process( ( Standard_CString ) str.latin1() ); + myExpr->Process( ( Standard_CString ) str.toLatin1().data() ); } catch(Standard_Failure) { Handle(Standard_Failure) aFail = Standard_Failure::Caught(); parsed_ok = false; diff --git a/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.h b/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.h index ef230ccb3..880dfbc04 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.h +++ b/src/StdMeshersGUI/StdMeshersGUI_DistrPreview.h @@ -17,20 +17,32 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : StdMeshersGUI_DistrPreview.h +// Author : Open CASCADE S.A.S. +// -#ifndef STD_MESHERS_GUI_DISTR_PREVIEW_HEADER -#define STD_MESHERS_GUI_DISTR_PREVIEW_HEADER +#ifndef STDMESHERSGUI_DISTRPREVIEW_H +#define STDMESHERSGUI_DISTRPREVIEW_H +// SMESH includes #include "SMESH_StdMeshersGUI.hxx" +// Qwt includes #include + +// IDL includes #include #include CORBA_SERVER_HEADER(SMESH_Mesh) #include CORBA_SERVER_HEADER(SMESH_BasicHypothesis) + +// OCCT includes #include #include #include +class QwtPlotCurve; +class QwtPlotMarker; + class STDMESHERSGUI_EXPORT StdMeshersGUI_DistrPreview : public QwtPlot { Q_OBJECT @@ -69,7 +81,9 @@ private: bool myIsTable; Conversion myConv; SMESH::double_array myTableFunc; - long myDensity, myDistr, myMsg; + QwtPlotCurve* myDensity; + QwtPlotCurve* myDistr; + QwtPlotMarker* myMsg; Handle(ExprIntrp_GenExp) myExpr; Expr_Array1OfNamedUnknown myVars; TColStd_Array1OfReal myValues; @@ -77,4 +91,4 @@ private: StdMeshers::StdMeshers_NumberOfSegments_var myHypo; }; -#endif +#endif // STDMESHERSGUI_DISTRPREVIEW_H diff --git a/src/StdMeshersGUI/StdMeshersGUI_DistrTable.cxx b/src/StdMeshersGUI/StdMeshersGUI_DistrTable.cxx index 3d0d2ae44..4b5398bde 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_DistrTable.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_DistrTable.cxx @@ -1,374 +1,606 @@ -// SMESH StdMeshersGUI +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : StdMeshersGUI_DistrTable.cxx +// Author : Open CASCADE S.A.S. // -// -// File : StdMeshersGUI_DistrTable.cxx -// Module : SMESH -// $Header$ +// SMESH includes #include "StdMeshersGUI_DistrTable.h" -#include -#include -#include -#include +// Qt incldues +#include +#include +#include +#include +#include +#include + +#define SPACING 6 + +/*! + \brief Sort list of points by ascending order. + \internal +*/ +static void sortData( QList& d ) +{ + typedef QPair Pair; + QList pairs; + for ( int i = 0; i < d.count() / 2; i++ ) + pairs.append( Pair( d[i*2], d[i*2+1] ) ); + + qSort( pairs ); + + d.clear(); + + Pair p; + double prevX = 0.0, prevY = 0.0; + + d.append( prevX ); + d.append( pairs.count() > 0 ? pairs[0].second : prevY ); + + foreach( p, pairs ) { + if ( p.first > prevX ) { + d.append( p.first ); + d.append( p.second ); + prevY = p.second; + } + prevX = p.first; + } + + if ( prevX < 1.0 ) { + d.append( 1.0 ); + d.append( prevY ); + } +} + +/*! + \class StdMeshersGUI_DistrTableFrame::SpinBoxDelegate + \brief Custom item delegate (uses double spin box to edit table item) + \internal +*/ -//================================================================================= -// class : StdMeshersGUI_DistrTable -// purpose : -//================================================================================= -StdMeshersGUI_DistrTable::StdMeshersGUI_DistrTable( const int rows, QWidget* parent, const char* name ) -: QTable( rows, 2, parent, name ) +class StdMeshersGUI_DistrTableFrame::SpinBoxDelegate : public QItemDelegate +{ +public: + SpinBoxDelegate( StdMeshersGUI_DistrTableFrame::Table* ); + ~SpinBoxDelegate(); + + QWidget* createEditor( QWidget*, + const QStyleOptionViewItem&, + const QModelIndex& ) const; + void setEditorData( QWidget*, const QModelIndex&) const; + void setModelData( QWidget*, QAbstractItemModel*, + const QModelIndex& ) const; + void updateEditorGeometry( QWidget*, + const QStyleOptionViewItem&, + const QModelIndex& ) const; + +private: + StdMeshersGUI_DistrTableFrame::Table* myTable; +}; + +/*! + \class StdMeshersGUI_DistrTableFrame::Table + \brief Table function widget + \internal +*/ + +class StdMeshersGUI_DistrTableFrame::Table : public QTableWidget +{ +private: + struct EditorData + { + int r, c; + QDoubleSpinBox* sb; + EditorData() { reset(); } + void reset() { r = -1; c = -1; sb = 0; } + }; + +public: + Table( QWidget*, int = 2 ); + ~Table(); + + QList data(); + void setData( const QList& ); + + double value( int, int ) const; + void setValue( int, int, double ); + + double argMinimum( int ) const; + double argMaximum( int ) const; + double argStep( int ) const; + double funcMinimum( int ) const; + double funcMaximum( int ) const; + double funcStep( int ) const; + + void setFuncMinValue( double ); + + QSize sizeHint() const; + + void addRow(); + void deleteRow(); + + void setEditor( int, int, QDoubleSpinBox* ); + +protected: + void closeEditor( QWidget*, QAbstractItemDelegate::EndEditHint ); + +private: + void setUpRows( bool = false ); + QSize cachedSizeHint() const; + void setCachedSizeHint( const QSize& ) const; + QList selectedRows(); + +private: + double myFuncMin; + QSize myCachedSizeHint; + EditorData myEditorData; +}; + +// --- +// StdMeshersGUI_DistrTableFrame::SpinBoxDelegate implementation +// --- + +StdMeshersGUI_DistrTableFrame::SpinBoxDelegate:: +SpinBoxDelegate( StdMeshersGUI_DistrTableFrame::Table* parent ) + : QItemDelegate( parent ), myTable( parent ) { - horizontalHeader()->setLabel( 0, "t" ); - horizontalHeader()->setLabel( 1, "f(t)" ); - myArgV = new QtxDblValidator( 0.0, 1.0, 3, this ); - myFuncV = new QtxDblValidator( 0.0, 1E20, 3, this ); } -StdMeshersGUI_DistrTable::~StdMeshersGUI_DistrTable() +StdMeshersGUI_DistrTableFrame::SpinBoxDelegate:: +~SpinBoxDelegate() { } -QSize StdMeshersGUI_DistrTable::sizeHint() const +QWidget* +StdMeshersGUI_DistrTableFrame::SpinBoxDelegate:: +createEditor( QWidget* parent, + const QStyleOptionViewItem& /*option*/, + const QModelIndex& index ) const { - if( cachedSizeHint().isValid() ) - return cachedSizeHint(); + QDoubleSpinBox* sb = new QDoubleSpinBox( parent ); + sb->setFrame(false); + sb->setMinimum( index.column() == StdMeshersGUI_DistrTableFrame::ArgColumn ? + myTable->argMinimum( index.row() ) : + myTable->funcMinimum( index.row() ) ); + sb->setMaximum( index.column() == StdMeshersGUI_DistrTableFrame::ArgColumn ? + myTable->argMaximum( index.row() ) : + myTable->funcMaximum( index.row() ) ); + sb->setSingleStep( index.column() == StdMeshersGUI_DistrTableFrame::ArgColumn ? + myTable->argStep( index.row() ) : + myTable->funcStep( index.row() ) ); + myTable->setEditor( index.row(), index.column(), sb ); + return sb; +} - constPolish(); +void +StdMeshersGUI_DistrTableFrame::SpinBoxDelegate:: +setEditorData( QWidget* editor, const QModelIndex& index ) const +{ + QString value = index.model()->data(index, Qt::DisplayRole).toString(); + QDoubleSpinBox* sb = static_cast(editor); - QSize sh = QScrollView::sizeHint(); - if( sh.width()<400 ) - sh.setWidth( 400 ); - if( sh.height()<200 ) - sh.setHeight( 200 ); + bool bOk = false; + double v = value.toDouble( &bOk ); + if ( !bOk ) v = sb->minimum(); - setCachedSizeHint( sh ); - return sh; + sb->setValue( v ); } -void StdMeshersGUI_DistrTable::stopEditing( const bool accept ) +void +StdMeshersGUI_DistrTableFrame::SpinBoxDelegate:: +setModelData( QWidget* editor, QAbstractItemModel* model, + const QModelIndex& index ) const { - endEdit( currEditRow(), currEditCol(), accept, false ); + QDoubleSpinBox* sb = static_cast(editor); + model->setData( index, QString::number( sb->value() ), Qt::DisplayRole ); } -QWidget* StdMeshersGUI_DistrTable::beginEdit( int row, int col, bool replace ) +void +StdMeshersGUI_DistrTableFrame::SpinBoxDelegate:: +updateEditorGeometry( QWidget* editor, + const QStyleOptionViewItem& option, + const QModelIndex& /*index*/ ) const { - QWidget* w = QTable::beginEdit( row, col, replace ); - if( w && w->inherits( "QLineEdit" ) ) - ( ( QLineEdit* )w )->selectAll(); - return w; + editor->setGeometry( option.rect ); } -void StdMeshersGUI_DistrTable::edit( const int r, const int c ) +// --- +// StdMeshersGUI_DistrTableFrame::Table implementation +// --- + +StdMeshersGUI_DistrTableFrame::Table:: +Table( QWidget* parent, int rows ) + : QTableWidget( parent ), myFuncMin( 0.0 ) { - if( isEditing() ) - endEdit( currEditRow(), currEditCol(), true, false ); - clearSelection(); - setCurrentCell( r, c ); - if( beginEdit( r, c, false ) ) - setEditMode( Editing, r, c ); - QTableSelection sel; - sel.init( r, c ); - sel.expandTo( r, c ); - addSelection( sel ); + setItemDelegate( new StdMeshersGUI_DistrTableFrame::SpinBoxDelegate( this ) ); + + setColumnCount( 2 ); + + QStringList labs; + labs << "t" << "f(t)"; + setHorizontalHeaderLabels( labs ); + + while( rows-- ) + addRow(); + + setUpRows( true ); } -bool StdMeshersGUI_DistrTable::eventFilter( QObject* o, QEvent* e ) +void +StdMeshersGUI_DistrTableFrame::Table:: +setEditor( int r, int c, QDoubleSpinBox* sb ) { - if( e && e->type()==QEvent::KeyPress ) - { - QKeyEvent* ke = ( QKeyEvent* )e; - int k = ke->key(); - if( k==Qt::Key_Tab || k==Qt::Key_BackTab || k==Qt::Key_Return || k==Qt::Key_Up || k==Qt::Key_Down ) - { - keyPressEvent( ke ); - return true; - } - } - return QTable::eventFilter( o, e ); -} - -void StdMeshersGUI_DistrTable::keyPressEvent( QKeyEvent* e ) -{ - if( e ) - { - int r = currentRow(), c = currentColumn(), nr, nc; - bool shift = e->state() & Qt::ShiftButton, cr = false; - switch( e->key() ) - { - case Qt::Key_Tab: - nc = c+1; - nr = r; - break; - - case Qt::Key_BackTab: - nc = c-1; - nr = r; - break; - - case Qt::Key_Return: - nc = 0; - nr = shift ? r-1 : r+1; - cr = true; - break; - - case Qt::Key_Up: - nc = c; - nr = r-1; - break; - - case Qt::Key_Down: - nc = c; - nr = r+1; - break; - - default: - QTable::keyPressEvent( e ); - return; - } + myEditorData.r = r; + myEditorData.c = c; + myEditorData.sb = sb; +} - if( nc<0 ) - { - nc=1; nr--; - } - if( nc>1 ) - { - nc=0; nr++; - } +StdMeshersGUI_DistrTableFrame::Table:: +~Table() +{ +} - if( nr>=numRows() && cr ) - { - if( isEditing() ) - endEdit( currEditRow(), currEditCol(), true, false ); - onEdit( INSERT_ROW, nr ); - } +QList +StdMeshersGUI_DistrTableFrame::Table:: +data() +{ + closePersistentEditor( currentItem() ); - else if( nr<0 || nr>=numRows() ) - { - nr = r; nc = c; - } - edit( nr, nc ); - e->accept(); + QList d; + for ( int r = 0; r < rowCount(); r++ ) { + d.append( value( r, ArgColumn ) ); + d.append( value( r, FuncColumn ) ); } + return d; } -QWidget* StdMeshersGUI_DistrTable::createEditor( int r, int c, bool init ) const +void +StdMeshersGUI_DistrTableFrame::Table:: +setData( const QList& d ) { - QWidget* w = QTable::createEditor( r, c, init ); - if( w ) - { - //w->installEventFilter( this ); - if( w->inherits( "QLineEdit" ) ) - { - QLineEdit* le = ( QLineEdit* )w; - le->setValidator( c==0 ? myArgV : myFuncV ); - } + closePersistentEditor( currentItem() ); + + setRowCount( d.count() / 2 ); + for ( int r = 0; r < rowCount(); r++ ) { + setValue( r, ArgColumn, d[r*2] ); + setValue( r, FuncColumn, d[r*2+1] ); } - - return w; -} - -void StdMeshersGUI_DistrTable::onEdit( TableButton b, int cur ) -{ - switch( b ) - { - case INSERT_ROW: - setNumRows( numRows()+1 ); - for( int i=numRows()-1; i>=cur; i-- ) - for( int j=0; jcur ) - setText( i, j, text( i-1, j ) ); - else - setText( i, j, "0" ); - emit( valueChanged( cur, 0 ) ); - break; - - case REMOVE_ROW: - if( numRows()>1 ) - { - for( int i=cur; i rowCount() || c < 0 || c > columnCount() || !item( r, c ) ) + return 0.0; + + return item( r, c )->text().toDouble(); +} + +void +StdMeshersGUI_DistrTableFrame::Table:: +setValue( int r, int c, double v ) +{ + if ( r < 0 || r > rowCount() || c < 0 || c > columnCount() ) + return; + + if ( c == FuncColumn && v < funcMinimum( r ) ) + v = funcMinimum( r ); // correct func value according to the valid min value + if ( c == FuncColumn && v < funcMaximum( r ) ) + v = funcMaximum( r ); // correct func value according to the valid max value + else if ( r == ArgColumn && v < argMinimum( r ) ) + v = argMinimum( r ); // correct arg value according to the valid min value + else if ( r == ArgColumn && v > argMaximum( r ) ) + v = argMaximum( r ); // correct arg value according to the valid max value + + if ( !item( r, c ) ) + setItem( r, c, new QTableWidgetItem ); + item( r, c )->setText( QString::number( v ) ); +} + +double +StdMeshersGUI_DistrTableFrame::Table:: +argMinimum( int r ) const +{ + // for the first row the minimum value is always 0.0 + // for the other rows the minumum value is the above row's value + double val = 0.0; + if ( r > 0 && r < rowCount() ) + val = value( r-1, ArgColumn ); + return val; +} + +double +StdMeshersGUI_DistrTableFrame::Table:: +argMaximum( int r ) const +{ + // for the last row the maximum value is always 1.0 + // for the other rows the maxumum value is the below row's value + double val = 1.0; + if ( r >= 0 && r < rowCount()-1 ) { + val = value( r+1, ArgColumn ); } + return val; } -void StdMeshersGUI_DistrTable::sortData( SMESH::double_array& arr ) +double +StdMeshersGUI_DistrTableFrame::Table:: +argStep( int /*r*/ ) const { - QValueList< QPair > aData; - if( arr.length()%2==1 ) - arr.length( arr.length()-1 ); + // correct this to provide more smart behaviour if needed + return 0.1; +} - int aLen = arr.length(); - for( int i=0; i( arr[2*i], arr[2*i+1] ) ); +double +StdMeshersGUI_DistrTableFrame::Table:: +funcMinimum( int /*r*/ ) const +{ + // correct this to provide more smart behaviour if needed + return myFuncMin; +} + +double +StdMeshersGUI_DistrTableFrame::Table:: +funcMaximum( int /*r*/ ) const +{ + // correct this to provide more smart behaviour if needed + return 1e20; +} - qHeapSort( aData ); +double +StdMeshersGUI_DistrTableFrame::Table:: +funcStep( int /*r*/ ) const +{ + // correct this to provide more smart behaviour if needed + return 1.0; +} - QValueList< QPair >::const_iterator anIt = aData.begin(), aLast = aData.end(); - QValueList unique_values; - double prev; int i=0; - if( (*anIt).first>0.0 ) - { - unique_values.append( 0.0 ); - unique_values.append( (*anIt).second ); - i++; prev = 0.0; +void +StdMeshersGUI_DistrTableFrame::Table:: +setFuncMinValue( double val ) +{ + myFuncMin = val; + + QTableWidgetItem* i = currentItem(); + if ( i && + i->row() == myEditorData.r && + i->column() == myEditorData.c && + i->column() == FuncColumn && + myEditorData.sb ) { + myEditorData.sb->setMinimum( myFuncMin ); } - for( ; anIt!=aLast; anIt++ ) - { - if( i==0 || (*anIt).first>prev ) - { - unique_values.append( (*anIt).first ); - unique_values.append( (*anIt).second ); - i++; - } - prev = (*anIt).first; + else { + closePersistentEditor( currentItem() ); } - if( prev<1.0 ) - { - unique_values.append( 1.0 ); - anIt--; - unique_values.append( (*anIt).second ); + + for ( int r = 0; r < rowCount(); r++ ) { + double v = item( r, FuncColumn )->text().toDouble(); + if ( v < myFuncMin ) + item( r, FuncColumn )->setText( QString::number( myFuncMin ) ); } +} - arr.length( unique_values.count() ); - QValueList::const_iterator anIt1 = unique_values.begin(), aLast1 = unique_values.end(); - for( int j=0; anIt1!=aLast1; anIt1++, j++ ) - arr[j] = *anIt1; +QSize +StdMeshersGUI_DistrTableFrame::Table:: +sizeHint() const +{ + if( cachedSizeHint().isValid() ) + return cachedSizeHint(); + + QSize sh = QTableWidget::sizeHint(); + if( sh.width() < 400 ) + sh.setWidth( 400 ); + if( sh.height() < 200 ) + sh.setHeight( 200 ); + + setCachedSizeHint( sh ); + return sh; } -void StdMeshersGUI_DistrTable::data( SMESH::double_array& v ) +void +StdMeshersGUI_DistrTableFrame::Table:: +addRow() { - stopEditing( true ); - v.length( 2*numRows() ); - for( int i=0; i= 0 ? currentRow() : ( rowCount() > 0 ? rowCount() - 1 : 0 ); + insertRow( r ); + + double argMin = argMinimum( r ); + double funcMin = funcMinimum( r ); + + setItem( r, ArgColumn, new QTableWidgetItem( QString::number( argMin ) ) ); + setItem( r, FuncColumn, new QTableWidgetItem( QString::number( funcMin ) ) ); } -void StdMeshersGUI_DistrTable::setData( const SMESH::double_array& d ) +void +StdMeshersGUI_DistrTableFrame::Table:: +deleteRow() { - stopEditing( false ); - setNumRows( d.length()/2 ); - QString val; - for( int i=0; ifixup( val ); - setText( i/2, i%2, val ); - } + QList selRows = selectedRows(); + for ( int r = selRows.count()-1; r >= 0; r-- ) + removeRow( r ); } -QtxDblValidator* StdMeshersGUI_DistrTable::argValidator() const +void +StdMeshersGUI_DistrTableFrame::Table:: +closeEditor( QWidget* editor, QAbstractItemDelegate::EndEditHint hint ) { - return myArgV; + myEditorData.reset(); + QTableWidget::closeEditor( editor, hint ); } -QtxDblValidator* StdMeshersGUI_DistrTable::funcValidator() const +void +StdMeshersGUI_DistrTableFrame::Table:: +setUpRows( bool autoset ) { - return myFuncV; + if ( rowCount() < 1 ) + return; + if ( autoset ) { + double s = argMaximum( rowCount()-1 ) / rowCount(); + for ( int r = 0; r < rowCount()-1; r++ ) + setValue( r, ArgColumn, r * s ); + setValue( rowCount()-1, ArgColumn, argMaximum( rowCount()-1 ) ); + } + else { + // TODO + } } -//================================================================================= -// class : StdMeshersGUI_DistrTableFrame -// purpose : -//================================================================================= -StdMeshersGUI_DistrTableFrame::StdMeshersGUI_DistrTableFrame( QWidget* parent ) -: QFrame( parent ) +QSize +StdMeshersGUI_DistrTableFrame::Table:: +cachedSizeHint() const { - QVBoxLayout* main = new QVBoxLayout( this, 0, 0 ); + return myCachedSizeHint; +} - myTable = new StdMeshersGUI_DistrTable( 1, this ); - connect( myTable, SIGNAL( valueChanged( int, int ) ), this, SIGNAL( valueChanged( int, int ) ) ); - connect( this, SIGNAL( toEdit( TableButton, int ) ), myTable, SLOT( onEdit( TableButton, int ) ) ); - - QFrame* aButFrame = new QFrame( this ); - QHBoxLayout* butLay = new QHBoxLayout( aButFrame, 5, 5 ); +void +StdMeshersGUI_DistrTableFrame::Table:: +setCachedSizeHint( const QSize& s ) const +{ + Table* that = const_cast( this ); + that->myCachedSizeHint = s; +} - myInsertRow = new QPushButton( tr( "SMESH_INSERT_ROW" ), aButFrame ); - myRemoveRow = new QPushButton( tr( "SMESH_REMOVE_ROW" ), aButFrame ); +QList +StdMeshersGUI_DistrTableFrame::Table:: +selectedRows() +{ + QList l; + QList selItems = selectedItems(); + QTableWidgetItem* i; + foreach( i, selItems ) + if ( !l.contains( i->row() ) ) l.append( i->row() ); + qSort( l ); + return l; +} - butLay->addWidget( myInsertRow, 0 ); - butLay->addWidget( myRemoveRow, 0 ); - butLay->addStretch( 1 ); +/*! + \class StdMeshersGUI_DistrTableFrame + \brief Distribution table widget +*/ - main->addWidget( myTable, 1 ); - main->addWidget( aButFrame, 0 ); +StdMeshersGUI_DistrTableFrame:: +StdMeshersGUI_DistrTableFrame( QWidget* parent ) + : QWidget( parent ) +{ + QVBoxLayout* main = new QVBoxLayout( this ); + main->setMargin( 0 ); + main->setSpacing( 0 ); - connect( myInsertRow, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) ); - connect( myRemoveRow, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) ); + // --- + myTable = new Table( this ); + connect( myTable, SIGNAL( valueChanged( int, int ) ), this, SIGNAL( valueChanged( int, int ) ) ); + + // --- + QWidget* aButFrame = new QWidget( this ); + QHBoxLayout* butLay = new QHBoxLayout( aButFrame ); + butLay->setContentsMargins( 0, SPACING, 0, SPACING ); + butLay->setSpacing( SPACING ); + + myButtons[ InsertRowBtn ] = new QPushButton( tr( "SMESH_INSERT_ROW" ), aButFrame ); + myButtons[ RemoveRowBtn ] = new QPushButton( tr( "SMESH_REMOVE_ROW" ), aButFrame ); + + butLay->addWidget( myButtons[ InsertRowBtn ] ); + butLay->addWidget( myButtons[ RemoveRowBtn ] ); + butLay->addStretch(); + + // --- + main->addWidget( myTable ); + main->addWidget( aButFrame ); + + // --- + connect( myButtons[ InsertRowBtn ], SIGNAL( clicked() ), this, SLOT( onInsert() ) ); + connect( myButtons[ RemoveRowBtn ], SIGNAL( clicked() ), this, SLOT( onRemove() ) ); + connect( myTable, SIGNAL( currentCellChanged( int, int, int, int ) ), + this, SIGNAL( currentChanged( int, int ) ) ); + connect( myTable, SIGNAL( cellChanged( int, int ) ), + this, SIGNAL( valueChanged( int, int ) ) ); } -StdMeshersGUI_DistrTableFrame::~StdMeshersGUI_DistrTableFrame() +StdMeshersGUI_DistrTableFrame:: +~StdMeshersGUI_DistrTableFrame() { } -StdMeshersGUI_DistrTable* StdMeshersGUI_DistrTableFrame::table() const +void +StdMeshersGUI_DistrTableFrame:: +showButton( const TableButton b, const bool on ) { - return myTable; + if ( button( b ) ) button( b )->setVisible( on ); } -void StdMeshersGUI_DistrTableFrame::setShown( const TableButton b, const bool sh ) +bool +StdMeshersGUI_DistrTableFrame:: +isButtonShown( const TableButton b ) const { - if( button( b ) ) - button( b )->setShown( sh ); + return button( b ) ? button( b )->isVisible() : false; +} + +void +StdMeshersGUI_DistrTableFrame:: +data( DataArray& array ) const +{ + QList d = myTable->data(); + sortData( d ); + + array.length( d.count() ); + for ( int i = 0; i < d.count(); i++ ) + array[i] = d[i]; } -bool StdMeshersGUI_DistrTableFrame::isShown( const TableButton b ) const +void +StdMeshersGUI_DistrTableFrame:: +setData( const DataArray& array ) { - bool res = false; - if( button( b ) ) - res = button( b )->isShown(); - return res; + QList d; + for ( int i = 0; i < array.length(); i++ ) + d.append( array[i] ); + + sortData( d ); + myTable->setData( d ); } -QButton* StdMeshersGUI_DistrTableFrame::button( const TableButton b ) const +void +StdMeshersGUI_DistrTableFrame:: +setFuncMinValue( double v ) { - QButton* res = 0; - switch( b ) - { - case INSERT_ROW: - res = myInsertRow; - break; + myTable->setFuncMinValue( v ); +} - case REMOVE_ROW: - res = myRemoveRow; - break; - } - return res; +QPushButton* +StdMeshersGUI_DistrTableFrame:: +button( const TableButton b ) const +{ + return myButtons.contains( b ) ? myButtons[ b ] : 0; } -void StdMeshersGUI_DistrTableFrame::onButtonClicked() +void +StdMeshersGUI_DistrTableFrame:: +onInsert() { - if( sender()==button( INSERT_ROW ) ) - emit toEdit( INSERT_ROW, table()->currentRow() ); - - else if( sender()==button( REMOVE_ROW ) ) - emit toEdit( REMOVE_ROW, table()->currentRow() ); + myTable->addRow(); } +void +StdMeshersGUI_DistrTableFrame:: +onRemove() +{ + myTable->deleteRow(); +} diff --git a/src/StdMeshersGUI/StdMeshersGUI_DistrTable.h b/src/StdMeshersGUI/StdMeshersGUI_DistrTable.h index a61db1577..5f1636ec0 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_DistrTable.h +++ b/src/StdMeshersGUI/StdMeshersGUI_DistrTable.h @@ -1,132 +1,82 @@ -// SMESH StdMeshersGUI +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : StdMeshersGUI_DistrTable.h +// Author : Open CASCADE S.A.S. // -// File : StdMeshersGUI_DistrTable.h -// Module : SMESH -// $Header$ -#ifndef StdMesherGUI_DistrTable_Header -#define StdMesherGUI_DistrTable_Header +#ifndef STDMESHERSGUI_DISTRTABLE_H +#define STDMESHERSGUI_DISTRTABLE_H +// SMESH includes #include "SMESH_StdMeshersGUI.hxx" -#include +// Qt includes +#include +#include +#include +// IDL includes #include #include CORBA_SERVER_HEADER(SMESH_Mesh) -class QButton; -class QtxDblValidator; - -/*! - * \brief Values corresponding to buttons for table resize - */ -typedef enum { INSERT_ROW, REMOVE_ROW } TableButton; +class QPushButton; -/*! - * \brief This class represents custom table. It has only double values and - editor for every cell has validator - */ -class STDMESHERSGUI_EXPORT StdMeshersGUI_DistrTable : public QTable +class StdMeshersGUI_DistrTableFrame : public QWidget { Q_OBJECT - -public: - StdMeshersGUI_DistrTable( const int rows, QWidget* = 0, const char* = 0 ); - virtual ~StdMeshersGUI_DistrTable(); - -/*! - * \brief Hides current editor of cell - */ - void stopEditing( const bool accept ); - - virtual QSize sizeHint() const; - - static void sortData( SMESH::double_array& ); - - void data( SMESH::double_array& ); - void setData( const SMESH::double_array& ); - - QtxDblValidator* argValidator() const; - QtxDblValidator* funcValidator() const; - -protected: - virtual QWidget* createEditor( int, int, bool ) const; - virtual bool eventFilter( QObject*, QEvent* ); - virtual void keyPressEvent( QKeyEvent* ); - virtual QWidget* beginEdit( int row, int col, bool replace ); - virtual void edit( const int, const int ); -private slots: - void onEdit( TableButton, int ); - -private: - QtxDblValidator *myArgV, *myFuncV; -}; + enum { ArgColumn, FuncColumn }; + class Table; + class SpinBoxDelegate; -/*! - * \brief This class represents frame for table and buttons - */ -class STDMESHERSGUI_EXPORT StdMeshersGUI_DistrTableFrame : public QFrame -{ - Q_OBJECT + typedef SMESH::double_array DataArray; public: - StdMeshersGUI_DistrTableFrame( QWidget* ); + typedef enum { InsertRowBtn, RemoveRowBtn } TableButton; + + StdMeshersGUI_DistrTableFrame( QWidget* = 0 ); ~StdMeshersGUI_DistrTableFrame(); - StdMeshersGUI_DistrTable* table() const; + void showButton( const TableButton, const bool ); + bool isButtonShown( const TableButton ) const; -/*! - * \brief Changes shown state of some button for table resize - */ - void setShown( const TableButton, const bool ); + void data( DataArray& ) const; + void setData( const DataArray& ); + + void setFuncMinValue( double ); -/*! - * \brief Returns shown state of some button for table resize - */ - bool isShown( const TableButton ) const; - private: - QButton* button( const TableButton ) const; + QPushButton* button( const TableButton ) const; private slots: - void onButtonClicked(); - + void onInsert(); + void onRemove(); + signals: -/*! - * \brief This signal is emitted if some of button for table resize is clicked - * Second parameter is current row. Take into account that - * this object resize table ( returned by table() ) automatically - */ - void toEdit( TableButton, int ); - void valueChanged( int, int ); + void valueChanged( int, int ); + void currentChanged( int, int ); private: - QButton *myInsertRow, *myRemoveRow; - StdMeshersGUI_DistrTable *myTable; + QMap myButtons; + Table* myTable; }; -#endif - +#endif // STDMESHERSGUI_DISTRTABLE_H diff --git a/src/StdMeshersGUI/StdMeshersGUI_LayerDistributionParamWdg.cxx b/src/StdMeshersGUI/StdMeshersGUI_LayerDistributionParamWdg.cxx index 6b66fa066..530c31979 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_LayerDistributionParamWdg.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_LayerDistributionParamWdg.cxx @@ -1,45 +1,44 @@ -// SMESH StdMeshersGUI +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : StdMeshersGUI_LayerDistributionParamWdg.cxx +// Author : Open CASCADE S.A.S. // -// File : StdMeshersGUI_LayerDistributionParamWdg.cxx -// Module : SMESH +// SMESH includes #include "StdMeshersGUI_LayerDistributionParamWdg.h" -#include -#include -#include -#include - -#include "SMESHGUI.h" -#include "SMESHGUI_Utils.h" -#include "SMESHGUI_HypothesesUtils.h" -#include "SMESHGUI_Hypotheses.h" -// #include "SUIT_ResourceMgr.h" -// #include "LightApp_SelectionMgr.h" -#include "SALOMEDSClient_SObject.hxx" -#include "SALOMEDS_Study.hxx" -#include "SalomeApp_Tools.h" +#include +#include +#include + +// SALOME GUI includes +#include + +// Qt includes +#include +#include +#include +#include +#include + +#define SPACING 6 //================================================================================ /*! @@ -52,7 +51,7 @@ StdMeshersGUI_LayerDistributionParamWdg ::StdMeshersGUI_LayerDistributionParamWdg(SMESH::SMESH_Hypothesis_ptr hyp, const QString& theName, QDialog* dlg): - QHGroupBox(), myName(theName), myDlg( dlg ) + QWidget(), myName(theName), myDlg( dlg ) { init(); set( hyp ); @@ -91,8 +90,6 @@ void StdMeshersGUI_LayerDistributionParamWdg::set(SMESH::SMESH_Hypothesis_ptr hy StdMeshersGUI_LayerDistributionParamWdg::~StdMeshersGUI_LayerDistributionParamWdg() { - if ( myHypTypePopup ) - delete myHypTypePopup; } //================================================================================ @@ -103,23 +100,21 @@ StdMeshersGUI_LayerDistributionParamWdg::~StdMeshersGUI_LayerDistributionParamWd void StdMeshersGUI_LayerDistributionParamWdg::init() { - setFrameStyle(QFrame::NoFrame); - setInsideMargin(0); + QHBoxLayout* aHBox = new QHBoxLayout( this ); + aHBox->setMargin( 0 ); + aHBox->setSpacing( SPACING ); mySMESHGUI = SMESHGUI::GetSMESHGUI(); - myCreateButton = new QPushButton( this, "createBut"); - myEditButton = new QPushButton( tr("EDIT"), this, "createBut"); + myCreateButton = new QPushButton( this ); + myCreateButton->setObjectName( "createBut" ); -// SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI ); -// QPixmap iconSlct ( mgr->loadPixmap("SMESH", tr("ICON_SELECT"))); -// mySelButton->setPixmap(iconSlct); -// mySelButton->setToggleButton( true ); + myEditButton = new QPushButton( tr("EDIT"), this ); + myEditButton->setObjectName( "editBut" ); - myHypTypePopup = new QPopupMenu(); + myHypTypePopup = new QMenu( this ); // Add to pop-up hypotheses of "Regular_1D" algo - myHypTypePopup->clear(); HypothesisData* algoData = SMESH::GetHypothesisData( "Regular_1D" ); myHypTypes = SMESH::GetAvailableHypotheses( false, 1 ); QStringList::const_iterator anIter = myHypTypes.begin(); @@ -128,12 +123,16 @@ void StdMeshersGUI_LayerDistributionParamWdg::init() HypothesisData* hypData = SMESH::GetHypothesisData( *anIter ); bool bidon; if ( SMESH::IsAvailableHypothesis( algoData, hypData->TypeName, bidon )) - myHypTypePopup->insertItem( hypData->Label ); + myHypTypePopup->addAction( hypData->Label ); } + aHBox->addWidget( myCreateButton ); + aHBox->addWidget( myEditButton ); + aHBox->addStretch(); + connect( myCreateButton, SIGNAL(clicked()), SLOT(onCreate())); connect( myEditButton, SIGNAL(clicked()), SLOT(onEdit())); - connect( myHypTypePopup, SIGNAL( activated( int ) ), SLOT( onHypTypePopup( int ) ) ); + connect( myHypTypePopup, SIGNAL(triggered( QAction* ) ), SLOT( onHypTypePopup( QAction* ) ) ); } //================================================================================ @@ -143,7 +142,7 @@ void StdMeshersGUI_LayerDistributionParamWdg::init() */ //================================================================================ -void StdMeshersGUI_LayerDistributionParamWdg::onHypTypePopup( int theIndex ) +void StdMeshersGUI_LayerDistributionParamWdg::onHypTypePopup( QAction* a ) { SMESH::SMESH_Gen_var gen = mySMESHGUI->GetSMESHGen(); @@ -153,16 +152,17 @@ void StdMeshersGUI_LayerDistributionParamWdg::onHypTypePopup( int theIndex ) // create a hyp HypothesisData* aHypData = 0; QStringList::const_iterator anIter = myHypTypes.begin(); + for ( ; !aHypData && anIter != myHypTypes.end(); ++anIter ) { HypothesisData* hypData = SMESH::GetHypothesisData( *anIter ); - if ( myHypTypePopup->text( theIndex ) == hypData->Label ) + if ( a->text() == hypData->Label ) aHypData = hypData; } QString aServLib = aHypData->ServerLibName; QString aHypType = aHypData->TypeName; try { - set( gen->CreateHypothesis(aHypType, aServLib)); + set( gen->CreateHypothesis(aHypType.toLatin1().data(), aServLib.toLatin1().data())); } catch (const SALOME::SALOME_Exception & S_ex) { SalomeApp_Tools::QtCatchCorbaException(S_ex); diff --git a/src/StdMeshersGUI/StdMeshersGUI_LayerDistributionParamWdg.h b/src/StdMeshersGUI/StdMeshersGUI_LayerDistributionParamWdg.h index 6c6d5f680..e3e8cd175 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_LayerDistributionParamWdg.h +++ b/src/StdMeshersGUI/StdMeshersGUI_LayerDistributionParamWdg.h @@ -1,57 +1,57 @@ -// SMESH StdMeshersGUI +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : StdMeshersGUI_LayerDistributionParamWdg.h +// Author : Open CASCADE S.A.S. // -// File : StdMeshersGUI_LayerDistributionParamWdg.h -// Module : SMESH -// $Header$ -#ifndef StdMeshersGUI_LayerDistributionParamWdg_Header -#define StdMeshersGUI_LayerDistributionParamWdg_Header +#ifndef STDMESHERSGUI_LAYERDISTRIBUTIONPARAMWGD_H +#define STDMESHERSGUI_LAYERDISTRIBUTIONPARAMWGD_H +// SMESH includes #include "SMESH_StdMeshersGUI.hxx" -#include -#include +// Qt includes +#include +#include +// IDL includes #include #include CORBA_SERVER_HEADER(SMESH_Hypothesis) class SMESHGUI; class QPushButton; -class QPopupMenu; +class QMenu; +class QAction; class QDialog; /*! * \brief Widget controlling hypothesis parameter that is another hypothesis */ -class STDMESHERSGUI_EXPORT StdMeshersGUI_LayerDistributionParamWdg : public QHGroupBox +class STDMESHERSGUI_EXPORT StdMeshersGUI_LayerDistributionParamWdg : public QWidget { Q_OBJECT public: - StdMeshersGUI_LayerDistributionParamWdg(SMESH::SMESH_Hypothesis_ptr hyp, - const QString& theName, - QDialog* dlg); + StdMeshersGUI_LayerDistributionParamWdg(SMESH::SMESH_Hypothesis_ptr, + const QString&, + QDialog*); ~StdMeshersGUI_LayerDistributionParamWdg(); SMESH::SMESH_Hypothesis_var GetHypothesis() { return myHyp; } @@ -63,11 +63,11 @@ public: private slots: void onCreate(); void onEdit(); - void onHypTypePopup( int ); + void onHypTypePopup( QAction* ); private: void init(); - void set(SMESH::SMESH_Hypothesis_ptr hyp); + void set(SMESH::SMESH_Hypothesis_ptr); private: SMESH::SMESH_Hypothesis_var myHyp; @@ -75,7 +75,7 @@ private: QPushButton* myCreateButton; QPushButton* myEditButton; - QPopupMenu* myHypTypePopup; + QMenu* myHypTypePopup; QDialog* myDlg; QString myName; QString myParamValue; @@ -83,5 +83,4 @@ private: QStringList myHypTypes; }; -#endif - +#endif // STDMESHERSGUI_LAYERDISTRIBUTIONPARAMWGD_H diff --git a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx index f5468b118..c3b5fb520 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.cxx @@ -1,46 +1,56 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : StdMeshersGUI_NbSegmentsCreator.cxx +// Author : Open CASCADE S.A.S. +// +// SMESH includes #include "StdMeshersGUI_NbSegmentsCreator.h" #include "StdMeshersGUI_DistrTable.h" #include "StdMeshersGUI_DistrPreview.h" #include #include +#include +// IDL includes #include CORBA_SERVER_HEADER(SMESH_BasicHypothesis) +// SALOME GUI includes #include - #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SPACING 6 +#define MARGIN 11 StdMeshersGUI_NbSegmentsCreator::StdMeshersGUI_NbSegmentsCreator() : StdMeshersGUI_StdHypothesisCreator( "NumberOfSegments" ), @@ -50,11 +60,11 @@ StdMeshersGUI_NbSegmentsCreator::StdMeshersGUI_NbSegmentsCreator() myTable( 0 ), myPreview( 0 ), myExpr( 0 ), + myConvBox( 0 ), myConv( 0 ), myLScale( 0 ), myLTable( 0 ), myLExpr( 0 ), - myLConv( 0 ), myInfo( 0 ), myGroupLayout( 0 ), myTableRow( 0 ), @@ -78,26 +88,24 @@ bool StdMeshersGUI_NbSegmentsCreator::checkParams() const QFrame* StdMeshersGUI_NbSegmentsCreator::buildFrame() { - QFrame* fr = new QFrame( 0, "myframe" ); - QVBoxLayout* lay = new QVBoxLayout( fr, 5, 0 ); + QFrame* fr = new QFrame(); - QGroupBox* GroupC1 = new QGroupBox( fr, "GroupC1" ); + QVBoxLayout* lay = new QVBoxLayout( fr ); + lay->setMargin( 0 ); + lay->setSpacing( 0 ); + + QGroupBox* GroupC1 = new QGroupBox( tr( "SMESH_ARGUMENTS" ), fr ); lay->addWidget( GroupC1 ); StdMeshers::StdMeshers_NumberOfSegments_var h = StdMeshers::StdMeshers_NumberOfSegments::_narrow( hypothesis() ); myPreview = new StdMeshersGUI_DistrPreview( GroupC1, h.in() ); - GroupC1->setTitle( tr( "SMESH_ARGUMENTS" ) ); - GroupC1->setColumnLayout(0, Qt::Vertical ); - GroupC1->layout()->setSpacing( 0 ); - GroupC1->layout()->setMargin( 0 ); - myGroupLayout = new QGridLayout( GroupC1->layout() ); - myGroupLayout->setAlignment( Qt::AlignTop ); - myGroupLayout->setSpacing( 6 ); - myGroupLayout->setMargin( 11 ); - myGroupLayout->setColStretch( 0, 0 ); - myGroupLayout->setColStretch( 1, 1 ); + myGroupLayout = new QGridLayout( GroupC1 ); + myGroupLayout->setSpacing( SPACING ); + myGroupLayout->setMargin( MARGIN ); + myGroupLayout->setColumnStretch( 0, 0 ); + myGroupLayout->setColumnStretch( 1, 1 ); int row = 0; // 0) name @@ -113,8 +121,8 @@ QFrame* StdMeshersGUI_NbSegmentsCreator::buildFrame() // 1) number of segments myGroupLayout->addWidget( new QLabel( tr( "SMESH_NB_SEGMENTS_PARAM" ), GroupC1 ), row, 0 ); myNbSeg = new QtxIntSpinBox( GroupC1 ); - myNbSeg->setMinValue( 1 ); - myNbSeg->setMaxValue( 9999 ); + myNbSeg->setMinimum( 1 ); + myNbSeg->setMaximum( 9999 ); myGroupLayout->addWidget( myNbSeg, row, 1 ); row++; @@ -122,11 +130,11 @@ QFrame* StdMeshersGUI_NbSegmentsCreator::buildFrame() myGroupLayout->addWidget( new QLabel( tr( "SMESH_DISTR_TYPE" ), GroupC1 ), row, 0 ); myDistr = new QtxComboBox( GroupC1 ); QStringList types; - types.append( QObject::tr( "SMESH_DISTR_REGULAR" ) ); - types.append( QObject::tr( "SMESH_DISTR_SCALE" ) ); - types.append( QObject::tr( "SMESH_DISTR_TAB" ) ); - types.append( QObject::tr( "SMESH_DISTR_EXPR" ) ); - myDistr->insertStringList( types ); + types.append( tr( "SMESH_DISTR_REGULAR" ) ); + types.append( tr( "SMESH_DISTR_SCALE" ) ); + types.append( tr( "SMESH_DISTR_TAB" ) ); + types.append( tr( "SMESH_DISTR_EXPR" ) ); + myDistr->addItems( types ); myGroupLayout->addWidget( myDistr, row, 1 ); row++; @@ -138,7 +146,7 @@ QFrame* StdMeshersGUI_NbSegmentsCreator::buildFrame() row++; myInfo = new QLabel( tr( "SMESH_FUNC_DOMAIN" ), GroupC1 ); - myGroupLayout->addMultiCellWidget( myInfo, row, row, 0, 1 ); + myGroupLayout->addWidget( myInfo, row, 0, 1, 2 ); row++; // 4) table @@ -156,18 +164,26 @@ QFrame* StdMeshersGUI_NbSegmentsCreator::buildFrame() row++; // 6) conversion (radiogroup) - myGroupLayout->addWidget( myLConv = new QLabel( tr( "SMESH_CONV_MODE" ), GroupC1 ), row, 0 ); + myConvBox = new QGroupBox( tr( "SMESH_CONV_MODE" ), GroupC1 ); myConv = new QButtonGroup( GroupC1 ); - myConv->setExclusive( true ); - myConv->setColumnLayout( 0, Qt::Vertical ); - QGridLayout* convLay = new QGridLayout( myConv->layout() ); - convLay->addWidget( new QRadioButton( tr( "SMESH_EXP_MODE" ), myConv ), 0, 0 ); - convLay->addWidget( myCutNeg = new QRadioButton( tr( "SMESH_CUT_NEG_MODE" ), myConv ), 1, 0 ); - myGroupLayout->addWidget( myConv, row, 1 ); + + QHBoxLayout* convLay = new QHBoxLayout( myConvBox ); + convLay->setMargin( MARGIN ); + convLay->setSpacing( SPACING ); + + QRadioButton* rbExp = new QRadioButton( tr( "SMESH_EXP_MODE" ), myConvBox ); + QRadioButton* myCutNeg = new QRadioButton( tr( "SMESH_CUT_NEG_MODE" ), myConvBox ); + + convLay->addWidget( rbExp ); + convLay->addWidget( myCutNeg ); + myConv->addButton( rbExp, 0 ); + myConv->addButton( myCutNeg, 1 ); + + myGroupLayout->addWidget( myConvBox, row, 0, 1, 2 ); row++; // 7) distribution preview - myGroupLayout->addMultiCellWidget( myPreview, row, row, 0, 1 ); + myGroupLayout->addWidget( myPreview, row, 0, 1, 2 ); myGroupLayout->setRowStretch( row, 1 ); myPreviewRow = row; row++; @@ -176,7 +192,7 @@ QFrame* StdMeshersGUI_NbSegmentsCreator::buildFrame() connect( myDistr, SIGNAL( activated( int ) ), this, SLOT( onValueChanged() ) ); connect( myTable, SIGNAL( valueChanged( int, int ) ), this, SLOT( onValueChanged() ) ); connect( myExpr, SIGNAL( textChanged( const QString& ) ), this, SLOT( onValueChanged() ) ); - connect( myConv, SIGNAL( clicked( int ) ), this, SLOT( onValueChanged() ) ); + connect( myConv, SIGNAL( cuttonClicked( int ) ), this, SLOT( onValueChanged() ) ); return fr; } @@ -189,11 +205,11 @@ void StdMeshersGUI_NbSegmentsCreator::retrieveParams() const if( myName ) myName->setText( data.myName ); myNbSeg->setValue( data.myNbSeg ); - myDistr->setCurrentItem( data.myDistrType ); + myDistr->setCurrentIndex( data.myDistrType ); myScale->setValue( data.myScale ); - myConv->setButton( data.myConv ); - myTable->table()->funcValidator()->setBottom(myConv->id( myConv->selected() )==0 ? -1E20 : 0); - myTable->table()->setData( data.myTable ); + myConv->button( data.myConv )->setChecked( true ); + myTable->setFuncMinValue(myConv->checkedId()==0 ? -1E20 : 0); + myTable->setData( data.myTable ); myExpr->setText( data.myExpr ); } @@ -287,7 +303,7 @@ bool StdMeshersGUI_NbSegmentsCreator::storeParamsToHypo( const NbSegmentsHypothe try { if( isCreation() ) - SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.latin1() ); + SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.toLatin1().data() ); h->SetNumberOfSegments( h_data.myNbSeg ); int distr = h_data.myDistrType; @@ -303,7 +319,7 @@ bool StdMeshersGUI_NbSegmentsCreator::storeParamsToHypo( const NbSegmentsHypothe h->SetTableFunction( h_data.myTable ); if( distr==3 ) - h->SetExpressionFunction( h_data.myExpr.latin1() ); + h->SetExpressionFunction( h_data.myExpr.toLatin1().data() ); //setting of function must follow after setConversionMode, because otherwise //the function will be checked with old conversion mode, so that it may occurs //unexpected errors for user @@ -320,17 +336,17 @@ bool StdMeshersGUI_NbSegmentsCreator::readParamsFromWidgets( NbSegmentsHypothesi { h_data.myName = myName ? myName->text() : ""; h_data.myNbSeg = myNbSeg->value(); - h_data.myDistrType = myDistr->currentItem(); - h_data.myConv = myConv->id( myConv->selected() ); + h_data.myDistrType = myDistr->currentIndex(); + h_data.myConv = myConv->checkedId(); h_data.myScale = myScale->value(); - myTable->table()->data( h_data.myTable ); + myTable->data( h_data.myTable ); h_data.myExpr = myExpr->text(); return true; } void StdMeshersGUI_NbSegmentsCreator::onValueChanged() { - int distr = myDistr->currentItem(); + int distr = myDistr->currentIndex(); /* if( distr==2 ) //table func myCutNeg->setText( tr( "SMESH_NO_CONV" ) ); @@ -339,10 +355,10 @@ void StdMeshersGUI_NbSegmentsCreator::onValueChanged() if( distr==2 && sender()==myConv ) //table func { - myTable->table()->funcValidator()->setBottom( myConv->id( myConv->selected() )==0 ? -1E20 : 0 ); + myTable->setFuncMinValue( myConv->checkedId()==0 ? -1E20 : 0 ); SMESH::double_array arr; - myTable->table()->data( arr ); - myTable->table()->setData( arr ); //update data in table + myTable->data( arr ); + myTable->setData( arr ); //update data in table } myScale->setShown( distr==1 ); @@ -352,8 +368,7 @@ void StdMeshersGUI_NbSegmentsCreator::onValueChanged() myPreview->setShown( isFunc ); myGroupLayout->setRowStretch( myPreviewRow, isFunc ? 1 : 0 ); - myConv->setShown( isFunc ); - myLConv->setShown( isFunc ); + myConvBox->setShown( isFunc ); if( distr==2 ) myTable->show(); @@ -371,12 +386,12 @@ void StdMeshersGUI_NbSegmentsCreator::onValueChanged() if( distr==2 ) //preview for table-described function { SMESH::double_array a; - myTable->table()->data( a ); + myTable->data( a ); myPreview->setParams( a, nbSeg, false ); } else if( distr==3 ) //preview for analytic-described function myPreview->setParams( myExpr->text(), nbSeg, 100, false ); if( isFunc ) - myPreview->setConversion( StdMeshersGUI_DistrPreview::Conversion( myConv->id( myConv->selected() ) ) ); + myPreview->setConversion( StdMeshersGUI_DistrPreview::Conversion( myConv->checkedId() ) ); } diff --git a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h index 7002e032e..fd50e55ad 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h +++ b/src/StdMeshersGUI/StdMeshersGUI_NbSegmentsCreator.h @@ -1,30 +1,35 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : StdMeshersGUI_NbSegmentsCreator.h +// Author : Open CASCADE S.A.S. +// -#ifndef NB_SEGMENTS_CREATOR_HEADER -#define NB_SEGMENTS_CREATOR_HEADER +#ifndef STDMESHERSGUI_NBSEGMENTSCREATOR_H +#define STDMESHERSGUI_NBSEGMENTSCREATOR_H +// SMESH includes #include "SMESH_StdMeshersGUI.hxx" #include "StdMeshersGUI_StdHypothesisCreator.h" +// IDL includes #include #include CORBA_SERVER_HEADER(SMESH_Mesh) @@ -35,6 +40,7 @@ class StdMeshersGUI_DistrTableFrame; class StdMeshersGUI_DistrPreview; class QLineEdit; class QButtonGroup; +class QGroupBox; class QGridLayout; class QRadioButton; @@ -77,11 +83,12 @@ private: StdMeshersGUI_DistrTableFrame* myTable; StdMeshersGUI_DistrPreview* myPreview; QLineEdit *myName, *myExpr; + QGroupBox* myConvBox; QButtonGroup* myConv; - QLabel *myLScale, *myLTable, *myLExpr, *myLConv, *myInfo; + QLabel *myLScale, *myLTable, *myLExpr, *myInfo; QGridLayout* myGroupLayout; int myTableRow, myPreviewRow; QRadioButton* myCutNeg; }; -#endif +#endif // STDMESHERSGUI_NBSEGMENTSCREATOR_H diff --git a/src/StdMeshersGUI/StdMeshersGUI_ObjectReferenceParamWdg.cxx b/src/StdMeshersGUI/StdMeshersGUI_ObjectReferenceParamWdg.cxx index 85ec4d6b4..fdcede76b 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_ObjectReferenceParamWdg.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_ObjectReferenceParamWdg.cxx @@ -1,44 +1,48 @@ -// SMESH StdMeshersGUI +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : StdMeshersGUI_ObjectReferenceParamWdg.cxx +// Author : Open CASCADE S.A.S. // -// File : StdMeshersGUI_ObjectReferenceParamWdg.cxx -// Module : SMESH +// SMESH includes #include "StdMeshersGUI_ObjectReferenceParamWdg.h" -#include -#include -#include +#include +#include +#include + +// SALOME GUI includes +#include +#include +#include +#include -#include "SMESHGUI.h" -#include "SMESHGUI_Utils.h" -#include "SMESHGUI_VTKUtils.h" -#include "SMESH_TypeFilter.hxx" -#include "SUIT_ResourceMgr.h" -#include "LightApp_SelectionMgr.h" -#include "SVTK_ViewWindow.h" -#include "SALOME_ListIO.hxx" -#include "SALOMEDSClient_SObject.hxx" +// SALOME KERNEL incldues +#include + +// Qt includes +#include +#include +#include + +#define SPACING 6 //================================================================================ /*! @@ -49,7 +53,7 @@ StdMeshersGUI_ObjectReferenceParamWdg::StdMeshersGUI_ObjectReferenceParamWdg ( SUIT_SelectionFilter* f, QWidget* parent) - : QHGroupBox( parent ) + : QWidget( parent ) { myFilter = f; init(); @@ -64,7 +68,7 @@ StdMeshersGUI_ObjectReferenceParamWdg::StdMeshersGUI_ObjectReferenceParamWdg StdMeshersGUI_ObjectReferenceParamWdg::StdMeshersGUI_ObjectReferenceParamWdg ( MeshObjectType objType, QWidget* parent ) - : QHGroupBox( parent ) + : QWidget( parent ) { myFilter = new SMESH_TypeFilter( objType ); init(); @@ -90,8 +94,10 @@ StdMeshersGUI_ObjectReferenceParamWdg::~StdMeshersGUI_ObjectReferenceParamWdg() void StdMeshersGUI_ObjectReferenceParamWdg::init() { - setFrameStyle(QFrame::NoFrame); - setInsideMargin(0); + QHBoxLayout* aHBox = new QHBoxLayout(this); + + aHBox->setMargin(0); + aHBox->setSpacing(SPACING); mySMESHGUI = SMESHGUI::GetSMESHGUI(); mySelectionMgr = SMESH::GetSelectionMgr( mySMESHGUI ); @@ -102,12 +108,16 @@ void StdMeshersGUI_ObjectReferenceParamWdg::init() QPixmap iconSlct ( mgr->loadPixmap("SMESH", tr("ICON_SELECT"))); mySelButton = new QPushButton(this); - mySelButton->setPixmap(iconSlct); - mySelButton->setToggleButton( true ); + mySelButton->setIcon(iconSlct); + mySelButton->setCheckable( true ); myObjNameLineEdit = new QLineEdit(this); myObjNameLineEdit->setReadOnly(true); + aHBox->addWidget( mySelButton ); + aHBox->addWidget( myObjNameLineEdit ); + aHBox->addStretch(); + connect( mySelButton, SIGNAL(clicked()), SLOT(activateSelection())); } @@ -131,7 +141,7 @@ void StdMeshersGUI_ObjectReferenceParamWdg::activateSelection() } emit selectionActivated(); - mySelButton->setOn( mySelectionActivated ); + mySelButton->setChecked( mySelectionActivated ); } //================================================================================ @@ -146,7 +156,7 @@ void StdMeshersGUI_ObjectReferenceParamWdg::deactivateSelection() disconnect(mySelectionMgr, 0, this, 0 ); mySelectionMgr->removeFilter( myFilter ); - mySelButton->setOn( mySelectionActivated ); + mySelButton->setChecked( mySelectionActivated ); } //================================================================================ @@ -183,7 +193,7 @@ void StdMeshersGUI_ObjectReferenceParamWdg::SetObject(CORBA::Object_ptr obj) string name = sobj->GetName(); myObjNameLineEdit->setText( name.c_str() ); myObject = CORBA::Object::_duplicate( obj ); - myParamValue = sobj->GetID(); + myParamValue = sobj->GetID().c_str(); } } diff --git a/src/StdMeshersGUI/StdMeshersGUI_ObjectReferenceParamWdg.h b/src/StdMeshersGUI/StdMeshersGUI_ObjectReferenceParamWdg.h index e2b892f79..c32abc653 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_ObjectReferenceParamWdg.h +++ b/src/StdMeshersGUI/StdMeshersGUI_ObjectReferenceParamWdg.h @@ -1,38 +1,38 @@ -// SMESH StdMeshersGUI +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : StdMeshersGUI_ObjectReferenceParamWdg.h +// Author : Open CASCADE S.A.S. // -// File : StdMeshersGUI_ObjectReferenceParamWdg.h -// Module : SMESH -// $Header$ -#ifndef StdMeshersGUI_ObjectReferenceParamWdg_Header -#define StdMeshersGUI_ObjectReferenceParamWdg_Header +#ifndef STDMESHERSGUI_OBJECTREFERENCEPARAMWDG_H +#define STDMESHERSGUI_OBJECTREFERENCEPARAMWDG_H +// SMESH includes #include "SMESH_StdMeshersGUI.hxx" -#include "SMESH_Type.h" -#include "qhgroupbox.h" +#include + +// Qt includes +#include +// CORBA includes #include class SUIT_SelectionFilter; @@ -44,7 +44,7 @@ class QPushButton; /*! * \brief Widget controlling hypothesis parameter that is an object reference */ -class STDMESHERSGUI_EXPORT StdMeshersGUI_ObjectReferenceParamWdg : public QHGroupBox +class STDMESHERSGUI_EXPORT StdMeshersGUI_ObjectReferenceParamWdg : public QWidget { Q_OBJECT @@ -107,5 +107,4 @@ private: QString myParamValue; }; -#endif - +#endif // STDMESHERSGUI_OBJECTREFERENCEPARAMWDG_H diff --git a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx index b92bdeac9..2daf8bd25 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx @@ -1,52 +1,50 @@ -// SMESH StdMeshersGUI : GUI for plugged-in meshers +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// Copyright (C) 2003 CEA -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : StdMeshersGUI_StdHypothesisCreator.cxx +// Author : Alexander SOLOVYOV, Open CASCADE S.A.S. // -// File : StdMeshersGUI_StdHypothesisCreator.cxx -// Author : Alexander SOLOVYOV -// Module : SMESH -// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.cxx +// SMESH includes #include "StdMeshersGUI_StdHypothesisCreator.h" -#include "SMESHGUI.h" -#include "SMESHGUI_SpinBox.h" -#include "SMESHGUI_HypothesesUtils.h" -#include "SMESHGUI_Utils.h" -#include "SMESH_TypeFilter.hxx" -#include "SMESH_NumberFilter.hxx" -#include "StdMeshersGUI_ObjectReferenceParamWdg.h" -#include "StdMeshersGUI_LayerDistributionParamWdg.h" +#include +#include +#include +#include +#include +#include +#include +#include -#include "SUIT_ResourceMgr.h" +// SALOME GUI includes +#include +// IDL includes #include #include CORBA_SERVER_HEADER(SMESH_BasicHypothesis) #include CORBA_SERVER_HEADER(SMESH_Mesh) -#include -#include -#include -#include - +// Qt includes +#include +#include +#include const double VALUE_MAX = 1.0e+15, // COORD_MAX VALUE_MAX_2 = VALUE_MAX * VALUE_MAX, @@ -91,16 +89,16 @@ QWidget* StdMeshersGUI_StdHypothesisCreator::getWidgetForParam( int i ) const if ( isCreation() ) ++i; // skip widget of 'name' parameter if ( i < myCustomWidgets.count() ) { - QPtrList::const_iterator anIt = myCustomWidgets.begin(); - QPtrList::const_iterator aLast = myCustomWidgets.end(); + QList::const_iterator anIt = myCustomWidgets.begin(); + QList::const_iterator aLast = myCustomWidgets.end(); for ( int j = 0 ; !w && anIt != aLast; ++anIt ) if ( i == j ) w = *anIt; } if ( !w ) { // list has no at() const, so we iterate - QPtrList::const_iterator anIt = widgets().begin(); - QPtrList::const_iterator aLast = widgets().end(); + QList::const_iterator anIt = widgets().begin(); + QList::const_iterator aLast = widgets().end(); for( int j = 0; !w && anIt!=aLast; anIt++, ++j ) { if ( i == j ) w = *anIt; @@ -180,20 +178,37 @@ namespace { */ //================================================================================ - class TDoubleSliderWith2Lables: public QHBox + class TDoubleSliderWith2Lables: public QWidget { public: TDoubleSliderWith2Lables( const QString& leftLabel, const QString& rightLabel, const double initValue, const double bottom, const double top , const double precision, QWidget * parent=0 , const char * name=0 ) - :QHBox(parent,name), _bottom(bottom), _precision(precision) + :QWidget(parent), _bottom(bottom), _precision(precision) { - if ( !leftLabel.isEmpty() ) (new QLabel( this ))->setText( leftLabel ); - _slider = new QSlider( Horizontal, this ); + setObjectName(name); + + QHBoxLayout* aHBoxL = new QHBoxLayout(this); + + if ( !leftLabel.isEmpty() ) { + QLabel* aLeftLabel = new QLabel( this ); + aLeftLabel->setText( leftLabel ); + aHBoxL->addWidget( aLeftLabel ); + } + + _slider = new QSlider( Qt::Horizontal, this ); _slider->setRange( 0, toInt( top )); _slider->setValue( toInt( initValue )); - if ( !rightLabel.isEmpty() ) (new QLabel( this ))->setText( rightLabel ); + aHBoxL->addWidget( _slider ); + + if ( !rightLabel.isEmpty() ) { + QLabel* aRightLabel = new QLabel( this ); + aRightLabel->setText( rightLabel ); + aHBoxL->addWidget( aRightLabel ); + } + + setLayout( aHBoxL ); } double value() const { return _bottom + _slider->value() * _precision; } QSlider * getSlider() const { return _slider; } @@ -298,11 +313,11 @@ namespace { */ //================================================================================ - void deactivateObjRefParamWdg( QPtrList* widgetList ) + void deactivateObjRefParamWdg( QList* widgetList ) { StdMeshersGUI_ObjectReferenceParamWdg* w = 0; - QPtrList::iterator anIt = widgetList->begin(); - QPtrList::iterator aLast = widgetList->end(); + QList::iterator anIt = widgetList->begin(); + QList::iterator aLast = widgetList->end(); for ( ; anIt != aLast; anIt++ ) { if ( (*anIt) && (*anIt)->inherits( "StdMeshersGUI_ObjectReferenceParamWdg" )) { @@ -374,8 +389,8 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const bool res = getStdParamFromDlg( params ); if( isCreation() ) { - SMESH::SetName( SMESH::FindSObject( hypothesis() ), params[0].myValue.toString().latin1() ); - params.remove( params.begin() ); + SMESH::SetName( SMESH::FindSObject( hypothesis() ), params[0].myValue.toString().toLatin1().data() ); + params.erase( params.begin() ); } QString valueStr = stdParamValues( params ); @@ -713,9 +728,9 @@ void StdMeshersGUI_StdHypothesisCreator::attuneStdWidget (QWidget* w, const int) SMESHGUI_SpinBox* sb = w->inherits( "SMESHGUI_SpinBox" ) ? ( SMESHGUI_SpinBox* )w : 0; if( hypType()=="LocalLength" && sb ) { - if (sb->name() == tr("SMESH_LOCAL_LENGTH_PARAM")) + if (sb->objectName() == tr("SMESH_LOCAL_LENGTH_PARAM")) sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, 6 ); - else if (sb->name() == tr("SMESH_LOCAL_LENGTH_PRECISION")) + else if (sb->objectName() == tr("SMESH_LOCAL_LENGTH_PRECISION")) sb->RangeStepAndValidator( 0.0, 1.0, 0.05, 6 ); } else if( hypType()=="Arithmetic1D" && sb ) @@ -753,7 +768,7 @@ void StdMeshersGUI_StdHypothesisCreator::attuneStdWidget (QWidget* w, const int) QString StdMeshersGUI_StdHypothesisCreator::caption() const { - return tr( QString( "SMESH_%1_TITLE" ).arg( hypTypeName( hypType() ) ) ); + return tr( QString( "SMESH_%1_TITLE" ).arg( hypTypeName( hypType() ) ).toLatin1().data() ); } //================================================================================ @@ -765,7 +780,7 @@ QString StdMeshersGUI_StdHypothesisCreator::caption() const QPixmap StdMeshersGUI_StdHypothesisCreator::icon() const { - QString hypIconName = tr( QString( "ICON_DLG_%1" ).arg( hypTypeName( hypType() ) ) ); + QString hypIconName = tr( QString( "ICON_DLG_%1" ).arg( hypTypeName( hypType() ) ).toLatin1().data() ); return SMESHGUI::resourceMgr()->loadPixmap( "SMESH", hypIconName ); } @@ -778,7 +793,7 @@ QPixmap StdMeshersGUI_StdHypothesisCreator::icon() const QString StdMeshersGUI_StdHypothesisCreator::type() const { - return tr( QString( "SMESH_%1_HYPOTHESIS" ).arg( hypTypeName( hypType() ) ) ); + return tr( QString( "SMESH_%1_HYPOTHESIS" ).arg( hypTypeName( hypType() ) ).toLatin1().data() ); } //================================================================================ @@ -831,8 +846,10 @@ QWidget* StdMeshersGUI_StdHypothesisCreator::getCustomWidget( const StdParam & p QWidget* w = 0; if ( index < customWidgets()->count() ) { w = customWidgets()->at( index ); - if ( w ) - w->reparent( parent, QPoint( 0, 0 )); + if ( w ) { + w->setParent( parent ); + w->move( QPoint( 0, 0 ) ); + } } return w; } diff --git a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.h b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.h index 29ed2e2ac..501e7aa91 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.h +++ b/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.h @@ -1,33 +1,30 @@ -// SMESH StdMeshersGUI : GUI for plugged-in meshers +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// Copyright (C) 2003 CEA -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// File : StdMeshersGUI_StdHypothesisCreator.h +// Author : Alexander SOLOVYOV, Open CASCADE S.A.S. // -// File : StdMeshersGUI_StdHypothesisCreator.h -// Author : Alexander SOLOVYOV -// Module : SMESH -// $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshersGUI/StdMeshersGUI_StdHypothesisCreator.h -#ifndef STDMESHERSGUI_StdHypothesisCreator_HeaderFile -#define STDMESHERSGUI_StdHypothesisCreator_HeaderFile +#ifndef STDMESHERSGUI_STDHYPOTHESISCREATOR_H +#define STDMESHERSGUI_STDHYPOTHESISCREATOR_H +// SMESH includes #include "SMESH_StdMeshersGUI.hxx" #include @@ -70,4 +67,4 @@ protected: ListOfWidgets myCustomWidgets; }; -#endif +#endif // STDMESHERSGUI_STDHYPOTHESISCREATOR_H diff --git a/src/StdMeshersGUI/StdMeshers_images.ts b/src/StdMeshersGUI/StdMeshers_images.ts new file mode 100644 index 000000000..19730e508 --- /dev/null +++ b/src/StdMeshersGUI/StdMeshers_images.ts @@ -0,0 +1,190 @@ + + + + @default + + ICON_DLG_ARITHMETIC_1D + mesh_hypo_length.png + + + ICON_DLG_AUTOMATIC_LENGTH + mesh_hypo_length.png + + + ICON_DLG_DEFLECTION1D + mesh_hypo_length.png + + + ICON_DLG_GEOMETRIC_1D + mesh_hypo_length.png + + + ICON_DLG_LAYER_DISTRIBUTION + mesh_hypo_layer_distribution.png + + + ICON_DLG_LOCAL_LENGTH + mesh_hypo_length.png + + + ICON_DLG_MAX_ELEMENT_AREA + mesh_hypo_area.png + + + ICON_DLG_MAX_ELEMENT_VOLUME + mesh_hypo_volume.png + + + ICON_DLG_NB_SEGMENTS + mesh_hypo_segment.png + + + ICON_DLG_NUMBER_OF_LAYERS + mesh_hypo_layer_distribution.png + + + ICON_DLG_PROJECTION_SOURCE_1D + mesh_hypo_source_edge.png + + + ICON_DLG_PROJECTION_SOURCE_2D + mesh_hypo_source_face.png + + + ICON_DLG_PROJECTION_SOURCE_3D + mesh_hypo_source_3d.png + + + ICON_DLG_SEGMENT_LENGTH_AROUND_VERTEX + mesh_hypo_length.png + + + ICON_DLG_START_END_LENGTH + mesh_hypo_length.png + + + ICON_SELECT + select1.png + + + ICON_SMESH_TREE_ALGO_CompositeSegment_1D + mesh_tree_algo_regular.png + + + ICON_SMESH_TREE_ALGO_Hexa_3D + mesh_tree_algo_hexa.png + + + ICON_SMESH_TREE_ALGO_MEFISTO_2D + mesh_tree_algo_mefisto.png + + + ICON_SMESH_TREE_ALGO_Prism_3D + mesh_tree_algo_projection_3d.png + + + ICON_SMESH_TREE_ALGO_Projection_1D + mesh_tree_algo_regular.png + + + ICON_SMESH_TREE_ALGO_Projection_2D + mesh_tree_algo_projection_2d.png + + + ICON_SMESH_TREE_ALGO_Projection_3D + mesh_tree_hypo_projection_3d.png + + + ICON_SMESH_TREE_ALGO_Quadrangle_2D + mesh_tree_algo_quad.png + + + ICON_SMESH_TREE_ALGO_RadialPrism_3D + mesh_tree_algo_radial_prism.png + + + ICON_SMESH_TREE_ALGO_Regular_1D + mesh_tree_algo_regular.png + + + ICON_SMESH_TREE_ALGO_SegmentAroundVertex_0D + mesh_tree_algo_regular.png + + + ICON_SMESH_TREE_HYPO_Arithmetic1D + mesh_tree_hypo_length.png + + + ICON_SMESH_TREE_HYPO_AutomaticLength + mesh_tree_hypo_length.png + + + ICON_SMESH_TREE_HYPO_Deflection1D + mesh_tree_hypo_length.png + + + ICON_SMESH_TREE_HYPO_LayerDistribution + mesh_tree_hypo_layers_distribution.png + + + ICON_SMESH_TREE_HYPO_LengthFromEdges + mesh_tree_hypo_area.png + + + ICON_SMESH_TREE_HYPO_LocalLength + mesh_tree_hypo_length.png + + + ICON_SMESH_TREE_HYPO_MaxElementArea + mesh_tree_hypo_area.png + + + ICON_SMESH_TREE_HYPO_MaxElementVolume + mesh_tree_hypo_volume.png + + + ICON_SMESH_TREE_HYPO_NotConformAllowed + mesh_tree_hypo_length.png + + + ICON_SMESH_TREE_HYPO_NumberOfLayers + mesh_tree_hypo_layers_distribution.png + + + ICON_SMESH_TREE_HYPO_NumberOfSegments + mesh_tree_hypo_segment.png + + + ICON_SMESH_TREE_HYPO_ProjectionSource1D + mesh_tree_hypo_source_edge.png + + + ICON_SMESH_TREE_HYPO_ProjectionSource2D + mesh_tree_hypo_source_face.png + + + ICON_SMESH_TREE_HYPO_ProjectionSource3D + mesh_tree_hypo_source_3d_shape.png + + + ICON_SMESH_TREE_HYPO_Propagation + mesh_tree_hypo_length.png + + + ICON_SMESH_TREE_HYPO_QuadranglePreference + mesh_tree_algo_quad.png + + + ICON_SMESH_TREE_HYPO_QuadraticMesh + mesh_tree_hypo_length.png + + + ICON_SMESH_TREE_HYPO_SegmentLengthAroundVertex + mesh_tree_hypo_length.png + + + ICON_SMESH_TREE_HYPO_StartEndLength + mesh_tree_hypo_length.png + + + diff --git a/src/StdMeshersGUI/StdMeshers_msg_en.ts b/src/StdMeshersGUI/StdMeshers_msg_en.ts new file mode 100644 index 000000000..723f5ffaf --- /dev/null +++ b/src/StdMeshersGUI/StdMeshers_msg_en.ts @@ -0,0 +1,297 @@ + + + + @default + + SMESH_ARITHMETIC_1D_HYPOTHESIS + Arithmetic 1D + + + SMESH_ARITHMETIC_1D_PARAM + Arithmetic Reason + + + SMESH_ARITHMETIC_1D_TITLE + Hypothesis Construction + + + SMESH_AUTOMATIC_LENGTH_HYPOTHESIS + Automatic Length + + + SMESH_AUTOMATIC_LENGTH_TITLE + Hypothesis Construction + + + SMESH_CONV_MODE + Conversion mode + + + SMESH_CUT_NEG_MODE + Cut negative + + + SMESH_DEFLECTION1D_HYPOTHESIS + Deflection 1D + + + SMESH_DEFLECTION1D_PARAM + Deflection + + + SMESH_DEFLECTION1D_TITLE + Hypothesis Construction + + + SMESH_DENSITY_FUNC + Density function + + + SMESH_DISTR + Distribution + + + SMESH_DISTR_EXPR + Distribution with analitic density + + + SMESH_DISTR_REGULAR + Equidistant distribution + + + SMESH_DISTR_SCALE + Scale distribution + + + SMESH_DISTR_TAB + Distribution with table density + + + SMESH_DISTR_TYPE + Type of distribution + + + SMESH_END_LENGTH_PARAM + End Length + + + SMESH_EXPR_FUNC + Density function f(t) = + + + SMESH_EXP_MODE + Exponent + + + SMESH_FINENESS_PARAM + Fineness + + + SMESH_FUNC_DOMAIN + Warning: function must be defined on segment [0..1] + + + SMESH_INSERT_ROW + Insert row + + + SMESH_INVALID_FUNCTION + Function is invalid + + + SMESH_LAYERS_DISTRIBUTION + 1D Hypothesis + + + SMESH_LAYER_DISTRIBUTION_HYPOTHESIS + Distribution of Layers + + + SMESH_LAYER_DISTRIBUTION_TITLE + Hypothesis Construction + + + SMESH_LOCAL_LENGTH_HYPOTHESIS + Average Length + + + SMESH_LOCAL_LENGTH_PARAM + Length + + + SMESH_LOCAL_LENGTH_PRECISION + Precision + + + SMESH_LOCAL_LENGTH_TITLE + Hypothesis Construction + + + SMESH_MAX_ELEMENT_AREA_HYPOTHESIS + Max. Element Area + + + SMESH_MAX_ELEMENT_AREA_PARAM + Max. Area + + + SMESH_MAX_ELEMENT_AREA_TITLE + Hypothesis Construction + + + SMESH_MAX_ELEMENT_VOLUME_HYPOTHESIS + Max. Element Volume + + + SMESH_MAX_ELEMENT_VOLUME_PARAM + Max. Volume + + + SMESH_MAX_ELEMENT_VOLUME_TITLE + Hypothesis Construction + + + SMESH_NB_SEGMENTS_HYPOTHESIS + Number of Segments + + + SMESH_NB_SEGMENTS_PARAM + Number of Segments + + + SMESH_NB_SEGMENTS_SCALE_PARAM + Scale Factor + + + SMESH_NB_SEGMENTS_TITLE + Hypothesis Construction + + + SMESH_NO_CONV + No conversion + + + SMESH_NUMBER_OF_LAYERS + Number of Layers + + + SMESH_NUMBER_OF_LAYERS_HYPOTHESIS + Radial Prism Parameter + + + SMESH_NUMBER_OF_LAYERS_TITLE + Hypothesis Construction + + + SMESH_PROJECTION_SOURCE_1D_HYPOTHESIS + Projection Source 1D + + + SMESH_PROJECTION_SOURCE_1D_TITLE + Hypothesis Construction + + + SMESH_PROJECTION_SOURCE_2D_HYPOTHESIS + Projection Source 2D + + + SMESH_PROJECTION_SOURCE_2D_TITLE + Hypothesis Construction + + + SMESH_PROJECTION_SOURCE_3D_HYPOTHESIS + Projection Source 3D + + + SMESH_PROJECTION_SOURCE_3D_TITLE + Hypothesis Construction + + + SMESH_REMOVE_ROW + Remove row + + + SMESH_SEGMENT_LENGTH_AROUND_VERTEX_HYPOTHESIS + Segment Length Around Vertex + + + SMESH_SEGMENT_LENGTH_AROUND_VERTEX_PARAM + Length + + + SMESH_SEGMENT_LENGTH_AROUND_VERTEX_TITLE + Hypothesis Construction + + + SMESH_SOURCE_3DSHAPE + 3D shape + + + SMESH_SOURCE_EDGE + Edge + + + SMESH_SOURCE_FACE + Face + + + SMESH_SOURCE_MESH + Mesh + + + SMESH_SOURCE_VERTEX + Source Vertex + + + SMESH_SOURCE_VERTEX1 + Source Vertex 1 + + + SMESH_SOURCE_VERTEX2 + Source Vertex 2 + + + SMESH_START_END_LENGTH_HYPOTHESIS + Start and End local Length + + + SMESH_START_END_LENGTH_TITLE + Hypothesis Construction + + + SMESH_START_LENGTH_PARAM + Start Length + + + SMESH_TAB_FUNC + Table function + + + SMESH_TARGET_VERTEX + Target Vertex + + + SMESH_TARGET_VERTEX1 + Target Vertex 1 + + + SMESH_TARGET_VERTEX2 + Target Vertex 2 + + + + StdMeshersGUI_LayerDistributionParamWdg + + CHANGE_TYPE + Change Type + + + CREATE + Create + + + EDIT + Edit + + + -- 2.39.2