From 59d291266c151816721ef67d703f39ba722715f0 Mon Sep 17 00:00:00 2001 From: admin Date: Thu, 28 Aug 2008 09:42:55 +0000 Subject: [PATCH] This commit was generated by cvs2git to create branch 'For_CTH_V14'. Sprout from BR_QT4_Dev 2008-08-28 09:42:54 UTC abd 'Fix compilation problems on Win32 platform' Delete: src/CAF/CAF.h src/CAF/CAF.pro src/CAF/CAF_Application.cxx src/CAF/CAF_Application.h src/CAF/CAF_Operation.cxx src/CAF/CAF_Operation.h src/CAF/CAF_Study.cxx src/CAF/CAF_Study.h src/CAF/CAF_Tools.cxx src/CAF/CAF_Tools.h src/CAF/Makefile.am src/CAF/resources/CAF_images.po src/CAF/resources/CAF_msg_en.po src/CAF/resources/CAF_msg_en.ts src/CASCatch/CASCatch.hxx src/CASCatch/CASCatch_CatchSignals.cxx src/CASCatch/CASCatch_CatchSignals.hxx src/CASCatch/CASCatch_ErrorHandler.cxx src/CASCatch/CASCatch_ErrorHandler.hxx src/CASCatch/CASCatch_Failure.cxx src/CASCatch/CASCatch_Failure.hxx src/CASCatch/Makefile.am src/OCCViewer/Makefile.am src/OCCViewer/OCCViewer.cxx src/OCCViewer/OCCViewer.h src/OCCViewer/OCCViewer.pro src/OCCViewer/OCCViewer_AISSelector.cxx src/OCCViewer/OCCViewer_AISSelector.h src/OCCViewer/OCCViewer_AxialScaleDlg.cxx src/OCCViewer/OCCViewer_AxialScaleDlg.h src/OCCViewer/OCCViewer_ClippingDlg.cxx src/OCCViewer/OCCViewer_ClippingDlg.h src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx src/OCCViewer/OCCViewer_CreateRestoreViewDlg.h src/OCCViewer/OCCViewer_SetRotationPointDlg.cxx src/OCCViewer/OCCViewer_SetRotationPointDlg.h src/OCCViewer/OCCViewer_Trihedron.cxx src/OCCViewer/OCCViewer_Trihedron.h src/OCCViewer/OCCViewer_VService.cxx src/OCCViewer/OCCViewer_VService.h src/OCCViewer/OCCViewer_ViewManager.cxx src/OCCViewer/OCCViewer_ViewManager.h src/OCCViewer/OCCViewer_ViewModel.cxx src/OCCViewer/OCCViewer_ViewModel.h src/OCCViewer/OCCViewer_ViewPort.cxx src/OCCViewer/OCCViewer_ViewPort.h src/OCCViewer/OCCViewer_ViewPort3d.cxx src/OCCViewer/OCCViewer_ViewPort3d.h src/OCCViewer/OCCViewer_ViewSketcher.cxx src/OCCViewer/OCCViewer_ViewSketcher.h src/OCCViewer/OCCViewer_ViewWindow.cxx src/OCCViewer/OCCViewer_ViewWindow.h src/OCCViewer/resources/OCCViewer_images.po src/OCCViewer/resources/OCCViewer_images.ts src/OCCViewer/resources/OCCViewer_msg_en.po src/OCCViewer/resources/OCCViewer_msg_en.ts src/OCCViewer/resources/occ_view_back.png src/OCCViewer/resources/occ_view_bottom.png src/OCCViewer/resources/occ_view_camera_dump.png src/OCCViewer/resources/occ_view_clipping.png src/OCCViewer/resources/occ_view_clipping_pressed.png src/OCCViewer/resources/occ_view_clone.png src/OCCViewer/resources/occ_view_fitall.png src/OCCViewer/resources/occ_view_fitarea.png src/OCCViewer/resources/occ_view_front.png src/OCCViewer/resources/occ_view_glpan.png src/OCCViewer/resources/occ_view_left.png src/OCCViewer/resources/occ_view_pan.png src/OCCViewer/resources/occ_view_presets.png src/OCCViewer/resources/occ_view_reset.png src/OCCViewer/resources/occ_view_right.png src/OCCViewer/resources/occ_view_rotate.png src/OCCViewer/resources/occ_view_rotation_point.png src/OCCViewer/resources/occ_view_scaling.png src/OCCViewer/resources/occ_view_shoot.png src/OCCViewer/resources/occ_view_top.png src/OCCViewer/resources/occ_view_triedre.png src/OCCViewer/resources/occ_view_zoom.png src/PyConsole/Makefile.am src/PyConsole/PyConsole.h src/PyConsole/PyConsole.pro src/PyConsole/PyConsole_Console.cxx src/PyConsole/PyConsole_Console.h src/PyConsole/PyConsole_Editor.cxx src/PyConsole/PyConsole_Editor.h src/PyConsole/PyConsole_Interp.cxx src/PyConsole/PyConsole_Interp.h src/PyConsole/resources/PyConsole_msg_en.ts src/PyInterp/Makefile.am src/PyInterp/PyInterp.h src/PyInterp/PyInterp.pro src/PyInterp/PyInterp_Dispatcher.cxx src/PyInterp/PyInterp_Dispatcher.h src/PyInterp/PyInterp_Interp.cxx src/PyInterp/PyInterp_Interp.h src/PyInterp/PyInterp_Watcher.h src/QxGraph/Makefile.am src/QxGraph/QxGraph.h src/QxGraph/QxGraph.pro src/QxGraph/QxGraph_ActiveItem.h src/QxGraph/QxGraph_Canvas.cxx src/QxGraph/QxGraph_Canvas.h src/QxGraph/QxGraph_CanvasView.cxx src/QxGraph/QxGraph_CanvasView.h src/QxGraph/QxGraph_Def.h src/QxGraph/QxGraph_Prs.cxx src/QxGraph/QxGraph_Prs.h src/QxGraph/QxGraph_ViewManager.cxx src/QxGraph/QxGraph_ViewManager.h src/QxGraph/QxGraph_ViewModel.cxx src/QxGraph/QxGraph_ViewModel.h src/QxGraph/QxGraph_ViewWindow.cxx src/QxGraph/QxGraph_ViewWindow.h src/QxGraph/resources/QxGraph_images.po src/QxGraph/resources/QxGraph_images.ts src/QxGraph/resources/QxGraph_msg_en.po src/QxGraph/resources/QxGraph_msg_en.ts src/QxGraph/resources/qx_view_fitall.png src/QxGraph/resources/qx_view_fitarea.png src/QxGraph/resources/qx_view_glpan.png src/QxGraph/resources/qx_view_pan.png src/QxGraph/resources/qx_view_reset.png src/QxGraph/resources/qx_view_zoom.png src/ResExporter/Makefile.am src/ResExporter/ResExporter.pro src/ResExporter/ResourceExporter.cxx src/SALOME_PY/Makefile.am src/SALOME_PY/SalomePy.cxx src/SALOME_PYQT/Makefile.am src/SALOME_PYQT/SALOME_PYQT_GUI/Makefile.am src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_GUI.h src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_GUI.sip src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.h src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.cxx src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.h src/SALOME_PYQT/SalomePyQt/Makefile.am src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx src/SALOME_PYQT/SalomePyQt/SalomePyQt.h src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip src/SALOME_SWIG/Help.py src/SALOME_SWIG/Makefile.am src/SALOME_SWIG/PyInterp.py src/SALOME_SWIG/SALOMEGUI_Swig.cxx src/SALOME_SWIG/SALOMEGUI_Swig.hxx src/SALOME_SWIG/SALOMEGUI_Swig.i src/SALOME_SWIG/SALOMEGUI_shared_modules.py src/SALOME_SWIG/examplevtk1.py src/SALOME_SWIG/libSALOME_Swig.i src/SALOME_SWIG/salome.py src/SALOME_SWIG/supervisionexample.py.in src/SALOME_SWIG/supervisiongeomexample.py.in src/SALOME_SWIG/test_big_table.py src/SALOME_SWIG/test_many_objects.py src/SALOME_SWIG/test_remove_ref.py src/SALOME_SWIG/test_table.py src/SOCC/Makefile.am src/SOCC/SOCC.h src/SOCC/SOCC.pro src/SOCC/SOCC_Prs.cxx src/SOCC/SOCC_Prs.h src/SOCC/SOCC_ViewModel.cxx src/SOCC/SOCC_ViewModel.h src/SOCC/SOCC_ViewWindow.cxx src/SOCC/SOCC_ViewWindow.h src/SUPERVGraph/Makefile.am src/SUPERVGraph/SUPERVGraph.cxx src/SUPERVGraph/SUPERVGraph.h src/SUPERVGraph/SUPERVGraph.pro src/SUPERVGraph/SUPERVGraph_ViewFrame.cxx src/SUPERVGraph/SUPERVGraph_ViewFrame.h src/SUPERVGraph/SUPERVGraph_ViewManager.cxx src/SUPERVGraph/SUPERVGraph_ViewManager.h src/SUPERVGraph/SUPERVGraph_ViewModel.cxx src/SUPERVGraph/SUPERVGraph_ViewModel.h src/SUPERVGraph/resources/SUPERVGraph_images.po src/SUPERVGraph/resources/SUPERVGraph_images.ts src/SUPERVGraph/resources/SUPERVGraph_msg_en.po src/SUPERVGraph/resources/SUPERVGraph_msg_en.ts src/SUPERVGraph/resources/superv_view_pan.png src/SUPERVGraph/resources/superv_view_reset.png src/SalomeApp/Makefile.am src/SalomeApp/SalomeApp.h src/SalomeApp/SalomeApp.pro src/SalomeApp/SalomeApp_Application.cxx src/SalomeApp/SalomeApp_Application.h src/SalomeApp/SalomeApp_CheckFileDlg.cxx src/SalomeApp/SalomeApp_CheckFileDlg.h src/SalomeApp/SalomeApp_DataModel.cxx src/SalomeApp/SalomeApp_DataModel.h src/SalomeApp/SalomeApp_DataObject.cxx src/SalomeApp/SalomeApp_DataObject.h src/SalomeApp/SalomeApp_EventFilter.cxx src/SalomeApp/SalomeApp_EventFilter.h src/SalomeApp/SalomeApp_ExceptionHandler.cxx src/SalomeApp/SalomeApp_ExceptionHandler.h src/SalomeApp/SalomeApp_ExitDlg.cxx src/SalomeApp/SalomeApp_ExitDlg.h src/SalomeApp/SalomeApp_Filter.cxx src/SalomeApp/SalomeApp_Filter.h src/SalomeApp/SalomeApp_ImportOperation.cxx src/SalomeApp/SalomeApp_ImportOperation.h src/SalomeApp/SalomeApp_ListView.cxx src/SalomeApp/SalomeApp_ListView.h src/SalomeApp/SalomeApp_LoadStudiesDlg.cxx src/SalomeApp/SalomeApp_LoadStudiesDlg.h src/SalomeApp/SalomeApp_Module.cxx src/SalomeApp/SalomeApp_Module.h src/SalomeApp/SalomeApp_PyInterp.cxx src/SalomeApp/SalomeApp_PyInterp.h src/SalomeApp/SalomeApp_Study.cxx src/SalomeApp/SalomeApp_Study.h src/SalomeApp/SalomeApp_StudyPropertiesDlg.cxx src/SalomeApp/SalomeApp_StudyPropertiesDlg.h src/SalomeApp/SalomeApp_Tools.cxx src/SalomeApp/SalomeApp_Tools.h src/SalomeApp/SalomeApp_TypeFilter.cxx src/SalomeApp/SalomeApp_TypeFilter.h src/SalomeApp/SalomeApp_VisualState.cxx src/SalomeApp/SalomeApp_VisualState.h src/SalomeApp/Test/Makefile.am src/SalomeApp/Test/SalomeAppTest.cxx src/SalomeApp/Test/SalomeAppTest.hxx src/SalomeApp/Test/TestSalomeApp.cxx src/SalomeApp/Test/TestSalomeApp.py src/SalomeApp/resources/SalomeApp.ini src/SalomeApp/resources/SalomeApp.xml src/SalomeApp/resources/SalomeApp_images.po src/SalomeApp/resources/SalomeApp_images.ts src/SalomeApp/resources/SalomeApp_msg_en.po src/SalomeApp/resources/SalomeApp_msg_en.ts src/Session/Makefile.am src/Session/SALOME_Session.hxx src/Session/SALOME_Session_Server.cxx src/Session/SalomeApp_Engine_i.cxx src/Session/SalomeApp_Engine_i.hxx src/Session/Session.pro src/Session/Session_ServerCheck.cxx src/Session/Session_ServerCheck.hxx src/Session/Session_ServerLauncher.cxx src/Session/Session_ServerLauncher.hxx src/Session/Session_ServerThread.cxx src/Session/Session_ServerThread.hxx src/Session/Session_Session_i.cxx src/Session/Session_Session_i.hxx src/TOOLSGUI/Makefile.am src/TOOLSGUI/TOOLSGUI.pro src/TOOLSGUI/ToolsGUI.cxx src/TOOLSGUI/ToolsGUI.h src/TOOLSGUI/ToolsGUI_CatalogGeneratorDlg.cxx src/TOOLSGUI/ToolsGUI_CatalogGeneratorDlg.h src/TOOLSGUI/ToolsGUI_RegWidget.cxx src/TOOLSGUI/ToolsGUI_RegWidget.h src/TOOLSGUI/resources/ToolsGUI_icons.po src/TOOLSGUI/resources/ToolsGUI_msg_en.po src/TOOLSGUI/resources/ToolsGUI_msg_en.ts --- src/CAF/CAF.h | 51 - src/CAF/CAF.pro | 38 - src/CAF/CAF_Application.cxx | 334 --- src/CAF/CAF_Application.h | 78 - src/CAF/CAF_Operation.cxx | 60 - src/CAF/CAF_Operation.h | 43 - src/CAF/CAF_Study.cxx | 483 --- src/CAF/CAF_Study.h | 87 - src/CAF/CAF_Tools.cxx | 99 - src/CAF/CAF_Tools.h | 49 - src/CAF/Makefile.am | 53 - src/CAF/resources/CAF_images.po | 34 - src/CAF/resources/CAF_msg_en.po | 67 - src/CAF/resources/CAF_msg_en.ts | 57 - src/CASCatch/CASCatch.hxx | 58 - src/CASCatch/CASCatch_CatchSignals.cxx | 337 --- src/CASCatch/CASCatch_CatchSignals.hxx | 66 - src/CASCatch/CASCatch_ErrorHandler.cxx | 125 - src/CASCatch/CASCatch_ErrorHandler.hxx | 95 - src/CASCatch/CASCatch_Failure.cxx | 130 - src/CASCatch/CASCatch_Failure.hxx | 64 - src/CASCatch/Makefile.am | 41 - src/OCCViewer/Makefile.am | 106 - src/OCCViewer/OCCViewer.cxx | 100 - src/OCCViewer/OCCViewer.h | 31 - src/OCCViewer/OCCViewer.pro | 61 - src/OCCViewer/OCCViewer_AISSelector.cxx | 223 -- src/OCCViewer/OCCViewer_AISSelector.h | 82 - src/OCCViewer/OCCViewer_AxialScaleDlg.cxx | 178 -- src/OCCViewer/OCCViewer_AxialScaleDlg.h | 54 - src/OCCViewer/OCCViewer_ClippingDlg.cxx | 595 ---- src/OCCViewer/OCCViewer_ClippingDlg.h | 113 - .../OCCViewer_CreateRestoreViewDlg.cxx | 281 -- .../OCCViewer_CreateRestoreViewDlg.h | 75 - .../OCCViewer_SetRotationPointDlg.cxx | 301 -- src/OCCViewer/OCCViewer_SetRotationPointDlg.h | 84 - src/OCCViewer/OCCViewer_Trihedron.cxx | 306 -- src/OCCViewer/OCCViewer_Trihedron.h | 57 - src/OCCViewer/OCCViewer_VService.cxx | 302 -- src/OCCViewer/OCCViewer_VService.h | 132 - src/OCCViewer/OCCViewer_ViewManager.cxx | 48 - src/OCCViewer/OCCViewer_ViewManager.h | 41 - src/OCCViewer/OCCViewer_ViewModel.cxx | 653 ---- src/OCCViewer/OCCViewer_ViewModel.h | 177 -- src/OCCViewer/OCCViewer_ViewPort.cxx | 489 --- src/OCCViewer/OCCViewer_ViewPort.h | 120 - src/OCCViewer/OCCViewer_ViewPort3d.cxx | 537 ---- src/OCCViewer/OCCViewer_ViewPort3d.h | 100 - src/OCCViewer/OCCViewer_ViewSketcher.cxx | 540 ---- src/OCCViewer/OCCViewer_ViewSketcher.h | 141 - src/OCCViewer/OCCViewer_ViewWindow.cxx | 1707 ----------- src/OCCViewer/OCCViewer_ViewWindow.h | 205 -- src/OCCViewer/resources/OCCViewer_images.po | 99 - src/OCCViewer/resources/OCCViewer_images.ts | 93 - src/OCCViewer/resources/OCCViewer_msg_en.po | 220 -- src/OCCViewer/resources/OCCViewer_msg_en.ts | 292 -- src/OCCViewer/resources/occ_view_back.png | Bin 432 -> 0 bytes src/OCCViewer/resources/occ_view_bottom.png | Bin 428 -> 0 bytes .../resources/occ_view_camera_dump.png | Bin 682 -> 0 bytes src/OCCViewer/resources/occ_view_clipping.png | Bin 809 -> 0 bytes .../resources/occ_view_clipping_pressed.png | Bin 560 -> 0 bytes src/OCCViewer/resources/occ_view_clone.png | Bin 441 -> 0 bytes src/OCCViewer/resources/occ_view_fitall.png | Bin 816 -> 0 bytes src/OCCViewer/resources/occ_view_fitarea.png | Bin 912 -> 0 bytes src/OCCViewer/resources/occ_view_front.png | Bin 410 -> 0 bytes src/OCCViewer/resources/occ_view_glpan.png | Bin 1086 -> 0 bytes src/OCCViewer/resources/occ_view_left.png | Bin 427 -> 0 bytes src/OCCViewer/resources/occ_view_pan.png | Bin 982 -> 0 bytes src/OCCViewer/resources/occ_view_presets.png | Bin 545 -> 0 bytes src/OCCViewer/resources/occ_view_reset.png | Bin 918 -> 0 bytes src/OCCViewer/resources/occ_view_right.png | Bin 418 -> 0 bytes src/OCCViewer/resources/occ_view_rotate.png | Bin 886 -> 0 bytes .../resources/occ_view_rotation_point.png | Bin 858 -> 0 bytes src/OCCViewer/resources/occ_view_scaling.png | Bin 1128 -> 0 bytes src/OCCViewer/resources/occ_view_shoot.png | Bin 825 -> 0 bytes src/OCCViewer/resources/occ_view_top.png | Bin 419 -> 0 bytes src/OCCViewer/resources/occ_view_triedre.png | Bin 698 -> 0 bytes src/OCCViewer/resources/occ_view_zoom.png | Bin 797 -> 0 bytes src/PyConsole/Makefile.am | 52 - src/PyConsole/PyConsole.h | 45 - src/PyConsole/PyConsole.pro | 41 - src/PyConsole/PyConsole_Console.cxx | 261 -- src/PyConsole/PyConsole_Console.h | 84 - src/PyConsole/PyConsole_Editor.cxx | 1075 ------- src/PyConsole/PyConsole_Editor.h | 83 - src/PyConsole/PyConsole_Interp.cxx | 140 - src/PyConsole/PyConsole_Interp.h | 44 - src/PyConsole/resources/PyConsole_msg_en.ts | 26 - src/PyInterp/Makefile.am | 44 - src/PyInterp/PyInterp.h | 61 - src/PyInterp/PyInterp.pro | 33 - src/PyInterp/PyInterp_Dispatcher.cxx | 232 -- src/PyInterp/PyInterp_Dispatcher.h | 151 - src/PyInterp/PyInterp_Interp.cxx | 449 --- src/PyInterp/PyInterp_Interp.h | 116 - src/PyInterp/PyInterp_Watcher.h | 45 - src/QxGraph/Makefile.am | 66 - src/QxGraph/QxGraph.h | 35 - src/QxGraph/QxGraph.pro | 56 - src/QxGraph/QxGraph_ActiveItem.h | 59 - src/QxGraph/QxGraph_Canvas.cxx | 109 - src/QxGraph/QxGraph_Canvas.h | 57 - src/QxGraph/QxGraph_CanvasView.cxx | 761 ----- src/QxGraph/QxGraph_CanvasView.h | 112 - src/QxGraph/QxGraph_Def.h | 34 - src/QxGraph/QxGraph_Prs.cxx | 251 -- src/QxGraph/QxGraph_Prs.h | 73 - src/QxGraph/QxGraph_ViewManager.cxx | 56 - src/QxGraph/QxGraph_ViewManager.h | 44 - src/QxGraph/QxGraph_ViewModel.cxx | 157 - src/QxGraph/QxGraph_ViewModel.h | 82 - src/QxGraph/QxGraph_ViewWindow.cxx | 288 -- src/QxGraph/QxGraph_ViewWindow.h | 95 - src/QxGraph/resources/QxGraph_images.po | 42 - src/QxGraph/resources/QxGraph_images.ts | 29 - src/QxGraph/resources/QxGraph_msg_en.po | 40 - src/QxGraph/resources/QxGraph_msg_en.ts | 29 - src/QxGraph/resources/qx_view_fitall.png | Bin 816 -> 0 bytes src/QxGraph/resources/qx_view_fitarea.png | Bin 912 -> 0 bytes src/QxGraph/resources/qx_view_glpan.png | Bin 1086 -> 0 bytes src/QxGraph/resources/qx_view_pan.png | Bin 982 -> 0 bytes src/QxGraph/resources/qx_view_reset.png | Bin 918 -> 0 bytes src/QxGraph/resources/qx_view_zoom.png | Bin 797 -> 0 bytes src/ResExporter/Makefile.am | 29 - src/ResExporter/ResExporter.pro | 17 - src/ResExporter/ResourceExporter.cxx | 171 -- src/SALOME_PY/Makefile.am | 44 - src/SALOME_PY/SalomePy.cxx | 494 ---- src/SALOME_PYQT/Makefile.am | 29 - src/SALOME_PYQT/SALOME_PYQT_GUI/Makefile.am | 74 - .../SALOME_PYQT_GUI/SALOME_PYQT_GUI.h | 45 - .../SALOME_PYQT_GUI/SALOME_PYQT_GUI.sip | 27 - .../SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx | 2326 --------------- .../SALOME_PYQT_GUI/SALOME_PYQT_Module.h | 165 -- .../SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.cxx | 91 - .../SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.h | 43 - src/SALOME_PYQT/SalomePyQt/Makefile.am | 76 - src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx | 2620 ----------------- src/SALOME_PYQT/SalomePyQt/SalomePyQt.h | 220 -- src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip | 216 -- src/SALOME_SWIG/Help.py | 141 - src/SALOME_SWIG/Makefile.am | 116 - src/SALOME_SWIG/PyInterp.py | 102 - src/SALOME_SWIG/SALOMEGUI_Swig.cxx | 810 ----- src/SALOME_SWIG/SALOMEGUI_Swig.hxx | 69 - src/SALOME_SWIG/SALOMEGUI_Swig.i | 94 - src/SALOME_SWIG/SALOMEGUI_shared_modules.py | 34 - src/SALOME_SWIG/examplevtk1.py | 40 - src/SALOME_SWIG/libSALOME_Swig.i | 31 - src/SALOME_SWIG/salome.py | 157 - src/SALOME_SWIG/supervisionexample.py.in | 85 - src/SALOME_SWIG/supervisiongeomexample.py.in | 103 - src/SALOME_SWIG/test_big_table.py | 67 - src/SALOME_SWIG/test_many_objects.py | 87 - src/SALOME_SWIG/test_remove_ref.py | 49 - src/SALOME_SWIG/test_table.py | 113 - src/SOCC/Makefile.am | 50 - src/SOCC/SOCC.h | 31 - src/SOCC/SOCC.pro | 33 - src/SOCC/SOCC_Prs.cxx | 103 - src/SOCC/SOCC_Prs.h | 75 - src/SOCC/SOCC_ViewModel.cxx | 702 ----- src/SOCC/SOCC_ViewModel.h | 73 - src/SOCC/SOCC_ViewWindow.cxx | 103 - src/SOCC/SOCC_ViewWindow.h | 46 - src/SUPERVGraph/Makefile.am | 53 - src/SUPERVGraph/SUPERVGraph.cxx | 54 - src/SUPERVGraph/SUPERVGraph.h | 61 - src/SUPERVGraph/SUPERVGraph.pro | 49 - src/SUPERVGraph/SUPERVGraph_ViewFrame.cxx | 365 --- src/SUPERVGraph/SUPERVGraph_ViewFrame.h | 140 - src/SUPERVGraph/SUPERVGraph_ViewManager.cxx | 61 - src/SUPERVGraph/SUPERVGraph_ViewManager.h | 47 - src/SUPERVGraph/SUPERVGraph_ViewModel.cxx | 47 - src/SUPERVGraph/SUPERVGraph_ViewModel.h | 41 - .../resources/SUPERVGraph_images.po | 29 - .../resources/SUPERVGraph_images.ts | 13 - .../resources/SUPERVGraph_msg_en.po | 37 - .../resources/SUPERVGraph_msg_en.ts | 25 - src/SUPERVGraph/resources/superv_view_pan.png | Bin 982 -> 0 bytes .../resources/superv_view_reset.png | Bin 918 -> 0 bytes src/SalomeApp/Makefile.am | 114 - src/SalomeApp/SalomeApp.h | 48 - src/SalomeApp/SalomeApp.pro | 91 - src/SalomeApp/SalomeApp_Application.cxx | 1426 --------- src/SalomeApp/SalomeApp_Application.h | 157 - src/SalomeApp/SalomeApp_CheckFileDlg.cxx | 68 - src/SalomeApp/SalomeApp_CheckFileDlg.h | 44 - src/SalomeApp/SalomeApp_DataModel.cxx | 399 --- src/SalomeApp/SalomeApp_DataModel.h | 66 - src/SalomeApp/SalomeApp_DataObject.cxx | 766 ----- src/SalomeApp/SalomeApp_DataObject.h | 136 - src/SalomeApp/SalomeApp_EventFilter.cxx | 81 - src/SalomeApp/SalomeApp_EventFilter.h | 57 - src/SalomeApp/SalomeApp_ExceptionHandler.cxx | 117 - src/SalomeApp/SalomeApp_ExceptionHandler.h | 36 - src/SalomeApp/SalomeApp_ExitDlg.cxx | 106 - src/SalomeApp/SalomeApp_ExitDlg.h | 48 - src/SalomeApp/SalomeApp_Filter.cxx | 36 - src/SalomeApp/SalomeApp_Filter.h | 40 - src/SalomeApp/SalomeApp_ImportOperation.cxx | 40 - src/SalomeApp/SalomeApp_ImportOperation.h | 46 - src/SalomeApp/SalomeApp_ListView.cxx | 1393 --------- src/SalomeApp/SalomeApp_ListView.h | 341 --- src/SalomeApp/SalomeApp_LoadStudiesDlg.cxx | 134 - src/SalomeApp/SalomeApp_LoadStudiesDlg.h | 53 - src/SalomeApp/SalomeApp_Module.cxx | 142 - src/SalomeApp/SalomeApp_Module.h | 68 - src/SalomeApp/SalomeApp_PyInterp.cxx | 139 - src/SalomeApp/SalomeApp_PyInterp.h | 50 - src/SalomeApp/SalomeApp_Study.cxx | 757 ----- src/SalomeApp/SalomeApp_Study.h | 108 - .../SalomeApp_StudyPropertiesDlg.cxx | 371 --- src/SalomeApp/SalomeApp_StudyPropertiesDlg.h | 76 - src/SalomeApp/SalomeApp_Tools.cxx | 125 - src/SalomeApp/SalomeApp_Tools.h | 47 - src/SalomeApp/SalomeApp_TypeFilter.cxx | 63 - src/SalomeApp/SalomeApp_TypeFilter.h | 41 - src/SalomeApp/SalomeApp_VisualState.cxx | 324 -- src/SalomeApp/SalomeApp_VisualState.h | 47 - src/SalomeApp/Test/Makefile.am | 47 - src/SalomeApp/Test/SalomeAppTest.cxx | 56 - src/SalomeApp/Test/SalomeAppTest.hxx | 39 - src/SalomeApp/Test/TestSalomeApp.cxx | 31 - src/SalomeApp/Test/TestSalomeApp.py | 47 - src/SalomeApp/resources/SalomeApp.ini | 31 - src/SalomeApp/resources/SalomeApp.xml | 162 - src/SalomeApp/resources/SalomeApp_images.po | 31 - src/SalomeApp/resources/SalomeApp_images.ts | 2 - src/SalomeApp/resources/SalomeApp_msg_en.po | 269 -- src/SalomeApp/resources/SalomeApp_msg_en.ts | 331 --- src/Session/Makefile.am | 78 - src/Session/SALOME_Session.hxx | 39 - src/Session/SALOME_Session_Server.cxx | 599 ---- src/Session/SalomeApp_Engine_i.cxx | 176 -- src/Session/SalomeApp_Engine_i.hxx | 95 - src/Session/Session.pro | 85 - src/Session/Session_ServerCheck.cxx | 627 ---- src/Session/Session_ServerCheck.hxx | 71 - src/Session/Session_ServerLauncher.cxx | 236 -- src/Session/Session_ServerLauncher.hxx | 95 - src/Session/Session_ServerThread.cxx | 472 --- src/Session/Session_ServerThread.hxx | 96 - src/Session/Session_Session_i.cxx | 267 -- src/Session/Session_Session_i.hxx | 97 - src/TOOLSGUI/Makefile.am | 60 - src/TOOLSGUI/TOOLSGUI.pro | 48 - src/TOOLSGUI/ToolsGUI.cxx | 87 - src/TOOLSGUI/ToolsGUI.h | 54 - src/TOOLSGUI/ToolsGUI_CatalogGeneratorDlg.cxx | 433 --- src/TOOLSGUI/ToolsGUI_CatalogGeneratorDlg.h | 78 - src/TOOLSGUI/ToolsGUI_RegWidget.cxx | 949 ------ src/TOOLSGUI/ToolsGUI_RegWidget.h | 106 - src/TOOLSGUI/resources/ToolsGUI_icons.po | 41 - src/TOOLSGUI/resources/ToolsGUI_msg_en.po | 130 - src/TOOLSGUI/resources/ToolsGUI_msg_en.ts | 105 - 256 files changed, 41843 deletions(-) delete mode 100755 src/CAF/CAF.h delete mode 100644 src/CAF/CAF.pro delete mode 100755 src/CAF/CAF_Application.cxx delete mode 100755 src/CAF/CAF_Application.h delete mode 100755 src/CAF/CAF_Operation.cxx delete mode 100755 src/CAF/CAF_Operation.h delete mode 100755 src/CAF/CAF_Study.cxx delete mode 100755 src/CAF/CAF_Study.h delete mode 100755 src/CAF/CAF_Tools.cxx delete mode 100755 src/CAF/CAF_Tools.h delete mode 100755 src/CAF/Makefile.am delete mode 100755 src/CAF/resources/CAF_images.po delete mode 100755 src/CAF/resources/CAF_msg_en.po delete mode 100644 src/CAF/resources/CAF_msg_en.ts delete mode 100644 src/CASCatch/CASCatch.hxx delete mode 100644 src/CASCatch/CASCatch_CatchSignals.cxx delete mode 100644 src/CASCatch/CASCatch_CatchSignals.hxx delete mode 100644 src/CASCatch/CASCatch_ErrorHandler.cxx delete mode 100644 src/CASCatch/CASCatch_ErrorHandler.hxx delete mode 100644 src/CASCatch/CASCatch_Failure.cxx delete mode 100644 src/CASCatch/CASCatch_Failure.hxx delete mode 100644 src/CASCatch/Makefile.am delete mode 100755 src/OCCViewer/Makefile.am delete mode 100644 src/OCCViewer/OCCViewer.cxx delete mode 100755 src/OCCViewer/OCCViewer.h delete mode 100644 src/OCCViewer/OCCViewer.pro delete mode 100755 src/OCCViewer/OCCViewer_AISSelector.cxx delete mode 100755 src/OCCViewer/OCCViewer_AISSelector.h delete mode 100644 src/OCCViewer/OCCViewer_AxialScaleDlg.cxx delete mode 100644 src/OCCViewer/OCCViewer_AxialScaleDlg.h delete mode 100644 src/OCCViewer/OCCViewer_ClippingDlg.cxx delete mode 100644 src/OCCViewer/OCCViewer_ClippingDlg.h delete mode 100755 src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx delete mode 100755 src/OCCViewer/OCCViewer_CreateRestoreViewDlg.h delete mode 100644 src/OCCViewer/OCCViewer_SetRotationPointDlg.cxx delete mode 100644 src/OCCViewer/OCCViewer_SetRotationPointDlg.h delete mode 100755 src/OCCViewer/OCCViewer_Trihedron.cxx delete mode 100644 src/OCCViewer/OCCViewer_Trihedron.h delete mode 100755 src/OCCViewer/OCCViewer_VService.cxx delete mode 100755 src/OCCViewer/OCCViewer_VService.h delete mode 100755 src/OCCViewer/OCCViewer_ViewManager.cxx delete mode 100755 src/OCCViewer/OCCViewer_ViewManager.h delete mode 100755 src/OCCViewer/OCCViewer_ViewModel.cxx delete mode 100755 src/OCCViewer/OCCViewer_ViewModel.h delete mode 100755 src/OCCViewer/OCCViewer_ViewPort.cxx delete mode 100755 src/OCCViewer/OCCViewer_ViewPort.h delete mode 100755 src/OCCViewer/OCCViewer_ViewPort3d.cxx delete mode 100755 src/OCCViewer/OCCViewer_ViewPort3d.h delete mode 100755 src/OCCViewer/OCCViewer_ViewSketcher.cxx delete mode 100755 src/OCCViewer/OCCViewer_ViewSketcher.h delete mode 100755 src/OCCViewer/OCCViewer_ViewWindow.cxx delete mode 100755 src/OCCViewer/OCCViewer_ViewWindow.h delete mode 100755 src/OCCViewer/resources/OCCViewer_images.po delete mode 100644 src/OCCViewer/resources/OCCViewer_images.ts delete mode 100755 src/OCCViewer/resources/OCCViewer_msg_en.po delete mode 100644 src/OCCViewer/resources/OCCViewer_msg_en.ts delete mode 100755 src/OCCViewer/resources/occ_view_back.png delete mode 100755 src/OCCViewer/resources/occ_view_bottom.png delete mode 100755 src/OCCViewer/resources/occ_view_camera_dump.png delete mode 100644 src/OCCViewer/resources/occ_view_clipping.png delete mode 100644 src/OCCViewer/resources/occ_view_clipping_pressed.png delete mode 100755 src/OCCViewer/resources/occ_view_clone.png delete mode 100755 src/OCCViewer/resources/occ_view_fitall.png delete mode 100755 src/OCCViewer/resources/occ_view_fitarea.png delete mode 100755 src/OCCViewer/resources/occ_view_front.png delete mode 100755 src/OCCViewer/resources/occ_view_glpan.png delete mode 100755 src/OCCViewer/resources/occ_view_left.png delete mode 100755 src/OCCViewer/resources/occ_view_pan.png delete mode 100755 src/OCCViewer/resources/occ_view_presets.png delete mode 100755 src/OCCViewer/resources/occ_view_reset.png delete mode 100755 src/OCCViewer/resources/occ_view_right.png delete mode 100755 src/OCCViewer/resources/occ_view_rotate.png delete mode 100755 src/OCCViewer/resources/occ_view_rotation_point.png delete mode 100644 src/OCCViewer/resources/occ_view_scaling.png delete mode 100755 src/OCCViewer/resources/occ_view_shoot.png delete mode 100755 src/OCCViewer/resources/occ_view_top.png delete mode 100755 src/OCCViewer/resources/occ_view_triedre.png delete mode 100755 src/OCCViewer/resources/occ_view_zoom.png delete mode 100755 src/PyConsole/Makefile.am delete mode 100644 src/PyConsole/PyConsole.h delete mode 100644 src/PyConsole/PyConsole.pro delete mode 100644 src/PyConsole/PyConsole_Console.cxx delete mode 100644 src/PyConsole/PyConsole_Console.h delete mode 100644 src/PyConsole/PyConsole_Editor.cxx delete mode 100644 src/PyConsole/PyConsole_Editor.h delete mode 100644 src/PyConsole/PyConsole_Interp.cxx delete mode 100644 src/PyConsole/PyConsole_Interp.h delete mode 100644 src/PyConsole/resources/PyConsole_msg_en.ts delete mode 100755 src/PyInterp/Makefile.am delete mode 100755 src/PyInterp/PyInterp.h delete mode 100644 src/PyInterp/PyInterp.pro delete mode 100755 src/PyInterp/PyInterp_Dispatcher.cxx delete mode 100755 src/PyInterp/PyInterp_Dispatcher.h delete mode 100644 src/PyInterp/PyInterp_Interp.cxx delete mode 100644 src/PyInterp/PyInterp_Interp.h delete mode 100755 src/PyInterp/PyInterp_Watcher.h delete mode 100755 src/QxGraph/Makefile.am delete mode 100644 src/QxGraph/QxGraph.h delete mode 100644 src/QxGraph/QxGraph.pro delete mode 100644 src/QxGraph/QxGraph_ActiveItem.h delete mode 100644 src/QxGraph/QxGraph_Canvas.cxx delete mode 100644 src/QxGraph/QxGraph_Canvas.h delete mode 100644 src/QxGraph/QxGraph_CanvasView.cxx delete mode 100644 src/QxGraph/QxGraph_CanvasView.h delete mode 100644 src/QxGraph/QxGraph_Def.h delete mode 100644 src/QxGraph/QxGraph_Prs.cxx delete mode 100644 src/QxGraph/QxGraph_Prs.h delete mode 100644 src/QxGraph/QxGraph_ViewManager.cxx delete mode 100644 src/QxGraph/QxGraph_ViewManager.h delete mode 100644 src/QxGraph/QxGraph_ViewModel.cxx delete mode 100644 src/QxGraph/QxGraph_ViewModel.h delete mode 100644 src/QxGraph/QxGraph_ViewWindow.cxx delete mode 100644 src/QxGraph/QxGraph_ViewWindow.h delete mode 100644 src/QxGraph/resources/QxGraph_images.po delete mode 100644 src/QxGraph/resources/QxGraph_images.ts delete mode 100644 src/QxGraph/resources/QxGraph_msg_en.po delete mode 100644 src/QxGraph/resources/QxGraph_msg_en.ts delete mode 100755 src/QxGraph/resources/qx_view_fitall.png delete mode 100755 src/QxGraph/resources/qx_view_fitarea.png delete mode 100644 src/QxGraph/resources/qx_view_glpan.png delete mode 100755 src/QxGraph/resources/qx_view_pan.png delete mode 100755 src/QxGraph/resources/qx_view_reset.png delete mode 100755 src/QxGraph/resources/qx_view_zoom.png delete mode 100755 src/ResExporter/Makefile.am delete mode 100644 src/ResExporter/ResExporter.pro delete mode 100644 src/ResExporter/ResourceExporter.cxx delete mode 100755 src/SALOME_PY/Makefile.am delete mode 100755 src/SALOME_PY/SalomePy.cxx delete mode 100755 src/SALOME_PYQT/Makefile.am delete mode 100644 src/SALOME_PYQT/SALOME_PYQT_GUI/Makefile.am delete mode 100644 src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_GUI.h delete mode 100644 src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_GUI.sip delete mode 100644 src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx delete mode 100644 src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.h delete mode 100644 src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.cxx delete mode 100644 src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.h delete mode 100644 src/SALOME_PYQT/SalomePyQt/Makefile.am delete mode 100644 src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx delete mode 100644 src/SALOME_PYQT/SalomePyQt/SalomePyQt.h delete mode 100644 src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip delete mode 100755 src/SALOME_SWIG/Help.py delete mode 100755 src/SALOME_SWIG/Makefile.am delete mode 100755 src/SALOME_SWIG/PyInterp.py delete mode 100644 src/SALOME_SWIG/SALOMEGUI_Swig.cxx delete mode 100644 src/SALOME_SWIG/SALOMEGUI_Swig.hxx delete mode 100644 src/SALOME_SWIG/SALOMEGUI_Swig.i delete mode 100755 src/SALOME_SWIG/SALOMEGUI_shared_modules.py delete mode 100755 src/SALOME_SWIG/examplevtk1.py delete mode 100755 src/SALOME_SWIG/libSALOME_Swig.i delete mode 100755 src/SALOME_SWIG/salome.py delete mode 100755 src/SALOME_SWIG/supervisionexample.py.in delete mode 100755 src/SALOME_SWIG/supervisiongeomexample.py.in delete mode 100755 src/SALOME_SWIG/test_big_table.py delete mode 100755 src/SALOME_SWIG/test_many_objects.py delete mode 100755 src/SALOME_SWIG/test_remove_ref.py delete mode 100755 src/SALOME_SWIG/test_table.py delete mode 100755 src/SOCC/Makefile.am delete mode 100755 src/SOCC/SOCC.h delete mode 100644 src/SOCC/SOCC.pro delete mode 100644 src/SOCC/SOCC_Prs.cxx delete mode 100644 src/SOCC/SOCC_Prs.h delete mode 100755 src/SOCC/SOCC_ViewModel.cxx delete mode 100755 src/SOCC/SOCC_ViewModel.h delete mode 100644 src/SOCC/SOCC_ViewWindow.cxx delete mode 100644 src/SOCC/SOCC_ViewWindow.h delete mode 100755 src/SUPERVGraph/Makefile.am delete mode 100755 src/SUPERVGraph/SUPERVGraph.cxx delete mode 100755 src/SUPERVGraph/SUPERVGraph.h delete mode 100644 src/SUPERVGraph/SUPERVGraph.pro delete mode 100755 src/SUPERVGraph/SUPERVGraph_ViewFrame.cxx delete mode 100755 src/SUPERVGraph/SUPERVGraph_ViewFrame.h delete mode 100644 src/SUPERVGraph/SUPERVGraph_ViewManager.cxx delete mode 100644 src/SUPERVGraph/SUPERVGraph_ViewManager.h delete mode 100644 src/SUPERVGraph/SUPERVGraph_ViewModel.cxx delete mode 100644 src/SUPERVGraph/SUPERVGraph_ViewModel.h delete mode 100644 src/SUPERVGraph/resources/SUPERVGraph_images.po delete mode 100644 src/SUPERVGraph/resources/SUPERVGraph_images.ts delete mode 100644 src/SUPERVGraph/resources/SUPERVGraph_msg_en.po delete mode 100644 src/SUPERVGraph/resources/SUPERVGraph_msg_en.ts delete mode 100644 src/SUPERVGraph/resources/superv_view_pan.png delete mode 100644 src/SUPERVGraph/resources/superv_view_reset.png delete mode 100755 src/SalomeApp/Makefile.am delete mode 100644 src/SalomeApp/SalomeApp.h delete mode 100644 src/SalomeApp/SalomeApp.pro delete mode 100644 src/SalomeApp/SalomeApp_Application.cxx delete mode 100644 src/SalomeApp/SalomeApp_Application.h delete mode 100644 src/SalomeApp/SalomeApp_CheckFileDlg.cxx delete mode 100644 src/SalomeApp/SalomeApp_CheckFileDlg.h delete mode 100644 src/SalomeApp/SalomeApp_DataModel.cxx delete mode 100644 src/SalomeApp/SalomeApp_DataModel.h delete mode 100644 src/SalomeApp/SalomeApp_DataObject.cxx delete mode 100644 src/SalomeApp/SalomeApp_DataObject.h delete mode 100755 src/SalomeApp/SalomeApp_EventFilter.cxx delete mode 100755 src/SalomeApp/SalomeApp_EventFilter.h delete mode 100644 src/SalomeApp/SalomeApp_ExceptionHandler.cxx delete mode 100644 src/SalomeApp/SalomeApp_ExceptionHandler.h delete mode 100644 src/SalomeApp/SalomeApp_ExitDlg.cxx delete mode 100644 src/SalomeApp/SalomeApp_ExitDlg.h delete mode 100644 src/SalomeApp/SalomeApp_Filter.cxx delete mode 100644 src/SalomeApp/SalomeApp_Filter.h delete mode 100644 src/SalomeApp/SalomeApp_ImportOperation.cxx delete mode 100644 src/SalomeApp/SalomeApp_ImportOperation.h delete mode 100644 src/SalomeApp/SalomeApp_ListView.cxx delete mode 100644 src/SalomeApp/SalomeApp_ListView.h delete mode 100644 src/SalomeApp/SalomeApp_LoadStudiesDlg.cxx delete mode 100644 src/SalomeApp/SalomeApp_LoadStudiesDlg.h delete mode 100644 src/SalomeApp/SalomeApp_Module.cxx delete mode 100644 src/SalomeApp/SalomeApp_Module.h delete mode 100755 src/SalomeApp/SalomeApp_PyInterp.cxx delete mode 100755 src/SalomeApp/SalomeApp_PyInterp.h delete mode 100644 src/SalomeApp/SalomeApp_Study.cxx delete mode 100644 src/SalomeApp/SalomeApp_Study.h delete mode 100644 src/SalomeApp/SalomeApp_StudyPropertiesDlg.cxx delete mode 100644 src/SalomeApp/SalomeApp_StudyPropertiesDlg.h delete mode 100644 src/SalomeApp/SalomeApp_Tools.cxx delete mode 100644 src/SalomeApp/SalomeApp_Tools.h delete mode 100644 src/SalomeApp/SalomeApp_TypeFilter.cxx delete mode 100644 src/SalomeApp/SalomeApp_TypeFilter.h delete mode 100644 src/SalomeApp/SalomeApp_VisualState.cxx delete mode 100644 src/SalomeApp/SalomeApp_VisualState.h delete mode 100644 src/SalomeApp/Test/Makefile.am delete mode 100644 src/SalomeApp/Test/SalomeAppTest.cxx delete mode 100644 src/SalomeApp/Test/SalomeAppTest.hxx delete mode 100644 src/SalomeApp/Test/TestSalomeApp.cxx delete mode 100644 src/SalomeApp/Test/TestSalomeApp.py delete mode 100644 src/SalomeApp/resources/SalomeApp.ini delete mode 100644 src/SalomeApp/resources/SalomeApp.xml delete mode 100644 src/SalomeApp/resources/SalomeApp_images.po delete mode 100644 src/SalomeApp/resources/SalomeApp_images.ts delete mode 100644 src/SalomeApp/resources/SalomeApp_msg_en.po delete mode 100644 src/SalomeApp/resources/SalomeApp_msg_en.ts delete mode 100755 src/Session/Makefile.am delete mode 100755 src/Session/SALOME_Session.hxx delete mode 100755 src/Session/SALOME_Session_Server.cxx delete mode 100644 src/Session/SalomeApp_Engine_i.cxx delete mode 100755 src/Session/SalomeApp_Engine_i.hxx delete mode 100644 src/Session/Session.pro delete mode 100644 src/Session/Session_ServerCheck.cxx delete mode 100644 src/Session/Session_ServerCheck.hxx delete mode 100755 src/Session/Session_ServerLauncher.cxx delete mode 100755 src/Session/Session_ServerLauncher.hxx delete mode 100755 src/Session/Session_ServerThread.cxx delete mode 100755 src/Session/Session_ServerThread.hxx delete mode 100755 src/Session/Session_Session_i.cxx delete mode 100755 src/Session/Session_Session_i.hxx delete mode 100755 src/TOOLSGUI/Makefile.am delete mode 100644 src/TOOLSGUI/TOOLSGUI.pro delete mode 100755 src/TOOLSGUI/ToolsGUI.cxx delete mode 100755 src/TOOLSGUI/ToolsGUI.h delete mode 100755 src/TOOLSGUI/ToolsGUI_CatalogGeneratorDlg.cxx delete mode 100755 src/TOOLSGUI/ToolsGUI_CatalogGeneratorDlg.h delete mode 100755 src/TOOLSGUI/ToolsGUI_RegWidget.cxx delete mode 100755 src/TOOLSGUI/ToolsGUI_RegWidget.h delete mode 100755 src/TOOLSGUI/resources/ToolsGUI_icons.po delete mode 100755 src/TOOLSGUI/resources/ToolsGUI_msg_en.po delete mode 100644 src/TOOLSGUI/resources/ToolsGUI_msg_en.ts diff --git a/src/CAF/CAF.h b/src/CAF/CAF.h deleted file mode 100755 index ed6a8ea24..000000000 --- a/src/CAF/CAF.h +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 CAF_H -#define CAF_H - -#if defined WIN32 -# if defined CAF_EXPORTS -# define CAF_EXPORT __declspec( dllexport ) -# else -# define CAF_EXPORT __declspec( dllimport ) -# endif -#else -# define CAF_EXPORT -#endif - -#if defined SOLARIS -#define bool int -#define false 0 -#define true 1 -#endif - -#if defined WIN32 -#pragma warning ( disable: 4251 ) -#endif - -#if defined ( _DEBUG ) || defined ( DEBUG ) -#include -#define CAF_VERIFY(x) assert(x); -#define CAF_ASSERT(x) assert(x); -#else -#define CAF_VERIFY(x) x -#define CAF_ASSERT(x) -#endif - -#endif diff --git a/src/CAF/CAF.pro b/src/CAF/CAF.pro deleted file mode 100644 index 0c7313d32..000000000 --- a/src/CAF/CAF.pro +++ /dev/null @@ -1,38 +0,0 @@ -TEMPLATE = lib -TARGET = caf -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -INCLUDEPATH += ../../include ../Qtx ../SUIT ../STD -LIBS += -L../../lib -lqtx -lsuit -lstd - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += CAF_EXPORTS - -HEADERS = CAF.h -HEADERS += CAF_Application.h -HEADERS += CAF_Operation.h -HEADERS += CAF_Study.h -HEADERS += CAF_Tools.h - -SOURCES = CAF_Application.cxx -SOURCES += CAF_Operation.cxx -SOURCES += CAF_Study.cxx -SOURCES += CAF_Tools.cxx - -TRANSLATIONS = resources/CAF_images.ts \ - resources/CAF_msg_en.ts - -ICONS = resources/*.png - -includes.files = $$HEADERS -includes.path = ../../include - -resources.files = $$ICONS resources/*.qm resources/*.xml resources/*.ini -resources.path = ../../resources - -INSTALLS += includes resources diff --git a/src/CAF/CAF_Application.cxx b/src/CAF/CAF_Application.cxx deleted file mode 100755 index ac268daaf..000000000 --- a/src/CAF/CAF_Application.cxx +++ /dev/null @@ -1,334 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 "CAF_Application.h" - -#include "CAF_Tools.h" -#include "CAF_Study.h" - -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include - -/*! - \brief Create new instance of CAF_Application. - \return new instance of CAF_Application class -*/ -extern "C" CAF_EXPORT SUIT_Application* createApplication() -{ - return new CAF_Application(); -} - -/*! - \class CAF_Application - \brief OCC OCAF-based application. - - Defines application configuration and behaviour for application using - standard OCC OCAF data model. Allows using OCC OCAF serives - (for example, undo/redo mechanizm). -*/ - -/*! - \brief Default constructor. -*/ -CAF_Application::CAF_Application() -: STD_Application() -{ -} - -/*! - \brief Constructor. - \param app OCAF application -*/ -CAF_Application::CAF_Application( const Handle( TDocStd_Application )& app ) -: STD_Application(), - myStdApp( app ) -{ -} - -/*! - \brief Destructor. -*/ -CAF_Application::~CAF_Application() -{ -} - -/*! - \brief Get application name. - \return application name -*/ -QString CAF_Application::applicationName() const -{ - return QString( "CAFApplication" ); -} - -/*! - \brief Get OCAF application. - \return handle to OCAF application object -*/ -Handle( TDocStd_Application ) CAF_Application::stdApp() const -{ - return myStdApp; -} - -/*! - \brief Get file extension filter. - - The file extension filter is used in Open/Save dialog boxes. - - \return file filters for open/save document dialog box -*/ -QString CAF_Application::getFileFilter() const -{ - if ( stdApp().IsNull() ) - return QString(); - - TColStd_SequenceOfExtendedString formats; - stdApp()->Formats( formats ); - - QStringList allWC; - QMap wildCards; - Handle(Resource_Manager) resMgr = new Resource_Manager( stdApp()->ResourcesName() ); - for ( int i = 1; i <= formats.Length(); i++ ) - { - QString extension; - QString extResStr = CAF_Tools::toQString( formats.Value( i ) ) + QString( ".FileExtension" ); - if ( resMgr->Find( extResStr.toLatin1().data() ) ) - extension = QString( resMgr->Value( extResStr.toLatin1().data() ) ); - - QString descr; - QString descrResStr = CAF_Tools::toQString( formats.Value( i ) ) + QString( ".Description" ); - if ( resMgr->Find( (char*)descrResStr.toLatin1().data() ) ) - descr = QString( resMgr->Value( (char*)descrResStr.toLatin1().data() ) ); - - if ( !descr.isEmpty() && !extension.isEmpty() ) - { - if ( !wildCards.contains( descr ) ) - wildCards.insert( descr, QStringList() ); - wildCards[descr].append( QString( "*.%1" ).arg( extension ) ); - allWC.append( QString( "*.%1" ).arg( extension ) ); - } - } - - if ( wildCards.isEmpty() ) - return QString(); - - QStringList filters; - for ( QMap::ConstIterator it = wildCards.begin(); it != wildCards.end(); ++it ) - filters.append( QString( "%1 (%2)" ).arg( it.key() ).arg( it.value().join( "; " ) ) ); - - if ( wildCards.count() > 1 ) - filters.prepend( QString( "%1 (%2)" ).arg( tr( "INF_ALL_DOCUMENTS_FILTER" ) ).arg( allWC.join( "; " ) ) ); - - if ( !filters.isEmpty() ) - filters.append( tr( "INF_ALL_FILTER" ) ); - - return filters.join( ";;" ); -} - -/*! - \brief Create menu and toolbars actions. -*/ -void CAF_Application::createActions() -{ - STD_Application::createActions(); - - SUIT_Desktop* desk = desktop(); - SUIT_ResourceMgr* resMgr = resourceMgr(); - - QtxListAction* editUndo = - new QtxListAction( tr( "TOT_APP_EDIT_UNDO" ), - resMgr->loadPixmap( "STD", tr( "ICON_EDIT_UNDO" ) ), - tr( "MEN_APP_EDIT_UNDO" ), Qt::CTRL+Qt::Key_Z, desk ); - editUndo->setStatusTip( tr( "PRP_APP_EDIT_UNDO" ) ); - registerAction( EditUndoId, editUndo ); - - QtxListAction* editRedo = - new QtxListAction( tr( "TOT_APP_EDIT_REDO" ), - resMgr->loadPixmap( "STD", tr( "ICON_EDIT_REDO" ) ), - tr( "MEN_APP_EDIT_REDO" ), Qt::CTRL+Qt::Key_Y, desk ); - editRedo->setStatusTip( tr( "PRP_APP_EDIT_REDO" ) ); - registerAction( EditRedoId, editRedo ); - - editUndo->setComment( tr( "INF_APP_UNDOACTIONS" ) ); - editRedo->setComment( tr( "INF_APP_REDOACTIONS" ) ); - - connect( editUndo, SIGNAL( activated( int ) ), this, SLOT( onUndo( int ) ) ); - connect( editRedo, SIGNAL( activated( int ) ), this, SLOT( onRedo( int ) ) ); - - int editMenu = createMenu( tr( "MEN_DESK_EDIT" ), -1, -1, 10 ); - - createMenu( EditUndoId, editMenu, 0 ); - createMenu( EditRedoId, editMenu, 0 ); - createMenu( separator(), editMenu, -1, 0 ); - - int stdTBar = createTool( tr( "INF_DESK_TOOLBAR_STANDARD" ) ); - - createTool( separator(), stdTBar ); - createTool( EditUndoId, stdTBar ); - createTool( EditRedoId, stdTBar ); - createTool( separator(), stdTBar ); -} - -/*! - \brief Undo latest command operation for specified document. - \param doc OCAF document - \return \c true on success -*/ -bool CAF_Application::undo( CAF_Study* doc ) -{ - bool success = false; - if ( doc ) - { - if ( success = doc->undo() ) - doc->update(); - } - return success; -} - -/*! - \brief Redo latest command operation undo for specified document. - \param doc OCAF document - \return \c true on success -*/ -bool CAF_Application::redo(CAF_Study* doc) -{ - bool success = false; - if ( doc ) - { - if ( success = doc->redo() ) - doc->update(); - } - return success; -} - -/*! - \brief Called when user activates "Undo" menu action. - - Undo operation on the active document. - - \param numActions undo depth (number of commands) - \return \c true on success -*/ -bool CAF_Application::onUndo( int numActions ) -{ - bool ok = true; - while ( numActions > 0 ) - { - CAF_Study* cafStudy = dynamic_cast( activeStudy() ); - if ( cafStudy ) - { - if ( !undo( cafStudy ) ) - { - ok = false; - break; - } - numActions--; - } - } - updateCommandsStatus(); /* enable/disable undo/redo */ - return ok; -} - -/*! - \brief Called when user activates "Redo" menu action. - - Redo latest undo commands on the active document. - - \param numActions redo depth (number of commands) - \return \c true on success -*/ -bool CAF_Application::onRedo( int numActions ) -{ - bool ok = true; - while ( numActions > 0 ) - { - CAF_Study* cafStudy = dynamic_cast( activeStudy() ); - if ( cafStudy ) - { - if ( !redo( cafStudy ) ) - { - ok = false; - break; - } - numActions--; - } - } - updateCommandsStatus(); /* enable/disable undo/redo */ - return ok; -} - -/*! - \brief Update actions state (Undo/Redo). -*/ -void CAF_Application::updateCommandsStatus() -{ - STD_Application::updateCommandsStatus(); - - CAF_Study* cafStudy = 0; - if ( activeStudy() && activeStudy()->inherits( "CAF_Study" ) ) - cafStudy = (CAF_Study*)activeStudy(); - - QtxListAction* undo = qobject_cast( action( EditUndoId ) ); - if ( cafStudy && undo ) - undo->addNames( cafStudy->undoNames() ); - - QtxListAction* redo = qobject_cast( action( EditRedoId ) ); - if ( cafStudy && redo ) - redo->addNames( cafStudy->redoNames() ); - - if ( undo ) - undo->setEnabled( cafStudy && cafStudy->canUndo() ); - if ( redo ) - redo->setEnabled( cafStudy && cafStudy->canRedo() ); -} - -/*! - \brief Called when user activatees Help->About main menu command. -*/ -void CAF_Application::onHelpAbout() -{ - SUIT_MessageBox::information( desktop(), tr( "About" ), tr( "ABOUT_INFO" ) ); -} - -/*! - \brief Create new empty study. - \return new study -*/ -SUIT_Study* CAF_Application::createNewStudy() -{ - return new CAF_Study( this ); -} - -/*! - \brief Set OCAF application. - \param app new OCAF application -*/ -void CAF_Application::setStdApp( const Handle(TDocStd_Application)& app ) -{ - myStdApp = app; -} diff --git a/src/CAF/CAF_Application.h b/src/CAF/CAF_Application.h deleted file mode 100755 index 176293995..000000000 --- a/src/CAF/CAF_Application.h +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 CAF_APPLICATION_H -#define CAF_APPLICATION_H - -#include "CAF.h" - -#include "STD_Application.h" - -#include - -class CAF_Study; - -#if defined WIN32 -#pragma warning ( disable: 4251 ) -#endif - -class CAF_EXPORT CAF_Application : public STD_Application -{ - Q_OBJECT - -public: - CAF_Application(); - CAF_Application( const Handle(TDocStd_Application)& ); - virtual ~CAF_Application(); - - virtual QString applicationName() const; - - Handle(TDocStd_Application) stdApp() const; - - virtual QString getFileFilter() const; - -public slots: - virtual void onHelpAbout(); - -protected slots: - virtual bool onUndo( int ); - virtual bool onRedo( int ); - -protected: - enum { EditUndoId = STD_Application::UserID, EditRedoId, UserID }; - -protected: - virtual void createActions(); - virtual void updateCommandsStatus(); - - virtual SUIT_Study* createNewStudy(); - - bool undo( CAF_Study* doc ); - bool redo( CAF_Study* doc ); - - virtual void setStdApp( const Handle(TDocStd_Application)& ); - -private: - Handle(TDocStd_Application) myStdApp; -}; - -#if defined WIN32 -#pragma warning ( default: 4251 ) -#endif - -#endif diff --git a/src/CAF/CAF_Operation.cxx b/src/CAF/CAF_Operation.cxx deleted file mode 100755 index 0b9e3c752..000000000 --- a/src/CAF/CAF_Operation.cxx +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 "CAF_Operation.h" - -#include "CAF_Study.h" -#include "CAF_Application.h" - -#include - -/*! - \class CAF_Operation - \brief Base operation class for all operations used in CAF package. - - Operation interacts with OCC OCAF std document. -*/ - -/*! - \brief Constructor. - \param theApp application -*/ -CAF_Operation::CAF_Operation(SUIT_Application* theApp) -: SUIT_Operation(theApp) -{ -} - -/*! - \brief Destructor. -*/ -CAF_Operation::~CAF_Operation() -{ -} - -/*! - \brief Get OCAF document. - \return handle to the OCAF document object -*/ -Handle(TDocStd_Document) CAF_Operation::stdDoc() const -{ - Handle(TDocStd_Document) doc; - CAF_Study* s = qobject_cast( study() ); - if ( s ) - doc = s->stdDoc(); - return doc; -} diff --git a/src/CAF/CAF_Operation.h b/src/CAF/CAF_Operation.h deleted file mode 100755 index 15bd54070..000000000 --- a/src/CAF/CAF_Operation.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 CAF_OPERATION_H -#define CAF_OPERATION_H - -#include "CAF.h" - -#include "SUIT_Operation.h" - -#include - -class CAF_Study; -class Handle(TDocStd_Document); - -class CAF_EXPORT CAF_Operation : public SUIT_Operation -{ - Q_OBJECT - -public: - CAF_Operation( SUIT_Application* ); - virtual ~CAF_Operation(); - -protected: - Handle(TDocStd_Document) stdDoc() const; -}; - -#endif diff --git a/src/CAF/CAF_Study.cxx b/src/CAF/CAF_Study.cxx deleted file mode 100755 index 95ac4cbf8..000000000 --- a/src/CAF/CAF_Study.cxx +++ /dev/null @@ -1,483 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 "CAF_Study.h" - -#include "CAF_Tools.h" -#include "CAF_Application.h" - -#include -#include -#include - -#include - -#include -#include -#include - -#include -#include - -/*! - \class CAF_Study - \brief Represents study for using in CAF module. - - A study contains reference to OCAF std document and allows using OCAF services. - Provides necessary functionality for OCC transactions management. -*/ - -/*! - \brief Constructor. - \param theApp application -*/ -CAF_Study::CAF_Study(SUIT_Application* theApp) -: SUIT_Study( theApp ), - myModifiedCnt( 0 ) -{ -} - -/*! - \brief Constructor. - \param theApp application - \param aStdDoc OCAF document -*/ -CAF_Study::CAF_Study(SUIT_Application* theApp, Handle (TDocStd_Document)& aStdDoc) -: SUIT_Study( theApp ), - myStdDoc( aStdDoc ), - myModifiedCnt( 0 ) -{ -} - -/*! - \brief Destructor. -*/ -CAF_Study::~CAF_Study() -{ -} - -/*! - \brief Get OCAF document. - \return handle to the OCAF document object -*/ -Handle(TDocStd_Document) CAF_Study::stdDoc() const -{ - return myStdDoc; -} - -/*! - \brief Set OCAF document. - \param aStdDoc new OCAF document -*/ -void CAF_Study::setStdDoc( Handle(TDocStd_Document)& aStdDoc ) -{ - myStdDoc = aStdDoc; -} - -/*! - \brief Customize document initialization. - \param doc study name - \return \c true on success and \c false on error -*/ -bool CAF_Study::createDocument( const QString& doc ) -{ - bool res = SUIT_Study::createDocument( doc ); - - CAF_Application* app = cafApplication(); - if ( res && app && !app->stdApp().IsNull() ) - { - try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 - OCC_CATCH_SIGNALS; -#endif - TColStd_SequenceOfExtendedString formats; - app->stdApp()->Formats( formats ); - if ( !formats.IsEmpty() ) - app->stdApp()->NewDocument( formats.First(), myStdDoc ); - } - catch ( Standard_Failure ) { - res = false; - } - } - return res; -} - -/*! - \brief Close document. - \param permanently if \c true, a document is closed permanently -*/ -void CAF_Study::closeDocument( bool permanently ) -{ - Handle(TDocStd_Application) app = stdApp(); - if ( !app.IsNull() && !stdDoc().IsNull() ) - app->Close( stdDoc() ); - - SUIT_Study::closeDocument( permanently ); -} - -/*! - \brief Open document. - \param fname study file name - \return \c true on success and \c false if document cannot be opened -*/ -bool CAF_Study::openDocument( const QString& fname ) -{ - Handle(TDocStd_Application) app = stdApp(); - if ( app.IsNull() ) - return false; - - bool status = false; - try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 - OCC_CATCH_SIGNALS; -#endif - status = app->Open( CAF_Tools::toExtString( fname ), myStdDoc ) == CDF_RS_OK; - } - catch ( Standard_Failure ) { - status = false; - } - - return status && SUIT_Study::openDocument( fname ); -} - -/*! - \brief Save document with other name. - \param fname study file name -*/ -bool CAF_Study::saveDocumentAs( const QString& fname ) -{ - Handle(TDocStd_Application) app = stdApp(); - if ( app.IsNull() ) - return false; - - bool save = false; - if ( !stdDoc().IsNull() && stdDoc()->IsSaved() ) - { - QString path = QDir::convertSeparators( CAF_Tools::toQString( stdDoc()->GetPath() ) ); - save = path == QDir::convertSeparators( fname ); - } - - bool status = false; - try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 - OCC_CATCH_SIGNALS; -#endif - if ( save ) - status = app->Save( stdDoc() ) == CDF_SS_OK; - else - { - TCollection_ExtendedString format, path( CAF_Tools::toExtString( fname ) ); - app->Format( path, format ); - - if ( format.Length() ) - stdDoc()->ChangeStorageFormat( format ); - - status = app->SaveAs( stdDoc(), path ) == CDF_SS_OK; - } - } - catch ( Standard_Failure ) { - status = false; - } - - if ( status ) - status = SUIT_Study::saveDocumentAs( fname ); - - if ( status ) - myModifiedCnt = 0; - - return status; -} - -/*! - \brief Open OCAF transaction. - \return \c true if transaction is opened successfully -*/ -bool CAF_Study::openTransaction() -{ - if ( myStdDoc.IsNull() ) - return false; - - bool res = true; - try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 - OCC_CATCH_SIGNALS; -#endif - if ( myStdDoc->HasOpenCommand() ) - myStdDoc->AbortCommand(); - - myStdDoc->OpenCommand(); - } - catch ( Standard_Failure ) { - res = false; - } - - return res; -} - -/*! - \brief Abort OCAF transaction. - \return \c true if transaction is aborted successfully -*/ -bool CAF_Study::abortTransaction() -{ - if ( myStdDoc.IsNull() ) - return false; - - bool res = true; - try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 - OCC_CATCH_SIGNALS; -#endif - myStdDoc->AbortCommand(); - update(); - } - catch ( Standard_Failure ) { - res = false; - } - return res; -} - -/*! - \brief Commit OCAF transaction - \return \c true if transaction is committed successfully -*/ -bool CAF_Study::commitTransaction( const QString& name ) -{ - if ( myStdDoc.IsNull() ) - return false; - - bool res = true; - try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 - OCC_CATCH_SIGNALS; -#endif - myStdDoc->CommitCommand(); - - if ( canUndo() ) - { - Handle(TDF_Delta) d = myStdDoc->GetUndos().Last(); - if ( !d.IsNull() ) - d->SetName( CAF_Tools::toExtString( name ) ); - } - } - catch ( Standard_Failure ) { - res = false; - } - return res; -} - -/*! - \brief Check if there is any transaction opened. - \return \c true if there is opened OCAF transaction -*/ -bool CAF_Study::hasTransaction() const -{ - if ( myStdDoc.IsNull() ) - return false; - - return myStdDoc->HasOpenCommand(); -} - -/*! - \brief Check if the study is saved. - \return \c true if the document has been saved to file -*/ -bool CAF_Study::isSaved() const -{ - if ( myStdDoc.IsNull() ) - return false; - - return myStdDoc->IsSaved(); -} - -/*! - \brief Check if the study is modified. - \return \c true if the document has been modified -*/ -bool CAF_Study::isModified() const -{ - if ( myStdDoc.IsNull() ) - return false; - -// return myStdDoc->IsModified(); - return myModifiedCnt; -} - -/*! - \brief Increment modifications count. - - If \a undoable is \c true, this modification can be rolled back by - undoModified(), otherwise the document will be marked as \c modified - until it is saved. - - \param undoable if \c true the operation is undoable - \sa undoModified(), clearModified() -*/ -void CAF_Study::doModified( bool undoable ) -{ - if ( myStdDoc.IsNull() ) - return; - - myModifiedCnt++; - - /* Assumed that number of available undos / redos is NOT changed dynamically */ - if ( !undoable ) - myModifiedCnt += myStdDoc->GetAvailableUndos(); -} - -/*! - \brief Decrement modifications count. - \sa doModified(), clearModified() -*/ -void CAF_Study::undoModified() -{ - myModifiedCnt--; -} - -/*! - \brief Clear modifications count. - \sa doModified(), undoModified() -*/ -void CAF_Study::clearModified() -{ - myModifiedCnt = 0; -} - -/*! - \brief Undo the last command. - \return \c true on success and \c false on error -*/ -bool CAF_Study::undo() -{ - if ( myStdDoc.IsNull() ) - return false; - - try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 - OCC_CATCH_SIGNALS; -#endif - myStdDoc->Undo(); - undoModified(); /* decrement modification counter */ - } - catch ( Standard_Failure ) { - SUIT_MessageBox::critical(application()->desktop(), tr( "ERR_ERROR" ), - tr( "ERR_DOC_UNDO" )); - return false; - } - return true; -} - -/*! - \brief Redo the last undo. - \return \c true on success and \c false on error -*/ -bool CAF_Study::redo() -{ - if ( myStdDoc.IsNull() ) - return false; - - try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 - OCC_CATCH_SIGNALS; -#endif - myStdDoc->Redo(); - doModified(); /* increment modification counter */ - } - catch ( Standard_Failure ) { - SUIT_MessageBox::critical( application()->desktop(), tr( "ERR_ERROR" ), - tr( "ERR_DOC_REDO" ) ); - return false; - } - return true; -} - -/*! - \brief Check if it is possible to undo last command. - \return \c true if undo is avaiable -*/ -bool CAF_Study::canUndo() const -{ - if ( myStdDoc.IsNull() ) - return false; - - return myStdDoc->GetAvailableUndos() > 0; -} - -/*! - \brief Check if it is possible to redo last undo. - \return \c true if redo is avaiable -*/ -bool CAF_Study::canRedo() const -{ - if ( myStdDoc.IsNull() ) - return false; - - return myStdDoc->GetAvailableRedos() > 0; -} - -/*! - \brief Get names of available undo commands. - \return list of commands names -*/ -QStringList CAF_Study::undoNames() const -{ - QStringList names; - if ( !myStdDoc.IsNull() ) - { - for ( TDF_ListIteratorOfDeltaList it( myStdDoc->GetUndos() ); it.More(); it.Next() ) - names.prepend( CAF_Tools::toQString( it.Value()->Name() ) ); - } - return names; -} - -/*! - \brief Get names of available redo commands. - \return list of commands names -*/ -QStringList CAF_Study::redoNames() const -{ - QStringList names; - if ( !myStdDoc.IsNull() ) - { - for ( TDF_ListIteratorOfDeltaList it( myStdDoc->GetRedos() ); it.More(); it.Next() ) - names.append( CAF_Tools::toQString( it.Value()->Name() ) ); - } - return names; -} - -/*! - \brief Get OCAF application. - \return handle to the OCAF application object -*/ -Handle(TDocStd_Application) CAF_Study::stdApp() const -{ - Handle(TDocStd_Application) stdApp; - CAF_Application* app = cafApplication(); - if ( app ) - stdApp = app->stdApp(); - return stdApp; -} - -/*! - \brief Get application. - \return application object (CAF_Application) -*/ -CAF_Application* CAF_Study::cafApplication() const -{ - return qobject_cast( application() ); -} diff --git a/src/CAF/CAF_Study.h b/src/CAF/CAF_Study.h deleted file mode 100755 index f56d7bd49..000000000 --- a/src/CAF/CAF_Study.h +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 CAF_STUDY_H -#define CAF_STUDY_H - -#include "CAF.h" - -#include "SUIT_Study.h" - -#include - -class CAF_Application; -class Handle(TDocStd_Application); - -#if defined WIN32 -#pragma warning ( disable: 4251 ) -#endif - -class CAF_EXPORT CAF_Study : public SUIT_Study -{ - Q_OBJECT - -public: - CAF_Study( SUIT_Application* theApp ); - CAF_Study( SUIT_Application* theApp, Handle(TDocStd_Document)& aStdDoc ); - virtual ~CAF_Study(); - - virtual bool createDocument( const QString& ); - virtual void closeDocument( bool = true ); - virtual bool openDocument( const QString& ); - - virtual bool saveDocumentAs( const QString& ); - - bool isSaved() const; - bool isModified() const; - void doModified( bool = true ); - void undoModified(); - void clearModified(); - - bool undo(); - bool redo(); - bool canUndo() const; - bool canRedo() const; - QStringList undoNames() const; - QStringList redoNames() const; - - Handle(TDocStd_Document) stdDoc() const; - -protected: - Handle(TDocStd_Application) stdApp() const; - CAF_Application* cafApplication() const; - - virtual bool openTransaction(); - virtual bool abortTransaction(); - virtual bool hasTransaction() const; - virtual bool commitTransaction( const QString& = QString() ); - - virtual void setStdDoc( Handle(TDocStd_Document)& ); - -private: - Handle(TDocStd_Document) myStdDoc; - int myModifiedCnt; - - friend class CAF_Operation; -}; - -#if defined WIN32 -#pragma warning ( default: 4251 ) -#endif - -#endif diff --git a/src/CAF/CAF_Tools.cxx b/src/CAF/CAF_Tools.cxx deleted file mode 100755 index 138fd3791..000000000 --- a/src/CAF/CAF_Tools.cxx +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 : CAF_Tools.cxx -// Author : UI team - -#include "CAF_Tools.h" - -/*! - \class CAF_Tools - \brief Prodives a set of helpful static methods. -*/ - -/*! - \brief Convert TCollection_ExtendedString \a src to QString. - \param src string to be converted - \return resulting QString object -*/ -QString CAF_Tools::toQString ( const TCollection_ExtendedString& src ) -{ - return QString( (const QChar*)src.ToExtString(), src.Length() ); -} - -/*! - \brief Convert TCollection_AsciiString \a src to QString. - \param src string to be converted - \return resulting QString object -*/ -QString CAF_Tools::toQString( const TCollection_AsciiString& src ) -{ - return QString( src.ToCString() ); -} - -/*! - \brief Convert QString \a src to TCollection_AsciiString. - \param src string to be converted - \return resulting TCollection_AsciiString object -*/ -TCollection_AsciiString CAF_Tools::toAsciiString( const QString& src ) -{ - TCollection_AsciiString res; - if ( !src.isEmpty() ) - res = TCollection_AsciiString( src.toLatin1().data() ); - return res; -} - -/*! - \brief Convert QString \a src to TCollection_ExtendedString. - \param src string to be converted - \return resulting TCollection_ExtendedString object -*/ -TCollection_ExtendedString CAF_Tools::toExtString ( const QString& src ) -{ - TCollection_ExtendedString result; - for ( int i = 0; i < (int)src.length(); i++ ) - result.Insert( i + 1, src[ i ].unicode() ); - return result; -} - -/*! - \brief Convert QColor object to Quantity_Color object. - \param c color object in Qt format - \return color object in OCC format -*/ -Quantity_Color CAF_Tools::color( const QColor& c ) -{ - Quantity_Color aColor; - if ( c.isValid() ) - aColor = Quantity_Color( c.red() / 255., c.green() / 255., - c.blue() / 255., Quantity_TOC_RGB ); - return aColor; -} - -/*! - \brief Convert Quantity_Color object to QColor object. - \param c color object in OCC format - \return color object in Qt format -*/ -QColor CAF_Tools::color( const Quantity_Color& c ) -{ - return QColor ( int( c.Red() * 255 ), - int( c.Green() * 255 ), - int( c.Blue() * 255 ) ); -} diff --git a/src/CAF/CAF_Tools.h b/src/CAF/CAF_Tools.h deleted file mode 100755 index 4c0188b9a..000000000 --- a/src/CAF/CAF_Tools.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 : CAF_Tools.h -// Author : UI team - -#ifndef CAF_TOOLS_H -#define CAF_TOOLS_H - -#include - -#include - -#include - -#include - -#include -#include - -class CAF_EXPORT CAF_Tools : public SUIT_Tools -{ -public: - static QString toQString( const TCollection_AsciiString& ); - static QString toQString( const TCollection_ExtendedString& ); - - static TCollection_ExtendedString toExtString( const QString& ); - static TCollection_AsciiString toAsciiString( const QString& ); - - static Quantity_Color color( const QColor& ); - static QColor color( const Quantity_Color& ); -}; - -#endif diff --git a/src/CAF/Makefile.am b/src/CAF/Makefile.am deleted file mode 100755 index f1c06ce16..000000000 --- a/src/CAF/Makefile.am +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms 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 : Vladimir Klyachin (OCN) -# Module : caf -# $Header$ - -include $(top_srcdir)/adm_local/unix/make_common_starter.am - -lib_LTLIBRARIES = libcaf.la - -salomeinclude_HEADERS= \ - CAF.h \ - CAF_Application.h \ - CAF_Operation.h \ - CAF_Study.h \ - CAF_Tools.h - -dist_libcaf_la_SOURCES= \ - CAF_Application.cxx \ - CAF_Operation.cxx \ - CAF_Study.cxx \ - CAF_Tools.cxx - -MOC_FILES= \ - CAF_Application_moc.cxx \ - CAF_Operation_moc.cxx \ - CAF_Study_moc.cxx -nodist_libcaf_la_SOURCES= $(MOC_FILES) - -nodist_salomeres_DATA = \ - CAF_msg_en.qm - -libcaf_la_CPPFLAGS=$(QT_INCLUDES) $(CAS_CPPFLAGS) -I$(srcdir)/../STD -I$(srcdir)/../SUIT -I$(srcdir)/../Qtx -libcaf_la_LDFLAGS=$(QT_MT_LIBS) $(CAS_OCAF) $(CAS_OCAFVIS) -libcaf_la_LIBADD=../Qtx/libqtx.la ../SUIT/libsuit.la ../STD/libstd.la - diff --git a/src/CAF/resources/CAF_images.po b/src/CAF/resources/CAF_images.po deleted file mode 100755 index 083e77506..000000000 --- a/src/CAF/resources/CAF_images.po +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms 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: example-Qt-message-extraction\n" -"POT-Creation-Date: 1999-02-23 15:38+0200\n" -"PO-Revision-Date: 1999-02-23 15:38+0200\n" -"Last-Translator: \n" -"Content-Type: text/plain; charset=iso-8859-1\n" - -msgid "ICON_APP_EDIT_UNDO" -msgstr "undo.png" - -msgid "ICON_APP_EDIT_REDO" -msgstr "redo.png" diff --git a/src/CAF/resources/CAF_msg_en.po b/src/CAF/resources/CAF_msg_en.po deleted file mode 100755 index de9372fed..000000000 --- a/src/CAF/resources/CAF_msg_en.po +++ /dev/null @@ -1,67 +0,0 @@ -# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms 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: example-Qt-message-extraction\n" -"POT-Creation-Date: 1999-02-23 15:38+0200\n" -"PO-Revision-Date: 1999-02-23 15:38+0200\n" -"Last-Translator: \n" -"Content-Type: text/plain; charset=iso-8859-1\n" - -msgid "CAF_Application::ABOUT_INFO" -msgstr "SUIT Caf application" - -msgid "CAF_Application::MEN_APP_EDIT" -msgstr "&Edit" - -msgid "CAF_Application::MEN_DESK_EDIT" -msgstr "&Edit" - -msgid "CAF_Application::MEN_APP_EDIT_REDO" -msgstr "&Redo" - -msgid "CAF_Application::MEN_APP_EDIT_UNDO" -msgstr "&Undo" - -msgid "CAF_Application::PRP_APP_EDIT_REDO" -msgstr "Redoes the last operation" - -msgid "CAF_Application::PRP_APP_EDIT_UNDO" -msgstr "Undoes the last operation" - -msgid "CAF_Application::TOT_APP_EDIT_REDO" -msgstr "Redo" - -msgid "CAF_Application::TOT_APP_EDIT_UNDO" -msgstr "Undo" - -msgid "CAF_Application::INF_APP_UNDOACTIONS" -msgstr " Undoes %1 action(s) " - -msgid "CAF_Application::INF_APP_REDOACTIONS" -msgstr " Redoes %1 action(s) " - -msgid "CAF_Application::INF_ALL_DOCUMENTS_FILTER" -msgstr "All Readable Documents" - -msgid "CAF_Application::INF_ALL_FILTER" -msgstr "All Files (*.*)" diff --git a/src/CAF/resources/CAF_msg_en.ts b/src/CAF/resources/CAF_msg_en.ts deleted file mode 100644 index 78fed0911..000000000 --- a/src/CAF/resources/CAF_msg_en.ts +++ /dev/null @@ -1,57 +0,0 @@ - - - CAF_Application - - MEN_APP_EDIT - &Edit - - - INF_ALL_FILTER - All Files (*.*) - - - INF_ALL_DOCUMENTS_FILTER - All Readable Documents - - - MEN_DESK_EDIT - &Edit - - - MEN_APP_EDIT_UNDO - &Undo - - - MEN_APP_EDIT_REDO - &Redo - - - PRP_APP_EDIT_REDO - Redoes the last operation - - - PRP_APP_EDIT_UNDO - Undoes the last operation - - - TOT_APP_EDIT_REDO - Redo - - - TOT_APP_EDIT_UNDO - Undo - - - INF_APP_REDOACTIONS - Redoes %1 action(s) - - - INF_APP_UNDOACTIONS - Undoes %1 action(s) - - - ABOUT_INFO - SUIT Caf application - - - diff --git a/src/CASCatch/CASCatch.hxx b/src/CASCatch/CASCatch.hxx deleted file mode 100644 index c988ba61c..000000000 --- a/src/CASCatch/CASCatch.hxx +++ /dev/null @@ -1,58 +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 : CASCatch.hxx -// Author : Sergey RUIN, Open CASCADE S.A.S (sergey.ruin@opencascade.com) -// - -#ifndef CASCATCH_HXX -#define CASCATCH_HXX - -#include -#include - - -#ifdef try -# undef try -#endif - -#ifdef catch -# undef catch -#endif - -#ifdef NO_CXX_EXCEPTION -# if defined(DO_ABORT) -# define CASCatch_TRY \ - Standard_ErrorHandler _Function; \ - K_SETJMP = 1 ; \ - if(DoesNotAbort(_Function)) -# else // ! DO_ABORT -# define CASCatch_TRY \ - Standard_ErrorHandler _Function; \ - if(DoesNotAbort(_Function)) -# endif // DO_ABORT -# define CASCatch_CATCH(Error) \ - else if(_Function.Catches(STANDARD_TYPE(Error))) -#else // ! NO_CXX_EXCEPTION -# define CASCatch_TRY try -# define CASCatch_CATCH catch -#endif // NO_CXX_EXCEPTION - - -#endif // CASCATCH_HXX diff --git a/src/CASCatch/CASCatch_CatchSignals.cxx b/src/CASCatch/CASCatch_CatchSignals.cxx deleted file mode 100644 index b15d5305f..000000000 --- a/src/CASCatch/CASCatch_CatchSignals.cxx +++ /dev/null @@ -1,337 +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 : CASCatch_CatchSignals.cxx -// Author : Sergey RUIN, Open CASCADE S.A.S (sergey.ruin@opencascade.com) -// - -#include "CASCatch_CatchSignals.hxx" - -#include "CASCatch_Failure.hxx" -#include "CASCatch_ErrorHandler.hxx" -#include - -#define MAX_HANDLER_NUMBER 6 - - -//================================================================================ -/*! Public - - * \brief creates a CASCatch_CatchSignals - */ -//================================================================================ -CASCatch_CatchSignals::CASCatch_CatchSignals() - :myIsActivated(Standard_False) -{ - - Standard_Integer i = 0; - for(; i<=MAX_HANDLER_NUMBER; i++) - mySigStates[i] = NULL; -} - -#ifndef WNT - -//================================ UNIX part ================================================== - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef LIN -#include -#endif - -//============================== -typedef void (ACT_SIGIO_HANDLER)(void) ; - -ACT_SIGIO_HANDLER *ADR_ACT_SIGIO_HANDLER = NULL ; - -typedef void (* SIG_PFV) (int); - -#ifdef SUN -# include -#endif - -#ifdef SOLARIS -# include -# include -# include -# include -#endif - -#include -#include - -#ifdef LIN -# include -# include -#else -# ifdef SA_SIGINFO -# ifndef AIX -# include -# endif -# endif -#endif - - -#ifdef IRIX -# include -# include -#endif - - -//================================================================================ -/*! Private - - * \brief universal handler for signals - */ -//================================================================================ -static void Handler(const OSD_Signals theSig, const OSD_Signals) -{ - sigset_t set; - sigemptyset(&set); - sigaddset(&set, theSig); - sigprocmask(SIG_UNBLOCK, &set, NULL) ; - - TCollection_AsciiString aMessage(theSig); - aMessage+=" signal detected"; - - CASCatch_Failure::Raise(aMessage.ToCString()); -} - - -#ifdef SA_SIGINFO -//================================================================================ -/*! Private - - * \brief handler for SIGSEGV signal - */ -//================================================================================ -static void SegvHandler(const OSD_Signals, const Standard_Address, const Standard_Address) -{ - sigset_t set; - sigemptyset(&set); - sigaddset(&set, SIGSEGV); - sigprocmask (SIG_UNBLOCK, &set, NULL); - - CASCatch_Failure::Raise("SIGSEGV detected"); -} -#endif - - -//================================================================================ -/*! Public - - * \brief activates a signals handling - */ -//================================================================================ -void CASCatch_CatchSignals::Activate() -{ - if(myIsActivated) return; - - struct sigaction act; - - Standard_Integer i = 0; - for(; i<=MAX_HANDLER_NUMBER; i++) - mySigStates[i] = new struct sigaction(); //Initialize structures - - int stat; - act.sa_handler = (SIG_PFV) &Handler ; - sigemptyset(&act.sa_mask) ; - - - stat = sigaction(SIGHUP,&act,(struct sigaction*)mySigStates[0]); // ...... hangup - stat = sigaction(SIGFPE,&act,(struct sigaction*) mySigStates[1]); // ...... floating point exception - stat = sigaction(SIGINT,&act,(struct sigaction*)mySigStates[2]); // ...... interrupt - stat = sigaction(SIGQUIT,&act,(struct sigaction*)mySigStates[3]); // ...... quit - stat = sigaction(SIGBUS,&act,(struct sigaction*)mySigStates[4]); // ...... bus error - stat = sigaction(SIGILL,&act,(struct sigaction*)mySigStates[5]); // ...... illegal instruction - -#ifdef SA_RESTART - act.sa_flags = SA_RESTART ; -#else - act.sa_flags = 0 ; -#endif - act.sa_handler = (SIG_PFV) &SegvHandler ; - -#ifdef SA_SIGINFO // OSF,SOLARIS,IRIX - act.sa_flags = act.sa_flags | SA_SIGINFO ; -# ifdef SOLARIS - act.sa_sigaction = (void(*)(int, siginfo_t *, void*)) &SegvHandler ; -# endif -#endif - - stat = sigaction( SIGSEGV , &act , (struct sigaction*)mySigStates[6]); // ...... segmentation violation - - myIsActivated = Standard_True; -} - - -//================================================================================ -/*! Public - - * \brief deactivates a signals handling - */ -//================================================================================ -void CASCatch_CatchSignals::Deactivate() -{ - if(!myIsActivated) return; - - struct sigaction oact; - int stat; - - stat = sigaction(SIGHUP,(struct sigaction*)mySigStates[0],&oact); // ...... hangup - stat = sigaction(SIGFPE,(struct sigaction*)mySigStates[1],&oact); // ...... floating point exception - stat = sigaction(SIGINT,(struct sigaction*)mySigStates[2],&oact); // ...... interrupt - stat = sigaction(SIGQUIT,(struct sigaction*)mySigStates[3],&oact); // ...... quit - stat = sigaction(SIGBUS,(struct sigaction*)mySigStates[4],&oact); // ...... bus error - stat = sigaction(SIGILL,(struct sigaction*)mySigStates[5],&oact); // ...... illegal instruction - stat = sigaction(SIGSEGV,(struct sigaction*)mySigStates[6],&oact); // ...... segmentation violation - - - Standard_Integer i = 0; - for(; i<=MAX_HANDLER_NUMBER; i++) - delete (struct sigaction*)mySigStates[i]; - - myIsActivated = Standard_False; -} - - - -#else -//====================================== WNT part ==================================================== -#include - -#include -#include -#include - -#define _OSD_FPX ( _EM_DENORMAL | _EM_INEXACT | _EM_UNDERFLOW | _EM_ZERODIVIDE | _EM_OVERFLOW) //Mask these exceptions - -//================================================================================ -/*! Private - - * \brief handler for unexpected exceptions - */ -//================================================================================ -static Standard_Integer WntHandler(const Standard_Address theExceptionInfo) -{ - LPEXCEPTION_POINTERS lpXP = ( LPEXCEPTION_POINTERS )theExceptionInfo; - DWORD dwExceptionCode = lpXP -> ExceptionRecord -> ExceptionCode; - - TCollection_AsciiString aMessage((Standard_Integer)dwExceptionCode); - aMessage+=" Exception code - unexpected exception"; - - CASCatch_Failure::Raise(aMessage.ToCString()); - - return EXCEPTION_EXECUTE_HANDLER; -} - -void SIGWntHandler(int , int ) ; -static void (*SIGWNTHANDLER)(int) = ( void (*)(int) ) ( &SIGWntHandler ) ; - - -//================================================================================ -/*! Private - - * \brief handler for signals - */ -//================================================================================ -static void SIGWntHandler(const int signum , const int theCode) -{ - - void (*OLDSIGWNTHANDLER)(int) ; - switch( signum ) { - case SIGFPE : - _fpreset() ; - _clearfp() ; - _controlfp ( _OSD_FPX, _MCW_EM ); - OLDSIGWNTHANDLER = signal( signum , SIGWNTHANDLER ); - - if(theCode == _FPE_UNDERFLOW || theCode == _FPE_INEXACT) return; - CASCatch_Failure::Raise ("Floating point error"); - break; - case SIGSEGV : - OLDSIGWNTHANDLER = signal( signum , SIGWNTHANDLER ); - CASCatch_Failure::Raise("Access violation"); - break; - case SIGILL : - OLDSIGWNTHANDLER = signal( signum , SIGWNTHANDLER ); - CASCatch_Failure::Raise("Illegal instruction" ); - break; - } -} - - -//================================================================================ -/*! Public - - * \brief activates a signals handling - */ -//================================================================================ -void CASCatch_CatchSignals::Activate() -{ - if(myIsActivated) return; - - mySigStates[0] = SetUnhandledExceptionFilter (( LPTOP_LEVEL_EXCEPTION_FILTER )&WntHandler); - - myFloatOpWord = _controlfp(0, 0); - _controlfp ( _OSD_FPX, _MCW_EM ); //Enable floating point exceptions - - mySigStates[1] = signal( SIGSEGV , SIGWNTHANDLER ); - mySigStates[2] = signal( SIGFPE , SIGWNTHANDLER ); - mySigStates[3] = signal( SIGILL , SIGWNTHANDLER ); - - myIsActivated = Standard_True; -} - -//================================================================================ -/*! Public - - * \brief deactivates a signals handling - */ -//================================================================================ -void CASCatch_CatchSignals::Deactivate() -{ - if(!myIsActivated) return; - - SetUnhandledExceptionFilter (( LPTOP_LEVEL_EXCEPTION_FILTER )mySigStates[0]); - - _controlfp ( myFloatOpWord, _MCW_EM ); - - signal( SIGSEGV , ( void (*)(int) )mySigStates[1]); - signal( SIGFPE , ( void (*)(int) )mySigStates[2]); - signal( SIGILL , ( void (*)(int) )mySigStates[3]); - - Standard_Integer i = 0; - for(; i<=MAX_HANDLER_NUMBER; i++) - mySigStates[i] = NULL; - - myIsActivated = Standard_False; -} - -#endif - -//================================================================================ -/*! Private - - * \brief deactivates a signals handling - */ -//================================================================================ -void CASCatch_CatchSignals::Destroy() -{ - if(myIsActivated) Deactivate(); -} - diff --git a/src/CASCatch/CASCatch_CatchSignals.hxx b/src/CASCatch/CASCatch_CatchSignals.hxx deleted file mode 100644 index 126cace9f..000000000 --- a/src/CASCatch/CASCatch_CatchSignals.hxx +++ /dev/null @@ -1,66 +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 : CASCatch_CatchSignals.hxx -// Author : Sergey RUIN, Open CASCADE S.A.S (sergey.ruin@opencascade.com) -// - -#ifndef CASCATCH_CATCHSIGNALS_HXX -#define CASCATCH_CATCHSIGNALS_HXX - -#include - -/*! - * \class CASCatch_CatchSignals - * \brief This class controls an exception handling - * - */ -class CASCatch_CatchSignals { - -public: - - // Methods PUBLIC - // -Standard_EXPORT CASCatch_CatchSignals(); -Standard_EXPORT void Destroy() ; -~CASCatch_CatchSignals() { Destroy(); } -Standard_EXPORT void Activate() ; -Standard_EXPORT void Deactivate() ; - -private: - -/*!\var mySigStates[7], private - * \brief stores signals' handler functions - */ -Standard_Address mySigStates[7]; - -/*!\var myFloatOpWord - * \brief stores a float operation word, private - */ -Standard_Integer myFloatOpWord; - -/*!\var myIsActivated - * \brief stores a flag whether a catcher is activated, private] - */ -Standard_Boolean myIsActivated; - -}; - - -#endif // CASCATCH_CATCHSIGNALS_HXX diff --git a/src/CASCatch/CASCatch_ErrorHandler.cxx b/src/CASCatch/CASCatch_ErrorHandler.cxx deleted file mode 100644 index e9c8a1b87..000000000 --- a/src/CASCatch/CASCatch_ErrorHandler.cxx +++ /dev/null @@ -1,125 +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 : CASCatch_ErrorHandler.cxx -// Author : Sergey RUIN, Open CASCADE S.A.S (sergey.ruin@opencascade.com) -// - -#ifdef NO_CXX_EXCEPTION - -#include "CASCatch_ErrorHandler.hxx" - -// During setjmp()/longjmp() K_SETJMP_CASCatch is non zero (try) -// So if there is an abort request and if K_SETJMP_CASCatch is non zero, the abort -// request will be ignored. If the abort request do a raise during a setjmp -// or a longjmp, there will be a "terminating SEGV" impossible to handle. - - -Standard_EXPORT int K_SETJMP_CASCatch = 0 ; - -static Handle(CASCatch_Failure) GlbError; //Last caught Error, Null if there is no error - -static CASCatch_ErrorHandler* Top = 0; //The top of the Errors Stack - -//======================================================================= -//function : CASCatch_ErrorHandler -//purpose : Constructor -//======================================================================= -CASCatch_ErrorHandler::CASCatch_ErrorHandler () -{ - Previous = Top; - Top = this; - CaughtError.Nullify(); - GlbError.Nullify(); -} - -//======================================================================= -//function : ~CASCatch_ErrorHandler -//purpose : Destructor : Delete the ErrorHandler and Abort if there is a 'Error'. -//======================================================================= -CASCatch_ErrorHandler::~CASCatch_ErrorHandler() -{ - Top = Top->Previous; - if( !GlbError.IsNull() ) Abort(); -} - -//======================================================================= -//function : Abort: make a longjmp to the saved Context. -//purpose : Abort if there is a non null 'Error' -//======================================================================= -void CASCatch_ErrorHandler::Abort () -{ - //==== Check if can do the "longjmp" ======================================= - if(Top == NULL || Top->Label == NULL) { - cout << "*** Abort *** an exception was raised, but no catch was found." << endl; - cout << "\t... The exception is:" << GlbError; - exit(1); - } - -#ifdef DO_ABORT - if ( K_SETJMP_CASCatch ) - cout << "Recursive abort ===> Terminating SEGV ..." << endl ; - K_SETJMP_CASCatch = 1 ; -#endif - - longjmp(Top->Label, Standard_True); -} - -//======================================================================= -//function : Catches -//purpose : If there is a 'Error', and it is in good type -// returns True and clean 'Error', else returns False. -//======================================================================= -Standard_Boolean CASCatch_ErrorHandler::Catches - (const Handle(Standard_Type)& AType) -{ -#ifdef DO_ABORT - K_SETJMP_CASCatch = 0 ; -#endif - if(GlbError.IsNull()) - return Standard_False; - - if(GlbError->IsKind(AType)){ - CaughtError = GlbError; - GlbError.Nullify(); - return Standard_True; - } else { - return Standard_False; - } -} - -//======================================================================= -//function : LastCaughtError -//purpose : -//======================================================================= -Handle(CASCatch_Failure) CASCatch_ErrorHandler::LastCaughtError() -{ - return Top->CaughtError; -} - -//======================================================================= -//function : Error -//purpose : -//======================================================================= -void CASCatch_ErrorHandler::Error(const Handle(CASCatch_Failure)& aError) -{ - GlbError = aError; -} - -#endif diff --git a/src/CASCatch/CASCatch_ErrorHandler.hxx b/src/CASCatch/CASCatch_ErrorHandler.hxx deleted file mode 100644 index fefec1e8c..000000000 --- a/src/CASCatch/CASCatch_ErrorHandler.hxx +++ /dev/null @@ -1,95 +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 : CASCatch_ErrorHandler.hxx -// Author : Sergey RUIN, Open CASCADE S.A.S (sergey.ruin@opencascade.com) -// - -#ifndef CASCATCH_ERRORHANDLER_HXX -#define CASCATCH_ERRORHANDLER_HXX - -#include "CASCatch_Failure.hxx" - -#include -#include - - -extern int K_SETJMP_CASCatch ; - -/*! - * \class CASCatch_ErrorHandler - * \brief This class is an exception handler, private - * - */ -class CASCatch_ErrorHandler -{ - friend class CASCatch_Failure; // To execute the raise exception. - - public: - - Standard_EXPORT CASCatch_ErrorHandler(); - Standard_EXPORT ~CASCatch_ErrorHandler(); - Standard_EXPORT Standard_Boolean Catches (const Handle(Standard_Type)&); - - private: - Standard_EXPORT static void Abort(); - Standard_EXPORT static void Error(const Handle(CASCatch_Failure)&); - Standard_EXPORT static Handle(CASCatch_Failure) LastCaughtError(); - - //==== The fields =========================================================== - private: - CASCatch_ErrorHandler* Previous; - Handle(CASCatch_Failure) CaughtError; - - public: - jmp_buf Label; - -}; - -#undef CASCatch_TRY -#define CASCatch_TRY try - -#undef CASCatch_CATCH -#define CASCatch_CATCH catch - - -#ifdef NO_CXX_EXCEPTION -# undef CASCatch_TRY -# undef CASCatch_CATCH - -# if defined(DO_ABORT) - -# define DoesNotAbort_CASCatch(aHandler) !(K_SETJMP_CASCatch = setjmp(aHandler.Label)) - -# define CASCatch_TRY CASCatch_ErrorHandler _Function; \ - K_SETJMP_CASCatch = 1 ; \ - if(DoesNotAbort_CASCatch(_Function)) - -# else // ! DO_ABORT -# define DoesNotAbort_CASCatch(aHandler) !setjmp(aHandler.Label) - -# define CASCatch_TRY CASCatch_ErrorHandler _Function; \ - if(DoesNotAbort_CASCatch(_Function)) -# endif // DO_ABORT - - -# define CASCatch_CATCH(Error) else if(_Function.Catches(STANDARD_TYPE(Error))) -#endif // NO_CXX_EXCEPTION - -#endif // CASCATCH_ERRORHANDLER_HXX diff --git a/src/CASCatch/CASCatch_Failure.cxx b/src/CASCatch/CASCatch_Failure.cxx deleted file mode 100644 index 54eb73b06..000000000 --- a/src/CASCatch/CASCatch_Failure.cxx +++ /dev/null @@ -1,130 +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 : CASCatch_Failure.cxx -// Author : Sergey RUIN, Open CASCADE S.A.S (sergey.ruin@opencascade.com) -// - -#include "CASCatch_Failure.hxx" -#include "CASCatch_ErrorHandler.hxx" -#include -#include -#include - -IMPLEMENT_STANDARD_HANDLE( CASCatch_Failure, Standard_Transient ) -IMPLEMENT_STANDARD_RTTIEXT( CASCatch_Failure, Standard_Transient ) - - -#ifndef NO_CXX_EXCEPTION -static Handle(CASCatch_Failure) RaisedError; -#endif - -//================================================================================ -/*! Public - - * \brief creates a CASCatch_Failure - */ -//================================================================================ -CASCatch_Failure::CASCatch_Failure () { myMessage = "Signal detected";} - - -//================================================================================ -/*! Public - - * \brief creates a CASCatch_Failure with a message - * \param an exception message - */ -//================================================================================ -CASCatch_Failure::CASCatch_Failure (const Standard_CString AString) -{ - if(AString) { - myMessage = new Standard_Character[strlen(AString) + 1]; - strcpy(myMessage,AString); - } -} - -//================================================================================ -/*! Public - - * \brief returns the last caught exception - */ -//================================================================================ -Handle(CASCatch_Failure) CASCatch_Failure::Caught() -{ -#ifdef NO_CXX_EXCEPTION - return CASCatch_ErrorHandler::LastCaughtError(); -#else - return RaisedError ; -#endif -} - -//================================================================================ -/*! Public - - * \brief raises a CASCatch_Failure exception - * \param an exception message - */ -//================================================================================ -void CASCatch_Failure::Raise (const Standard_CString AString) -{ - Handle(CASCatch_Failure) E = new CASCatch_Failure() ; - E->Reraise (AString) ; -} - - -//================================================================================ -/*! Public - - * \brief re-raises a CASCatch_Failure exception - * \param an exception message - */ -//================================================================================ -void CASCatch_Failure::Reraise (const Standard_CString AString) -{ - if(AString){ - myMessage = new Standard_Character[strlen(AString) + 1]; - strcpy(myMessage,AString); - } - -#ifdef NO_CXX_EXCEPTION - CASCatch_ErrorHandler::Error(this) ; - CASCatch_ErrorHandler::Abort(); -#else - RaisedError = this ; - Throw() ; -#endif -} - -//================================================================================ -/*! Public - - * \brief returns an exception message - */ -//================================================================================ -Standard_CString CASCatch_Failure::GetError() const -{ - return myMessage; -} - -//================================================================================ -/*! Public - - * \brief Is called when using standard C++ exceptions - */ -//================================================================================ -void CASCatch_Failure::Throw() const -{ -#ifndef NO_CXX_EXCEPTION - throw CASCatch_Failure() ; -#endif -} - diff --git a/src/CASCatch/CASCatch_Failure.hxx b/src/CASCatch/CASCatch_Failure.hxx deleted file mode 100644 index 66e7dcd05..000000000 --- a/src/CASCatch/CASCatch_Failure.hxx +++ /dev/null @@ -1,64 +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 : CASCatch_Failure.hxx -// Author : Sergey RUIN, Open CASCADE S.A.S (sergey.ruin@opencascade.com) -// - -#ifndef CASCATCH_FAILURE_HXX -#define CASCATCH_FAILURE_HXX - -#include -#include -DEFINE_STANDARD_HANDLE( CASCatch_Failure, Standard_Transient ) - -#include - -/*! - * \class CASCatch_Failure - * \brief This class presents an exception to be thrown - * - */ -class CASCatch_Failure : public Standard_Transient -{ - -public: - -Standard_EXPORT CASCatch_Failure(); -Standard_EXPORT CASCatch_Failure(const Standard_CString aString); -Standard_EXPORT void Reraise(const Standard_CString aMessage) ; -Standard_EXPORT Standard_CString GetError() const; -Standard_EXPORT static Handle_CASCatch_Failure Caught() ; -Standard_EXPORT static void Raise(const Standard_CString aMessage = "") ; -Standard_EXPORT virtual void Throw() const;public: - -public: - -DEFINE_STANDARD_RTTI( CASCatch_Failure ) - -private: -/*!\var myMessage - * \brief stores an exception message - */ -Standard_CString myMessage; - -}; - - -#endif // CASCATCH_FAILURE_HXX diff --git a/src/CASCatch/Makefile.am b/src/CASCatch/Makefile.am deleted file mode 100644 index 9800bfac3..000000000 --- a/src/CASCatch/Makefile.am +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (C) 2005 OPEN CASCADE, CEA, EDF R&D, LEG -# PRINCIPIA R&D, EADS CCR, Lip6, BV, CEDRAT -# This library is free software; you can redistribute it and/or -# modify it under the terms 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 : Sergey RUIN, Open CASCADE S.A.S (sergey.ruin@opencascade.com) -# - -include $(top_srcdir)/adm_local/unix/make_common_starter.am - - -salomeinclude_HEADERS = CASCatch.hxx \ - CASCatch_CatchSignals.hxx \ - CASCatch_ErrorHandler.hxx \ - CASCatch_Failure.hxx - -lib_LTLIBRARIES = libCASCatch.la -libCASCatch_la_SOURCES = \ - CASCatch_CatchSignals.cxx \ - CASCatch_ErrorHandler.cxx \ - CASCatch_Failure.cxx - -COMMON_CPPFLAGS = \ - @CAS_CPPFLAGS@ @CAS_CXXFLAGS@ - -libCASCatch_la_CPPFLAGS = $(COMMON_CPPFLAGS) -libCASCatch_la_LIBADD = $(CAS_KERNEL) diff --git a/src/OCCViewer/Makefile.am b/src/OCCViewer/Makefile.am deleted file mode 100755 index fa15a4b65..000000000 --- a/src/OCCViewer/Makefile.am +++ /dev/null @@ -1,106 +0,0 @@ -# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms 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 : Vladimir Klyachin (OCN) -# Module : OCCViewer -# $Header$ - -include $(top_srcdir)/adm_local/unix/make_common_starter.am - -lib_LTLIBRARIES = libOCCViewer.la - -salomeinclude_HEADERS= \ - OCCViewer_AISSelector.h \ - OCCViewer_ViewManager.h \ - OCCViewer_ViewModel.h \ - OCCViewer_ViewPort3d.h \ - OCCViewer_ViewPort.h \ - OCCViewer_ViewSketcher.h \ - OCCViewer_ViewWindow.h \ - OCCViewer_VService.h \ - OCCViewer_CreateRestoreViewDlg.h \ - OCCViewer.h \ - OCCViewer_ClippingDlg.h \ - OCCViewer_AxialScaleDlg.h \ - OCCViewer_SetRotationPointDlg.h \ - OCCViewer_Trihedron.h - -dist_libOCCViewer_la_SOURCES= \ - OCCViewer.cxx \ - OCCViewer_AISSelector.cxx \ - OCCViewer_ViewManager.cxx \ - OCCViewer_ViewModel.cxx \ - OCCViewer_ViewPort3d.cxx \ - OCCViewer_ViewPort.cxx \ - OCCViewer_ViewSketcher.cxx \ - OCCViewer_ViewWindow.cxx \ - OCCViewer_VService.cxx \ - OCCViewer_CreateRestoreViewDlg.cxx \ - OCCViewer_SetRotationPointDlg.cxx \ - OCCViewer_ClippingDlg.cxx \ - OCCViewer_AxialScaleDlg.cxx \ - OCCViewer_Trihedron.cxx - -MOC_FILES= \ - OCCViewer_AISSelector_moc.cxx \ - OCCViewer_ViewModel_moc.cxx \ - OCCViewer_ViewPort3d_moc.cxx \ - OCCViewer_ViewPort_moc.cxx \ - OCCViewer_ViewSketcher_moc.cxx \ - OCCViewer_ViewWindow_moc.cxx \ - OCCViewer_ViewManager_moc.cxx \ - OCCViewer_CreateRestoreViewDlg_moc.cxx \ - OCCViewer_SetRotationPointDlg_moc.cxx \ - OCCViewer_ClippingDlg_moc.cxx \ - OCCViewer_AxialScaleDlg_moc.cxx -nodist_libOCCViewer_la_SOURCES= $(MOC_FILES) - -dist_salomeres_DATA = \ - resources/occ_view_back.png \ - resources/occ_view_bottom.png \ - resources/occ_view_camera_dump.png \ - resources/occ_view_clone.png \ - resources/occ_view_clipping.png \ - resources/occ_view_clipping_pressed.png \ - resources/occ_view_scaling.png \ - resources/occ_view_fitall.png \ - resources/occ_view_fitarea.png \ - resources/occ_view_front.png \ - resources/occ_view_glpan.png \ - resources/occ_view_left.png \ - resources/occ_view_pan.png \ - resources/occ_view_presets.png \ - resources/occ_view_reset.png \ - resources/occ_view_right.png \ - resources/occ_view_rotate.png \ - resources/occ_view_shoot.png \ - resources/occ_view_top.png \ - resources/occ_view_triedre.png \ - resources/occ_view_zoom.png \ - resources/occ_view_rotation_point.png - -nodist_salomeres_DATA = \ - OCCViewer_images.qm \ - OCCViewer_msg_en.qm - -libOCCViewer_la_CPPFLAGS=$(QT_INCLUDES) $(OGL_INCLUDES) $(CAS_CPPFLAGS) \ - -I$(srcdir)/../SUIT -I$(srcdir)/../Qtx - -libOCCViewer_la_LDFLAGS=$(OGL_LIBS) $(QT_MT_LIBS) $(CAS_KERNEL) $(CAS_VIEWER) -lTKOpenGl -libOCCViewer_la_LIBADD=../Qtx/libqtx.la ../SUIT/libsuit.la diff --git a/src/OCCViewer/OCCViewer.cxx b/src/OCCViewer/OCCViewer.cxx deleted file mode 100644 index 14640ffa3..000000000 --- a/src/OCCViewer/OCCViewer.cxx +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 - -#include -#include - -void OCCViewer_Init(); - -extern "C" -{ -#ifdef WNT /* disable MS VC++ warning on C-style function returning C++ object */ -#pragma warning(push) -#pragma warning(disable:4190) -#endif - Standard_EXPORT Handle( Graphic3d_GraphicDriver ) MetaGraphicDriverFactory( const Standard_CString AShrName ) - { - OCCViewer_Init(); - Handle( OpenGl_GraphicDriver ) aDriver = new OpenGl_GraphicDriver( AShrName ); - return aDriver; - } -#ifdef WNT -#pragma warning(pop) -#endif - -#include -#include -#include -#include -#include - - TStatus OCCViewer_DisplayTrihedron ( TSM_ELEM_DATA, Tint, cmn_key* ); - TStatus OCCViewer_AddTrihedron ( TSM_ELEM_DATA, Tint, cmn_key* ); - TStatus OCCViewer_DeleteTrihedron ( TSM_ELEM_DATA, Tint, cmn_key* ); -} - - -TStatus OCCViewer_AddTrihedron( TSM_ELEM_DATA d, Tint n, cmn_key* k ) -{ - // Retrieve the userdraw structure - Graphic3d_CUserDraw *userdraw = ( Graphic3d_CUserDraw* )( k[0]->data.pdata ); - if ( !userdraw ) - return TFailure; - - // Retrieve the user structure - OCCViewer_Trihedron* userdata = ( OCCViewer_Trihedron* )( userdraw->Data ); - if ( !userdata ) - return TFailure; - - ( ( tsm_elem_data )( d.pdata ) )->pdata = ( void* )userdata; - - // Evaluate minmax if needed - if( userdraw->Bounds && userdata ) - userdata->bounds( *( userdraw->Bounds ) ); - - return TSuccess; -} - -TStatus OCCViewer_DeleteTrihedron( TSM_ELEM_DATA d, Tint n, cmn_key* k ) -{ - delete ( OCCViewer_Trihedron* )( d.pdata ); - return TSuccess; -} - -TStatus OCCViewer_DisplayTrihedron( TSM_ELEM_DATA d, Tint n, cmn_key* k ) -{ - ( ( OCCViewer_Trihedron* )( d.pdata ) )->display(); - return TSuccess; -} - -void OCCViewer_Init() -{ - //PickTraverse=0 - //DisplayTraverse=1 - //Add=2 - //Delete=3 - //Print=4 - //Inquire=5 - MtblPtr theCallbacks = GetCallbackTable(); - theCallbacks[DisplayTraverse] = OCCViewer_DisplayTrihedron; - theCallbacks[Add] = OCCViewer_AddTrihedron; - theCallbacks[Delete] = OCCViewer_DeleteTrihedron; -} diff --git a/src/OCCViewer/OCCViewer.h b/src/OCCViewer/OCCViewer.h deleted file mode 100755 index 199ca6a44..000000000 --- a/src/OCCViewer/OCCViewer.h +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 -// -#ifdef WIN32 -#ifdef OCCVIEWER_EXPORTS -#define OCCVIEWER_EXPORT __declspec(dllexport) -#else -#define OCCVIEWER_EXPORT __declspec(dllimport) -#endif -#else -#define OCCVIEWER_EXPORT -#endif - -#if defined WIN32 -#pragma warning ( disable: 4251 ) -#endif diff --git a/src/OCCViewer/OCCViewer.pro b/src/OCCViewer/OCCViewer.pro deleted file mode 100644 index facc53204..000000000 --- a/src/OCCViewer/OCCViewer.pro +++ /dev/null @@ -1,61 +0,0 @@ -TEMPLATE = lib -TARGET = OCCViewer -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -OGL_INCLUDES = - -OGL_LIBS = -lGL -L/usr/X11R6/lib -lGLU - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -CAS_KERNEL = -L$${CASROOT}/Linux/lib -lTKernel - -CAS_VIEWER = -L$${CASROOT}/Linux/lib -lTKV3d -lTKService - -INCLUDEPATH += ../../include $${OGL_INCLUDES} $${CAS_CPPFLAGS} ../Qtx ../SUIT -LIBS += -L../../lib -lqtx -lsuit $${OGL_LIBS} $${CAS_KERNEL} $${CAS_VIEWER} - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += OCCVIEWER_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS - -HEADERS = OCCViewer_AISSelector.h -HEADERS += OCCViewer_ViewManager.h -HEADERS += OCCViewer_ViewModel.h -HEADERS += OCCViewer_ViewPort3d.h -HEADERS += OCCViewer_ViewPort.h -HEADERS += OCCViewer_ViewWindow.h -HEADERS += OCCViewer_VService.h -HEADERS += OCCViewer_CreateRestoreViewDlg.h -HEADERS += OCCViewer.h -HEADERS += OCCViewer_ClippingDlg.h -HEADERS += OCCViewer_SetRotationPointDlg.h - -SOURCES = OCCViewer_AISSelector.cxx -SOURCES += OCCViewer_ViewManager.cxx -SOURCES += OCCViewer_ViewModel.cxx -SOURCES += OCCViewer_ViewPort3d.cxx -SOURCES += OCCViewer_ViewPort.cxx -SOURCES += OCCViewer_ViewWindow.cxx -SOURCES += OCCViewer_VService.cxx -SOURCES += OCCViewer_CreateRestoreViewDlg.cxx -SOURCES += OCCViewer_SetRotationPointDlg.cxx -SOURCES += OCCViewer_ClippingDlg.cxx - -TRANSLATIONS = resources/OCCViewer_images.ts \ - resources/OCCViewer_msg_en.ts - -ICONS = resources/*.png - -includes.files = $$HEADERS -includes.path = ../../include - -resources.files = $$ICONS resources/*.qm -resources.path = ../../resources - -INSTALLS += includes resources diff --git a/src/OCCViewer/OCCViewer_AISSelector.cxx b/src/OCCViewer/OCCViewer_AISSelector.cxx deleted file mode 100755 index 43dca4567..000000000 --- a/src/OCCViewer/OCCViewer_AISSelector.cxx +++ /dev/null @@ -1,223 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 "OCCViewer_AISSelector.h" - -/*! - Constructor -*/ -OCCViewer_AISSelector::OCCViewer_AISSelector( QObject* parent, - const Handle (AIS_InteractiveContext)& aisContext) : - QObject( parent ), - myNumSelected( 0 ), - myEnableSelection( true ), - myEnableMultipleSelection( true ) -{ - myHilightColor = Quantity_NOC_CYAN1; - mySelectColor = Quantity_NOC_GRAY80; - - setAISContext( aisContext ); -} - -/*! - Destructor -*/ -OCCViewer_AISSelector::~OCCViewer_AISSelector() -{ -} - -/*! - Enables/disables selection -*/ -void OCCViewer_AISSelector::enableSelection( bool bEnable ) -{ - myEnableSelection = bEnable; -} - -/*! - Enables/disables multiple selection i.e - selection of several objects at the same time. -*/ -void OCCViewer_AISSelector::enableMultipleSelection( bool bEnable ) -{ - myEnableMultipleSelection = bEnable; - if ( bEnable ) myEnableSelection = bEnable; -} - -/*! - Sets the color to hilight the detected objects -*/ -void OCCViewer_AISSelector::setHilightColor ( Quantity_NameOfColor color ) -{ - myHilightColor = color; - if ( !myAISContext.IsNull() ) - myAISContext->SetHilightColor( myHilightColor ); -} - -/*! - Sets the color to display the selected objects -*/ -void OCCViewer_AISSelector::setSelectColor ( Quantity_NameOfColor color ) -{ - mySelectColor = color; - if ( !myAISContext.IsNull() ) - myAISContext->SelectionColor( mySelectColor ); -} - -/*! - Sets the interactive context for this selector -*/ -void OCCViewer_AISSelector::setAISContext ( const Handle (AIS_InteractiveContext)& aisContext ) -{ - myAISContext = aisContext; - if ( ! myAISContext.IsNull() ) { - myAISContext->SetHilightColor( myHilightColor ); - myAISContext->SelectionColor( mySelectColor ); - myAISContext->SetSubIntensityColor( Quantity_NOC_CYAN1 ); - } -} - -/*! - Checks the status of pick and emits 'selSelectionDone' or - 'selSelectionCancel'. - Returns 'true' if no error, 'false' otherwise. -*/ -bool OCCViewer_AISSelector::checkSelection ( AIS_StatusOfPick status, - bool hadSelection, - bool addTo ) -{ - if ( myAISContext.IsNull() ) - return false; - - myNumSelected = myAISContext->NbCurrents(); /* update after the last selection */ - - if ( status == AIS_SOP_NothingSelected && !hadSelection ) { - emit selSelectionCancel( addTo ); - } - else if ( status == AIS_SOP_NothingSelected && hadSelection ) { - emit selSelectionCancel( addTo ); /* unselected now */ - } - else if ( status == AIS_SOP_OneSelected || status == AIS_SOP_SeveralSelected ) - { - emit selSelectionDone( addTo ); /* selected ( the same object, may be ) */ - } - return ( status != AIS_SOP_Error && status != AIS_SOP_NothingSelected ); -} - -/*! - Detects the interactive objects at position (x,y). - Returns 'true' if no error, 'false' otherwise. -*/ -bool OCCViewer_AISSelector::moveTo ( int x, int y, const Handle (V3d_View)& view ) -{ - if ( myAISContext.IsNull() ) - return false; - - if ( !myEnableSelection ) - return false; - - AIS_StatusOfDetection status = AIS_SOD_Error; - status = myAISContext->MoveTo (x, y, view); - - return ( status != AIS_SOD_Error && status != AIS_SOD_AllBad ); -} - -/*! - Selects the detected interactive objects. - Calls checkSelection() for checking the status. -*/ -bool OCCViewer_AISSelector::select () -{ - if ( myAISContext.IsNull() ) - return false; - - if ( !myEnableSelection ) - return false; - - bool hadSelection = ( myNumSelected > 0 ); - - /* select and send notifications */ - return checkSelection ( myAISContext->Select(), hadSelection, false ); -} - -/*! - Selects the objects covered by the rectangle. - Multiple selection must be enabled to get use of this function. - Calls checkSelection() for checking the status. -*/ -bool OCCViewer_AISSelector::select ( int left, int top, int right, int bottom, - const Handle (V3d_View)& view ) -{ - if ( myAISContext.IsNull() ) - return false; - - if ( !myEnableSelection || !myEnableMultipleSelection ) - return false; /* selection with rectangle is considered as multiple selection */ - - bool hadSelection = ( myNumSelected > 0 ); - - /* select and send notifications */ - return checkSelection ( myAISContext->Select(left, top, right, bottom, view), - hadSelection, false ); -} - -/*! - Adds new selected objects to the objects previously selected. - Multiple selection must be enabled to get use of this function. - Calls checkSelection() for checking the status. -*/ -bool OCCViewer_AISSelector::shiftSelect () -{ - if ( myAISContext.IsNull() ) - return false; - - if ( !myEnableSelection ) - return false; - - bool hadSelection = ( myNumSelected > 0 ); /* something was selected */ - if ( hadSelection && !myEnableMultipleSelection) - return false; - - /* select and send notifications */ - return checkSelection ( myAISContext->ShiftSelect(), hadSelection, true ); -} - -/*! - Adds new selected objects covered by the rectangle to the objects - previously selected. - Multiple selection must be enabled to get use of this function. - Calls checkSelection() for checking the status. -*/ -bool OCCViewer_AISSelector::shiftSelect ( int left, int top, int right, int bottom, - const Handle (V3d_View)& view ) - -{ - if ( myAISContext.IsNull() ) - return false; - - if ( !myEnableSelection || !myEnableMultipleSelection ) - return false; /* selection with rectangle is considered as multiple selection */ - - bool hadSelection = ( myNumSelected > 0 ); /* something was selected */ - if ( hadSelection && !myEnableMultipleSelection) - return false; - - /* select and send notifications */ - return checkSelection ( myAISContext->ShiftSelect(left,top,right,bottom, view), - hadSelection, true ); -} diff --git a/src/OCCViewer/OCCViewer_AISSelector.h b/src/OCCViewer/OCCViewer_AISSelector.h deleted file mode 100755 index 66267f938..000000000 --- a/src/OCCViewer/OCCViewer_AISSelector.h +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 -// -#if !defined( OCCVIEWER_AISSELECTOR_H ) -#define OCCVIEWER_AISSELECTOR_H - -#include "OCCViewer.h" -#include - -#include -#include - -class OCCVIEWER_EXPORT OCCViewer_AISSelector : public QObject -{ - Q_OBJECT - -public: - // constructor - OCCViewer_AISSelector( QObject* parent, const Handle (AIS_InteractiveContext)& ); - // destructor - ~OCCViewer_AISSelector(); - - // enables/disables selection - void enableSelection( bool ); - // enables/disables multiple selection - void enableMultipleSelection( bool ); - - // detects the interactive objects at position (x,y). - bool moveTo ( int, int, const Handle (V3d_View)& ); - // selects the objects covered by the rectangle. - bool select ( int, int, int, int, const Handle (V3d_View)& ); - // adds new selected objects covered by the rectangle to the objects - // previously selected. - bool shiftSelect ( int, int, int, int, const Handle (V3d_View)& ); - // selects the detected interactive objects. - bool select (); - // adds new selected objects to the objects previously selected. - bool shiftSelect (); - - // sets the interactive context for this selector - void setAISContext ( const Handle (AIS_InteractiveContext)& ); - // sets the color to hilight the detected objects - void setHilightColor ( Quantity_NameOfColor color ); - // sets the color to display the selected objects - void setSelectColor ( Quantity_NameOfColor color ); - -protected: - // checks the status of pick and emits 'selSelectionDone' or 'selSelectionCancel'. - bool checkSelection ( AIS_StatusOfPick status, bool hadSelection, bool addTo ); - -signals: - // 'selection done' signal - void selSelectionDone( bool bAdded ); - // 'selection cancelled' signal - void selSelectionCancel( bool bAdded ); - -protected: - Handle (AIS_InteractiveContext) myAISContext; // graphic context - Quantity_NameOfColor myHilightColor; // color for hilight object - Quantity_NameOfColor mySelectColor; // color for selected object - - int myNumSelected; // nymber of selected objects - bool myEnableSelection; // enable selection flag - bool myEnableMultipleSelection; // enable multiple selection flag -}; - -#endif // OCCVIEWER_AISSELECTOR_H diff --git a/src/OCCViewer/OCCViewer_AxialScaleDlg.cxx b/src/OCCViewer/OCCViewer_AxialScaleDlg.cxx deleted file mode 100644 index 72d0fbd51..000000000 --- a/src/OCCViewer/OCCViewer_AxialScaleDlg.cxx +++ /dev/null @@ -1,178 +0,0 @@ -// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 "OCCViewer_AxialScaleDlg.h" -#include "OCCViewer_ViewWindow.h" -#include "OCCViewer_ViewPort3d.h" - -#include - -#include -#include -#include -#include -#include - -/*! - \class OCCViewer_AxialScaleDlg - \brief Dialog allowing to assign parameters of axes scaling -*/ - -/*! - \brief Constructor - \param view - view window - \param parent - parent widget -*/ -OCCViewer_AxialScaleDlg::OCCViewer_AxialScaleDlg( OCCViewer_ViewWindow* view, QWidget* parent ) - : QDialog( parent ), - myView( view ) -{ - setWindowTitle( tr( "DLG_SCALING" ) ); - setModal( false ); - setSizeGripEnabled( true ); - - // Create layout for this dialog - QVBoxLayout* layoutDlg = new QVBoxLayout( this ); - layoutDlg->setSpacing( 6 ); - layoutDlg->setMargin( 11 ); - - // Create croup box with grid layout - QGroupBox* aGroupBox = new QGroupBox( this ); - QHBoxLayout* aHBoxLayout = new QHBoxLayout( aGroupBox ); - aHBoxLayout->setMargin( 11 ); - aHBoxLayout->setSpacing( 6 ); - - // "X" scaling - QLabel* TextLabelX = new QLabel( tr( "LBL_X" ), aGroupBox ); - m_sbXcoeff = new QtxDoubleSpinBox( 1e-7, RealLast(), 0.1, aGroupBox ); - m_sbXcoeff->setMinimumWidth( 80 ); - m_sbXcoeff->setValue( 1.0 ); - - // "Y" scaling - QLabel* TextLabelY = new QLabel( tr( "LBL_Y" ), aGroupBox ); - m_sbYcoeff = new QtxDoubleSpinBox( 1e-7, RealLast(), 0.1, aGroupBox ); - m_sbYcoeff->setMinimumWidth( 80 ); - m_sbYcoeff->setValue( 1.0 ); - - // "Z" scaling - QLabel* TextLabelZ = new QLabel( tr( "LBL_Z" ), aGroupBox ); - m_sbZcoeff = new QtxDoubleSpinBox( 1e-7, RealLast(), 0.1, aGroupBox ); - m_sbZcoeff->setMinimumWidth( 80 ); - m_sbZcoeff->setValue( 1.0 ); - - // Create button - m_bReset = new QPushButton( tr( "&Reset" ), aGroupBox ); - - // Layout widgets in the group box - aHBoxLayout->addWidget( TextLabelX ); - aHBoxLayout->addWidget( m_sbXcoeff ); - aHBoxLayout->addWidget( TextLabelY ); - aHBoxLayout->addWidget( m_sbYcoeff ); - aHBoxLayout->addWidget( TextLabelZ ); - aHBoxLayout->addWidget( m_sbZcoeff ); - aHBoxLayout->addSpacing( 10 ); - aHBoxLayout->addWidget( m_bReset ); - - // OK, CANCEL, Apply button - QGroupBox* aGroupBox2 = new QGroupBox( this ); - QHBoxLayout* aHBoxLayout2 = new QHBoxLayout( aGroupBox2 ); - aHBoxLayout2->setMargin( 11 ); - aHBoxLayout2->setSpacing( 6 ); - // Create button - QPushButton* m_bOk = new QPushButton( tr( "O&K" ), aGroupBox2 ); - m_bOk->setDefault( true ); - m_bOk->setAutoDefault( true ); - // Create button - QPushButton* m_bApply = new QPushButton( tr( "&Apply" ), aGroupBox2 ); - m_bApply->setAutoDefault( true ); - // Create button - QPushButton* m_bCancel = new QPushButton( tr( "&Cancel" ), aGroupBox2 ); - m_bCancel->setAutoDefault( true ); - - // Layout buttons - aHBoxLayout2->addWidget( m_bOk ); - aHBoxLayout2->addWidget( m_bApply ); - aHBoxLayout2->addSpacing( 10 ); - aHBoxLayout2->addStretch(); - aHBoxLayout2->addWidget( m_bCancel ); - - // Layout top level widgets - layoutDlg->addWidget( aGroupBox ); - layoutDlg->addWidget( aGroupBox2 ); - - // signals and slots connections - connect( m_bCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); - connect( m_bOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); - connect( m_bApply, SIGNAL( clicked() ), this, SLOT( apply() ) ); - connect( m_bReset, SIGNAL( clicked() ), this, SLOT( reset() ) ); - - connect( view, SIGNAL( Hide( QHideEvent* ) ), this, SLOT( hide() ) ); - - resize( minimumSizeHint() ); -} - -/*! - \brief Destructor -*/ -OCCViewer_AxialScaleDlg::~OCCViewer_AxialScaleDlg() -{ -} - -/*! - \brief Update widgets values from the view -*/ -void OCCViewer_AxialScaleDlg::Update() -{ - // Get values from the OCC view - double aScaleFactor[3]; - myView->getViewPort()->getView()->AxialScale( aScaleFactor[0], aScaleFactor[1], aScaleFactor[2] ); - m_sbXcoeff->setValue( aScaleFactor[0] ); - m_sbYcoeff->setValue( aScaleFactor[1] ); - m_sbZcoeff->setValue( aScaleFactor[2] ); -} - -/*! - \brief Called when button is pressed -*/ -void OCCViewer_AxialScaleDlg::accept() -{ - if ( apply() ) - QDialog::accept(); -} - -/*! - \brief Called when button is pressed -*/ -bool OCCViewer_AxialScaleDlg::apply() -{ - double aScaleFactor[3] = { m_sbXcoeff->value(), m_sbYcoeff->value(), m_sbZcoeff->value() }; - myView->getViewPort()->getView()->SetAxialScale( aScaleFactor[0], aScaleFactor[1], aScaleFactor[2] ); - return true; -} - -/*! - \brief Called when button is pressed -*/ -void OCCViewer_AxialScaleDlg::reset() -{ - m_bReset->setFocus(); - m_sbXcoeff->setValue( 1.0 ); - m_sbYcoeff->setValue( 1.0 ); - m_sbZcoeff->setValue( 1.0 ); -} diff --git a/src/OCCViewer/OCCViewer_AxialScaleDlg.h b/src/OCCViewer/OCCViewer_AxialScaleDlg.h deleted file mode 100644 index d6e5b1fb1..000000000 --- a/src/OCCViewer/OCCViewer_AxialScaleDlg.h +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 OCCVIEWER_AXIALSCALEDLG_H -#define OCCVIEWER_AXIALSCALEDLG_H - -#include "OCCViewer.h" - -#include - -class OCCViewer_ViewWindow; -class QtxDoubleSpinBox; -class QPushButton; - -class OCCVIEWER_EXPORT OCCViewer_AxialScaleDlg : public QDialog -{ - Q_OBJECT - -public: - OCCViewer_AxialScaleDlg( OCCViewer_ViewWindow*, QWidget* = 0 ); - ~OCCViewer_AxialScaleDlg(); - - void Update(); - -protected slots: - bool apply(); - void reset(); - void accept(); - -private: - OCCViewer_ViewWindow* myView; - QtxDoubleSpinBox* m_sbXcoeff; - QtxDoubleSpinBox* m_sbYcoeff; - QtxDoubleSpinBox* m_sbZcoeff; - QPushButton* m_bReset; -}; - -#endif // OCCVIEWER_AXIALSCALEDLG_H diff --git a/src/OCCViewer/OCCViewer_ClippingDlg.cxx b/src/OCCViewer/OCCViewer_ClippingDlg.cxx deleted file mode 100644 index f8dacb541..000000000 --- a/src/OCCViewer/OCCViewer_ClippingDlg.cxx +++ /dev/null @@ -1,595 +0,0 @@ -// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 "OCCViewer_ClippingDlg.h" - -#include -#include - -#include "SUIT_Session.h" -#include "SUIT_ViewWindow.h" -#include "SUIT_ViewManager.h" -#include "OCCViewer_ViewWindow.h" -#include "OCCViewer_ViewPort3d.h" -#include "OCCViewer_ViewModel.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// QT Includes -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*! - Constructor - \param view - view window - \param parent - parent widget - \param name - dialog name - \param modal - is this dialog modal - \param fl - flags -*/ -OCCViewer_ClippingDlg::OCCViewer_ClippingDlg( OCCViewer_ViewWindow* view, QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl ) -: QDialog( parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint ), - myView( view ) -{ - setObjectName( "OCCViewer_ClippingDlg" ); - setModal( modal ); - - setWindowTitle( tr( "Clipping" ) ); - - QVBoxLayout* topLayout = new QVBoxLayout( this ); - topLayout->setMargin( 11 ); topLayout->setSpacing( 6 ); - - /***************************************************************/ - GroupPoint = new QGroupBox( this ); - GroupPoint->setObjectName( "GroupPoint" ); - GroupPoint->setTitle( tr("Base point") ); - QGridLayout* GroupPointLayout = new QGridLayout( GroupPoint ); - GroupPointLayout->setAlignment( Qt::AlignTop ); - GroupPointLayout->setSpacing( 6 ); - GroupPointLayout->setMargin( 11 ); - - // Controls - const double min = -1e+7; - const double max = 1e+7; - const double step = 5; - const int precision = 3; - - TextLabelX = new QLabel( GroupPoint ); - TextLabelX->setObjectName( "TextLabelX" ); - TextLabelX->setText( tr("X:") ); - GroupPointLayout->addWidget( TextLabelX, 0, 0 ); - - SpinBox_X = new QtxDoubleSpinBox( min, max, step, GroupPoint ); - SpinBox_X->setObjectName("SpinBox_X" ); - SpinBox_X->setDecimals( precision ); - GroupPointLayout->addWidget( SpinBox_X, 0, 1 ); - - TextLabelY = new QLabel( GroupPoint ); - TextLabelY->setObjectName( "TextLabelY" ); - TextLabelY->setText( tr("Y:") ); - GroupPointLayout->addWidget( TextLabelY, 0, 2 ); - - SpinBox_Y = new QtxDoubleSpinBox( min, max, step, GroupPoint ); - SpinBox_Y->setObjectName("SpinBox_Y" ); - SpinBox_Y->setDecimals( precision ); - GroupPointLayout->addWidget( SpinBox_Y, 0, 3 ); - - TextLabelZ = new QLabel( GroupPoint ); - TextLabelZ->setObjectName( "TextLabelZ" ); - TextLabelZ->setText( tr("Z:") ); - GroupPointLayout->addWidget( TextLabelZ, 0, 4 ); - - SpinBox_Z = new QtxDoubleSpinBox( min, max, step, GroupPoint ); - SpinBox_Z->setObjectName("SpinBox_Z" ); - SpinBox_Z->setDecimals( precision ); - GroupPointLayout->addWidget( SpinBox_Z, 0, 5 ); - - resetButton = new QPushButton( GroupPoint ); - resetButton->setObjectName( "resetButton" ); - resetButton->setText( tr( "Reset" ) ); - GroupPointLayout->addWidget( resetButton, 0, 6 ); - - /***************************************************************/ - GroupDirection = new QGroupBox( this ); - GroupDirection->setObjectName( "GroupDirection" ); - GroupDirection->setTitle( tr("Direction") ); - QGridLayout* GroupDirectionLayout = new QGridLayout( GroupDirection ); - GroupDirectionLayout->setAlignment( Qt::AlignTop ); - GroupDirectionLayout->setSpacing( 6 ); - GroupDirectionLayout->setMargin( 11 ); - - // Controls - TextLabelDx = new QLabel( GroupDirection ); - TextLabelDx->setObjectName( "TextLabelDx" ); - TextLabelDx->setText( tr("Dx:") ); - GroupDirectionLayout->addWidget( TextLabelDx, 0, 0 ); - - SpinBox_Dx = new QtxDoubleSpinBox( min, max, step, GroupDirection ); - SpinBox_Dx->setObjectName("SpinBox_Dx" ); - SpinBox_Dx->setDecimals( precision ); - GroupDirectionLayout->addWidget( SpinBox_Dx, 0, 1 ); - - TextLabelDy = new QLabel( GroupDirection ); - TextLabelDy->setObjectName( "TextLabelDy" ); - TextLabelDy->setText( tr("Dy:") ); - GroupDirectionLayout->addWidget( TextLabelDy, 0, 2 ); - - SpinBox_Dy = new QtxDoubleSpinBox( min, max, step, GroupDirection ); - SpinBox_Dy->setObjectName("SpinBox_Dy" ); - SpinBox_Dy->setDecimals( precision ); - GroupDirectionLayout->addWidget( SpinBox_Dy, 0, 3 ); - - TextLabelDz = new QLabel( GroupDirection ); - TextLabelDz->setObjectName( "TextLabelDz" ); - TextLabelDz->setText( tr("Dz:") ); - GroupDirectionLayout->addWidget( TextLabelDz, 0, 4 ); - - SpinBox_Dz = new QtxDoubleSpinBox( min, max, step, GroupDirection ); - SpinBox_Dz->setObjectName("SpinBox_Dz" ); - SpinBox_Dz->setDecimals( precision ); - GroupDirectionLayout->addWidget( SpinBox_Dz, 0, 5 ); - - invertButton = new QPushButton( GroupDirection ); - invertButton->setObjectName( "invertButton" ); - invertButton->setText( tr( "Invert" ) ); - GroupDirectionLayout->addWidget( invertButton, 0, 6 ); - - DirectionCB = new QComboBox( GroupDirection ); - DirectionCB->setObjectName( "DirectionCB" ); - DirectionCB->insertItem(DirectionCB->count(),tr("CUSTOM")); - DirectionCB->insertItem(DirectionCB->count(),tr("||X-Y")); - DirectionCB->insertItem(DirectionCB->count(),tr("||Y-Z")); - DirectionCB->insertItem(DirectionCB->count(),tr("||Z-X")); - GroupDirectionLayout->addWidget( DirectionCB, 1, 0, 1, 6 ); - - /***************************************************************/ - - PreviewChB = new QCheckBox( tr("Preview") ,this ); - PreviewChB->setObjectName( "PreviewChB" ); - PreviewChB->setChecked( true ); - - /***************************************************************/ - QGroupBox* GroupButtons = new QGroupBox( this ); - GroupButtons->setObjectName( "GroupButtons" ); - QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons ); - GroupButtonsLayout->setAlignment( Qt::AlignTop ); - GroupButtonsLayout->setMargin( 11 ); GroupButtonsLayout->setSpacing( 6 ); - - buttonApply = new QPushButton( GroupButtons ); - buttonApply->setObjectName( "buttonApply" ); - buttonApply->setText( tr( "BUT_APPLY" ) ); - buttonApply->setAutoDefault( TRUE ); - buttonApply->setDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonApply ); - - GroupButtonsLayout->addStretch(); - - buttonClose = new QPushButton( GroupButtons ); - buttonClose->setObjectName( "buttonClose" ); - buttonClose->setText( tr( "BUT_CLOSE" ) ); - buttonClose->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonClose ); - - /***************************************************************/ - - topLayout->addWidget( GroupPoint ); - topLayout->addWidget( GroupDirection ); - - topLayout->addWidget( PreviewChB ); - - topLayout->addWidget( GroupButtons ); - - /* initializations */ - - SpinBox_X->setValue( 0.0 ); - SpinBox_Y->setValue( 0.0 ); - SpinBox_Z->setValue( 0.0 ); - - SpinBox_Dx->setValue( 1.0 ); - SpinBox_Dy->setValue( 1.0 ); - SpinBox_Dz->setValue( 1.0 ); - - /* signals and slots connections */ - connect( resetButton, SIGNAL (clicked() ), this, SLOT( onReset() ) ); - connect( invertButton, SIGNAL (clicked() ), this, SLOT( onInvert() ) ) ; - - connect( SpinBox_X, SIGNAL ( valueChanged( double ) ), this, SLOT( onValueChanged() ) ); - connect( SpinBox_Y, SIGNAL ( valueChanged( double ) ), this, SLOT( onValueChanged() ) ); - connect( SpinBox_Z, SIGNAL ( valueChanged( double ) ), this, SLOT( onValueChanged() ) ); - connect( SpinBox_Dx, SIGNAL ( valueChanged( double ) ), this, SLOT( onValueChanged() ) ); - connect( SpinBox_Dy, SIGNAL ( valueChanged( double ) ), this, SLOT( onValueChanged() ) ); - connect( SpinBox_Dz, SIGNAL ( valueChanged( double ) ), this, SLOT( onValueChanged() ) ); - - connect( DirectionCB, SIGNAL ( activated ( int ) ), this, SLOT( onModeChanged( int ) ) ) ; - - connect( PreviewChB, SIGNAL ( toggled ( bool ) ), this, SLOT( onPreview( bool ) ) ) ; - - connect( buttonClose, SIGNAL( clicked() ), this, SLOT( ClickOnClose() ) ) ; - connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - - myBusy = false; - - connect(view, SIGNAL(Show( QShowEvent * )), this, SLOT(onViewShow())); - connect(view, SIGNAL(Hide( QHideEvent * )), this, SLOT(onViewHide())); -} - -/*! - Destructor - Destroys the object and frees any allocated resources -*/ -OCCViewer_ClippingDlg::~ OCCViewer_ClippingDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - - -/*! - Custom handling of close event: erases preview -*/ -void OCCViewer_ClippingDlg::closeEvent( QCloseEvent* e ) -{ - erasePreview(); - - // Set the clipping plane back - Handle(V3d_View) aView3d = myView->getViewPort()->getView(); - if ( !aView3d.IsNull() && !myClippingPlane.IsNull() ) - aView3d->SetPlaneOn( myClippingPlane ); - - myAction->setChecked( false ); - - QDialog::closeEvent( e ); -} - - -/*! - Custom handling of show event: displays preview -*/ -void OCCViewer_ClippingDlg::showEvent( QShowEvent* e ) -{ - ReserveClippingPlane(); - - QDialog::showEvent( e ); - onPreview( PreviewChB->isChecked() ); -} - - -/*! - Custom handling of hide event: erases preview -*/ -void OCCViewer_ClippingDlg::hideEvent( QHideEvent* e ) -{ - erasePreview(); - QDialog::hideEvent( e ); -} - - -/*! - SLOT on close button click: erases preview and rejects dialog -*/ -void OCCViewer_ClippingDlg::ClickOnClose() -{ - erasePreview(); - - // Set the clipping plane back - Handle(V3d_View) aView3d = myView->getViewPort()->getView(); - if ( !aView3d.IsNull() && !myClippingPlane.IsNull() ) - aView3d->SetPlaneOn( myClippingPlane ); - - myAction->setChecked( false ); - - reject(); -} - - -/*! - SLOT on apply button click: sets cutting plane -*/ -void OCCViewer_ClippingDlg::ClickOnApply() -{ - qApp->processEvents(); - QApplication::setOverrideCursor( Qt::WaitCursor ); - qApp->processEvents(); - - myView->setCuttingPlane( true, SpinBox_X->value() , SpinBox_Y->value() , SpinBox_Z->value(), - SpinBox_Dx->value(), SpinBox_Dy->value(), SpinBox_Dz->value() ); - - QApplication::restoreOverrideCursor(); - - erasePreview(); - - ReserveClippingPlane(); -} - -/*! - SLOT on reset button click: sets default values -*/ -void OCCViewer_ClippingDlg::onReset() -{ - myBusy = true; - SpinBox_X->setValue(0); - SpinBox_Y->setValue(0); - SpinBox_Z->setValue(0); - myBusy = false; - - if ( PreviewChB->isChecked() ) - { - erasePreview(); - displayPreview(); - } -} - -/*! - SLOT on invert button click: inverts normal of cutting plane -*/ -void OCCViewer_ClippingDlg::onInvert() -{ - double Dx = SpinBox_Dx->value(); - double Dy = SpinBox_Dy->value(); - double Dz = SpinBox_Dz->value(); - - myBusy = true; - SpinBox_Dx->setValue( -Dx ); - SpinBox_Dy->setValue( -Dy ); - SpinBox_Dz->setValue( -Dz ); - myBusy = false; - - if ( PreviewChB->isChecked() ) - { - erasePreview(); - displayPreview(); - } -} - -/*! - SLOT: called on mode changed -*/ -void OCCViewer_ClippingDlg::onModeChanged( int mode ) -{ - bool isUserMode = (mode==0); - - TextLabelX->setEnabled( isUserMode ); - TextLabelY->setEnabled( isUserMode ); - TextLabelZ->setEnabled( isUserMode ); - - SpinBox_X->setEnabled( isUserMode ); - SpinBox_Y->setEnabled( isUserMode ); - SpinBox_Z->setEnabled( isUserMode ); - - TextLabelDx->setEnabled( isUserMode ); - TextLabelDy->setEnabled( isUserMode ); - TextLabelDz->setEnabled( isUserMode ); - - SpinBox_Dx->setEnabled( isUserMode ); - SpinBox_Dy->setEnabled( isUserMode ); - SpinBox_Dz->setEnabled( isUserMode ); - - if ( isUserMode ) - return; - - double aDx = 0, aDy = 0, aDz = 0; - - if ( mode == 1 ) - { - aDz = 1; - TextLabelZ->setEnabled( true ); - SpinBox_Z->setEnabled( true ); - SpinBox_Z->setFocus(); - } - else if ( mode == 2 ) - { - aDx = 1; - TextLabelX->setEnabled( true ); - SpinBox_X->setEnabled( true ); - SpinBox_X->setFocus(); - } - else if ( mode == 3 ) - { - aDy = 1; - TextLabelY->setEnabled( true ); - SpinBox_Y->setEnabled( true ); - SpinBox_Y->setFocus(); - } - - myBusy = true; - SpinBox_Dx->setValue( aDx ); - SpinBox_Dy->setValue( aDy ); - SpinBox_Dz->setValue( aDz ); - myBusy = false; - - if ( PreviewChB->isChecked() ) - { - erasePreview(); - displayPreview(); - } -} - - -/*! - Displays preview of clipping plane -*/ -void OCCViewer_ClippingDlg::displayPreview() -{ - if ( myBusy || !isValid() ) - return; - - OCCViewer_Viewer* anOCCViewer = (OCCViewer_Viewer*)myView->getViewManager()->getViewModel(); - if (!anOCCViewer) - return; - - Handle(AIS_InteractiveContext) ic = anOCCViewer->getAISContext(); - - double aXMin, aYMin, aZMin, aXMax, aYMax, aZMax; - aXMin = aYMin = aZMin = DBL_MAX; - aXMax = aYMax = aZMax = -DBL_MAX; - - bool isFound = false; - AIS_ListOfInteractive aList; - ic->DisplayedObjects( aList ); - for ( AIS_ListIteratorOfListOfInteractive it( aList ); it.More(); it.Next() ) - { - Handle(AIS_InteractiveObject) anObj = it.Value(); - if ( !anObj.IsNull() && anObj->HasPresentation() && - !anObj->IsKind( STANDARD_TYPE(AIS_Plane) ) ) - { - Handle(Prs3d_Presentation) aPrs = anObj->Presentation(); - if ( !aPrs->IsEmpty() && !aPrs->IsInfinite() ) - { - isFound = true; - double xmin, ymin, zmin, xmax, ymax, zmax; - aPrs->MinMaxValues( xmin, ymin, zmin, xmax, ymax, zmax ); - aXMin = qMin( aXMin, xmin ); aXMax = qMax( aXMax, xmax ); - aYMin = qMin( aYMin, ymin ); aYMax = qMax( aYMax, ymax ); - aZMin = qMin( aZMin, zmin ); aZMax = qMax( aZMax, zmax ); - } - } - } - - double aSize = 50; - - gp_Pnt aBasePnt( SpinBox_X->value(), SpinBox_Y->value(), SpinBox_Z->value() ); - gp_Dir aNormal( SpinBox_Dx->value(), SpinBox_Dy->value(), SpinBox_Dz->value() ); - gp_Pnt aCenter = aBasePnt; - - if ( isFound ) - { - // compute clipping plane size - aCenter = gp_Pnt( ( aXMin + aXMax ) / 2, ( aYMin + aYMax ) / 2, ( aZMin + aZMax ) / 2 ); - double aDiag = aCenter.Distance(gp_Pnt(aXMax, aYMax, aZMax ))*2; - aSize = aDiag * 1.1; - - // compute clipping plane center ( redefine the base point ) - IntAna_IntConicQuad intersector = IntAna_IntConicQuad(); - - intersector.Perform( gp_Lin( aCenter, aNormal), gp_Pln( aBasePnt, aNormal), Precision::Confusion() ); - if ( intersector.IsDone() && intersector.NbPoints() == 1 ) - aBasePnt = intersector.Point( 1 ); - } - - myPreviewPlane = new AIS_Plane( new Geom_Plane( aBasePnt, aNormal ) ); - myPreviewPlane->SetSize( aSize, aSize ); - - // Deactivate clipping planes - myView->getViewPort()->getView()->SetPlaneOff(); - - ic->Display( myPreviewPlane, 1, -1, false ); - ic->SetWidth( myPreviewPlane, 10, false ); - ic->SetMaterial( myPreviewPlane, Graphic3d_NOM_PLASTIC, false ); - ic->SetTransparency( myPreviewPlane, 0.5, false ); - ic->SetColor( myPreviewPlane, Quantity_Color( 85 / 255., 85 / 255., 255 / 255., Quantity_TOC_RGB ), false ); - - anOCCViewer->update(); -} - - -/*! - Erases preview of clipping plane -*/ -void OCCViewer_ClippingDlg::erasePreview () -{ - OCCViewer_Viewer* anOCCViewer = (OCCViewer_Viewer*)myView->getViewManager()->getViewModel(); - if (!anOCCViewer) - return; - - Handle(AIS_InteractiveContext) ic = anOCCViewer->getAISContext(); - - if ( !myPreviewPlane.IsNull() && ic->IsDisplayed( myPreviewPlane ) ) - { - ic->Erase( myPreviewPlane, false, false ); - ic->Remove( myPreviewPlane, false ); - myPreviewPlane.Nullify(); - } - - anOCCViewer->update(); -} - - -/*! - SLOT: called on value changes (co-ordinates of point or normal) -*/ -void OCCViewer_ClippingDlg::onValueChanged() -{ - if ( PreviewChB->isChecked() ) - { - erasePreview(); - displayPreview(); - } -} - - -/*! - SLOT: called on preview check box toggled -*/ -void OCCViewer_ClippingDlg::onPreview( bool on ) -{ - erasePreview(); - - if ( on ) - displayPreview(); -} - -/*! - \return true if plane parameters are valid -*/ -bool OCCViewer_ClippingDlg::isValid() -{ - return ( SpinBox_Dx->value()!=0 || SpinBox_Dy->value()!=0 || SpinBox_Dz->value()!=0 ); -} - -/*! - Remember the current clipping plane -*/ -void OCCViewer_ClippingDlg::ReserveClippingPlane() -{ - Handle(V3d_View) aView3d = myView->getViewPort()->getView(); - if ( !aView3d.IsNull() ) - { - aView3d->InitActivePlanes(); - if ( aView3d->MoreActivePlanes() ) - myClippingPlane = aView3d->ActivePlane(); - } -} - -void OCCViewer_ClippingDlg::onViewShow() -{ - if(myAction->isChecked()) - show(); - else - hide(); -} - -void OCCViewer_ClippingDlg::onViewHide() -{ - hide(); -} - diff --git a/src/OCCViewer/OCCViewer_ClippingDlg.h b/src/OCCViewer/OCCViewer_ClippingDlg.h deleted file mode 100644 index b50ff75f4..000000000 --- a/src/OCCViewer/OCCViewer_ClippingDlg.h +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 OCCVIEWER_CLIPPINGDLG_H -#define OCCVIEWER_CLIPPINGDLG_H - -#include "OCCViewer.h" - -#include - -#include -#include - -class QGroupBox; -class QLabel; -class QPushButton; -class QComboBox; -class QCheckBox; -class QtxDoubleSpinBox; -class QtxAction; - -class OCCViewer_ViewWindow; - - -/*! - \class OCCViewer_ClippingDlg - \brief Dialog allowing to assign parameters of clipping plane -*/ -class OCCViewer_ClippingDlg : public QDialog -{ - Q_OBJECT - - public: - OCCViewer_ClippingDlg(OCCViewer_ViewWindow* , QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); - ~OCCViewer_ClippingDlg(); - - void SetAction( QtxAction* theAction ) { myAction = theAction; } - -private : - - virtual void closeEvent( QCloseEvent* e ); - virtual void showEvent ( QShowEvent * ); - virtual void hideEvent ( QHideEvent * ); - void displayPreview(); - void erasePreview(); - void ReserveClippingPlane(); - - bool isValid(); - - QGroupBox* GroupPoint; - QLabel* TextLabelX; - QLabel* TextLabelY; - QLabel* TextLabelZ; - QtxDoubleSpinBox* SpinBox_X; - QtxDoubleSpinBox* SpinBox_Y; - QtxDoubleSpinBox* SpinBox_Z; - QPushButton* resetButton; - - QGroupBox* GroupDirection; - QLabel* TextLabelDx; - QLabel* TextLabelDy; - QLabel* TextLabelDz; - QtxDoubleSpinBox* SpinBox_Dx; - QtxDoubleSpinBox* SpinBox_Dy; - QtxDoubleSpinBox* SpinBox_Dz; - QPushButton* invertButton; - - QComboBox* DirectionCB; - - QCheckBox* PreviewChB; - - QPushButton* buttonApply; - QPushButton* buttonClose; - - OCCViewer_ViewWindow* myView; - - Handle(AIS_Plane) myPreviewPlane; - Handle(V3d_Plane) myClippingPlane; - - bool myBusy; - - QtxAction* myAction; - -private slots: - void ClickOnApply(); - void ClickOnClose(); - - void onReset(); - void onInvert(); - void onModeChanged( int mode ); - void onValueChanged(); - void onPreview( bool on ); - - void onViewShow(); - void onViewHide(); -}; - -#endif // OCCVIEWER_CLIPPINGDLG_H diff --git a/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx b/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx deleted file mode 100755 index cc816a932..000000000 --- a/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx +++ /dev/null @@ -1,281 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 "OCCViewer_CreateRestoreViewDlg.h" -#include "OCCViewer_ViewModel.h" -#include "OCCViewer_ViewPort3d.h" - -#include -#include -#include -#include -#include -#include - -/*! - Constructor -*/ -OCCViewer_CreateRestoreViewDlg::OCCViewer_CreateRestoreViewDlg( QWidget* aWin, OCCViewer_Viewer* curModel ) -: QDialog( aWin ) -{ - setWindowTitle( tr( "CAPTION" ) ); - - myParametersMap = curModel->getViewAspects(); - - myKeyFlag = 0; - - int aQuantityOfItems = myParametersMap.count(); - - setFixedSize( 400, 300 ); - - QGridLayout* aGrid = new QGridLayout( this ); - aGrid->setMargin( 5 ); - aGrid->setSpacing( 10 ); - - QWidget* aWidget1 = new QWidget( this ); - QWidget* aWidget2 = new QWidget( this ); - - QHBoxLayout* aLayout = new QHBoxLayout( aWidget1 ); - - myListBox = new QListWidget( aWidget1 ); - myListBox->installEventFilter( this ); - - myCurViewPort = new OCCViewer_ViewPort3d( aWidget1, curModel->getViewer3d(), V3d_ORTHOGRAPHIC ); - myCurViewPort->getView()->SetBackgroundColor( Quantity_NOC_BLACK ); - - myListBox->setEditTriggers( QAbstractItemView::DoubleClicked ); - - if ( aQuantityOfItems ) - { - myListBox->clear(); - for( int i = 0; i < aQuantityOfItems; i++ ) { - myListBox->insertItem( i, myParametersMap[ i ].name ); - myListBox->item( i )->setFlags( myListBox->item( i )->flags() | Qt::ItemIsEditable ); - } - - changeImage( myListBox->item( 0 ) ); - } - else - { - myListBox->clear(); - myListBox->insertItem( 0, "No Items" ); - } - - connect( myListBox, SIGNAL( itemClicked( QListBoxItem* ) ), this, SLOT( changeImage( QListBoxItem* ) ) ); - connect( myListBox, SIGNAL( itemChanged( QListBoxItem* ) ), this, SLOT( editItemText( QListBoxItem* ) ) ); - - aLayout->addWidget( myListBox ); - aLayout->addWidget( myCurViewPort, 30 ); - - QHBoxLayout* aButtonLayout = new QHBoxLayout( aWidget2 ); - aButtonLayout->setMargin( 0 ); - aButtonLayout->setSpacing( 5 ); - - QPushButton* theOk = new QPushButton( tr( "Ok" ), aWidget2 ); theOk->setAutoDefault( false ); - QPushButton* theCancel = new QPushButton( tr( "Cancel" ), aWidget2 ); theCancel->setAutoDefault( false ); - QPushButton* theDelete = new QPushButton( tr( "Delete" ), aWidget2 ); theDelete->setAutoDefault( false ); - QPushButton* theClearAll = new QPushButton( tr( "Clear List" ), aWidget2 ); theClearAll->setAutoDefault( false ); - - aButtonLayout->addWidget( theOk ); - aButtonLayout->addWidget( theCancel ); - aButtonLayout->addWidget( theDelete ); - aButtonLayout->addWidget( theClearAll ); - - aGrid->addWidget( aWidget1, 0, 0 ); - aGrid->addWidget( aWidget2, 1, 0 ); - - connect( theOk, SIGNAL( clicked() ), this, SLOT( OKpressed() ) ); - connect( theCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); - connect( theDelete, SIGNAL( clicked() ), this, SLOT( deleteSelectedItems() ) ); - connect( theClearAll, SIGNAL( clicked() ), this, SLOT( clearList() ) ); -} - -/*! - Destructor -*/ -OCCViewer_CreateRestoreViewDlg::~OCCViewer_CreateRestoreViewDlg() -{ -} - -/*! - Changes image in accordance with item - \param curItem - item contains info about view parameters -*/ -void OCCViewer_CreateRestoreViewDlg::changeImage( QListWidgetItem* curItem ) -{ - if( curItem && ( curItem->flags() & Qt::ItemIsEditable ) ) - { - int lowLevel = -1; - int highLevel = -1; - int index = curItem->listWidget()->row( curItem ); - if( myKeyFlag == 2 ) - { - for( int i = 0; i < (int)myListBox->count(); i++ ) - { - if( myListBox->item( i )->isSelected() && i != index ) - { - myListBox->clearSelection(); - if( i > index ) - { - lowLevel = index; - highLevel = i; - } - else - { - lowLevel = i; - highLevel = index; - } - for( int j = lowLevel; j <= highLevel; j++ ) - myListBox->item( j )->setSelected( TRUE ); - break; - } - if( myListBox->item( i )->isSelected() && i == index ) - myListBox->item( i )->setSelected( TRUE ); - } - } - - Handle(V3d_View) aView3d = myCurViewPort->getView(); - myCurrentItem = myParametersMap[ index ]; - - Standard_Boolean prev = aView3d->SetImmediateUpdate( Standard_False ); - aView3d->SetScale( myCurrentItem.scale ); - aView3d->SetCenter( myCurrentItem.centerX, myCurrentItem.centerY ); - aView3d->SetProj( myCurrentItem.projX, myCurrentItem.projY, myCurrentItem.projZ ); - aView3d->SetTwist( myCurrentItem.twist ); - aView3d->SetAt( myCurrentItem.atX, myCurrentItem.atY, myCurrentItem.atZ ); - aView3d->SetImmediateUpdate( prev ); - aView3d->SetEye( myCurrentItem.eyeX, myCurrentItem.eyeY, myCurrentItem.eyeZ ); - aView3d->SetAxialScale( myCurrentItem.scaleX, myCurrentItem.scaleY, myCurrentItem.scaleZ ); - } -} - -/*! - \return current view parameters (corresponding to current item) -*/ -viewAspect OCCViewer_CreateRestoreViewDlg::currentItem() const -{ - return myCurrentItem; -} - -/*! - Deletes selected items from list view -*/ -void OCCViewer_CreateRestoreViewDlg::deleteSelectedItems() -{ - if( myListBox->count() ) - { - int curIndex = -1; - for( int i = 0; i < (int)myListBox->count(); i++ ) - if( myListBox->item( i )->isSelected() && ( myListBox->item( i )->flags() & Qt::ItemIsEditable ) ) - { - QListWidgetItem* anItemToDelete = myListBox->takeItem( i ); - delete anItemToDelete; - for( int j = i; j < (int)myParametersMap.count(); j++ ) - if( j != myParametersMap.count() - 1 ) - myParametersMap[ j ] = myParametersMap[ j + 1 ]; - else - myParametersMap.removeAt( j ); - if( i != myListBox->count() ) - curIndex = i; - else - curIndex = i - 1; - i--; - } - if( curIndex >= 0 ) - { - myListBox->setCurrentItem( myListBox->item( curIndex ) ); - changeImage( myListBox->item( curIndex ) ); - } - } - if( !myListBox->count() ) - { - myListBox->clear(); - myListBox->insertItem( 0, "No Items" ); - } -} - -/*! - Clears list of view aspects -*/ -void OCCViewer_CreateRestoreViewDlg::clearList() -{ - myListBox->clear(); - myListBox->insertItem( 0, "No Items" ); - - myParametersMap.clear(); -} - -/*! - \return const reference to all view aspects -*/ -const viewAspectList& OCCViewer_CreateRestoreViewDlg::parameters() const -{ - return myParametersMap; -} - -/*! - Renames key of view aspect map in accordance with item name - \param anItem - item -*/ -void OCCViewer_CreateRestoreViewDlg::editItemText( QListWidgetItem* anItem ) -{ - int index = anItem->listWidget()->row( anItem ); - myParametersMap[ index ].name = anItem->text().toLatin1(); -} - -/*! - Custom event filter -*/ -bool OCCViewer_CreateRestoreViewDlg::eventFilter( QObject* anObj, QEvent* anEv ) -{ - if( anEv->type() == QEvent::KeyPress ) - { - QKeyEvent* aKeyEv = ( QKeyEvent* )anEv; - if( aKeyEv->key() == Qt::Key_Control ) - { - myKeyFlag = 1; - myListBox->setSelectionMode( QAbstractItemView::MultiSelection ); - } - else if( aKeyEv->key() == Qt::Key_Shift ) - { - myKeyFlag = 2; - myListBox->setSelectionMode( QAbstractItemView::MultiSelection ); - } - else - myListBox->setSelectionMode( QAbstractItemView::SingleSelection ); - } - if( anEv->type() == QEvent::KeyRelease ) - myKeyFlag = 0; - - if( !myKeyFlag ) - { - if( anEv->type() == QEvent::KeyPress || anEv->type() == QEvent::MouseButtonPress ) - myListBox->setSelectionMode( QAbstractItemView::SingleSelection ); - } - return QWidget::eventFilter( anObj, anEv ); -} - -/*! - SLOT: called on OK click, emits dlgOk() and closes dialog -*/ -void OCCViewer_CreateRestoreViewDlg::OKpressed() -{ - emit dlgOk(); - accept(); -} - diff --git a/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.h b/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.h deleted file mode 100755 index 4673ab9a0..000000000 --- a/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.h +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 OCCVIEWER_CREATERESTOREVIEWDLG_H -#define OCCVIEWER_CREATERESTOREVIEWDLG_H - -#include "OCCViewer.h" - -#include "OCCViewer_ViewModel.h" -#include "OCCViewer_ViewWindow.h" - -#include -#include - -#include -#include - -class OCCViewer_ViewPort3d; - -class QListWidgetItem; - -#ifdef WIN32 -#pragma warning( disable:4251 ) -#endif - -class OCCVIEWER_EXPORT OCCViewer_CreateRestoreViewDlg : public QDialog -{ - Q_OBJECT - -public: - OCCViewer_CreateRestoreViewDlg( QWidget*, OCCViewer_Viewer* ); - virtual ~OCCViewer_CreateRestoreViewDlg(); - - const viewAspectList& parameters() const; - viewAspect currentItem() const; - virtual bool eventFilter( QObject*, QEvent* ); - -public slots: - void OKpressed(); - void clearList(); - void editItemText( QListWidgetItem* ); - void changeImage( QListWidgetItem* ); - void deleteSelectedItems(); - -signals: - void dlgOk(); - -private: - int myKeyFlag; - QListWidget* myListBox; - OCCViewer_ViewPort3d* myCurViewPort; - viewAspect myCurrentItem; - viewAspectList myParametersMap; -}; - -#ifdef WIN32 -#pragma warning( default:4251 ) -#endif - -#endif diff --git a/src/OCCViewer/OCCViewer_SetRotationPointDlg.cxx b/src/OCCViewer/OCCViewer_SetRotationPointDlg.cxx deleted file mode 100644 index af86ec168..000000000 --- a/src/OCCViewer/OCCViewer_SetRotationPointDlg.cxx +++ /dev/null @@ -1,301 +0,0 @@ -// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 "OCCViewer_SetRotationPointDlg.h" - -#include - -#include "OCCViewer_ViewWindow.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -/*! - Constructor - \param view - view window - \param parent - parent widget - \param name - dialog name - \param modal - is this dialog modal - \param fl - flags -*/ -OCCViewer_SetRotationPointDlg::OCCViewer_SetRotationPointDlg( OCCViewer_ViewWindow* view, QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl ) -: QDialog( parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint ), - myView( view ) -{ - setObjectName( "OCCViewer_SetRotationPointDlg" ); - setModal( modal ); - - setWindowTitle(tr("CAPTION")); - setSizeGripEnabled(TRUE); - - // Create layout for this dialog - QGridLayout* layoutDlg = new QGridLayout (this); - layoutDlg->setSpacing(6); - layoutDlg->setMargin(11); - - // Create check box "Use Bounding Box Center" - QHBoxLayout* aCheckBox = new QHBoxLayout; - - myIsBBCenter = new QCheckBox(tr("USE_BBCENTER")); - myIsBBCenter->setChecked(true); - aCheckBox->addWidget(myIsBBCenter); - connect(myIsBBCenter, SIGNAL(stateChanged(int)), SLOT(onBBCenterChecked())); - - // Create croup button with radio buttons - myGroupBoxSel = new QGroupBox( "", this ); - QVBoxLayout *vbox = new QVBoxLayout; - vbox->setMargin(11); - vbox->addStretch(1); - - // Create "Set to Origin" button - myToOrigin = new QPushButton(tr("LBL_TOORIGIN")); - vbox->addWidget(myToOrigin); - connect(myToOrigin, SIGNAL(clicked()), this, SLOT(onToOrigin())); - - // Create "Select Point from View" button - mySelectPoint = new QPushButton(tr("LBL_SELECTPOINT")); - mySelectPoint->setCheckable(true); - vbox->addWidget(mySelectPoint); - connect(mySelectPoint, SIGNAL(clicked()), this, SLOT(onSelectPoint())); - - myGroupBoxSel->setLayout(vbox); - - // Create croup box with grid layout - myGroupBoxCoord = new QGroupBox(this); - myGroupBoxCoord->setObjectName("GroupBox"); - QHBoxLayout* aHBoxLayout = new QHBoxLayout(myGroupBoxCoord); - aHBoxLayout->setMargin(11); - aHBoxLayout->setSpacing(6); - - // "X" coordinate - QLabel* TextLabelX = new QLabel (tr("LBL_X"), myGroupBoxCoord ); - TextLabelX->setObjectName("TextLabelX"); - TextLabelX->setFixedWidth(15); - myX = new QLineEdit(myGroupBoxCoord); - myX->setValidator(new QDoubleValidator(myX)); - myX->setText(QString::number(0.0)); - connect(myX, SIGNAL(textChanged(const QString&)), this, SLOT(onCoordChanged())); - - // "Y" coordinate - QLabel* TextLabelY = new QLabel (tr("LBL_Y"), myGroupBoxCoord ); - TextLabelY->setObjectName("TextLabelY"); - TextLabelY->setFixedWidth(15); - myY = new QLineEdit(myGroupBoxCoord); - myY->setValidator(new QDoubleValidator(myY)); - myY->setText(QString::number(0.0)); - connect(myY, SIGNAL(textChanged(const QString&)), this, SLOT(onCoordChanged())); - - // "Z" coordinate - QLabel* TextLabelZ = new QLabel (tr("LBL_Z"), myGroupBoxCoord ); - TextLabelZ->setObjectName("TextLabelZ"); - TextLabelZ->setFixedWidth(15); - myZ = new QLineEdit(myGroupBoxCoord); - myZ->setValidator(new QDoubleValidator(myZ)); - myZ->setText(QString::number(0.0)); - connect(myZ, SIGNAL(textChanged(const QString&)), this, SLOT(onCoordChanged())); - - // Layout widgets in the horizontal group box - aHBoxLayout->addWidget(TextLabelX); - aHBoxLayout->addWidget(myX); - aHBoxLayout->addWidget(TextLabelY); - aHBoxLayout->addWidget(myY); - aHBoxLayout->addWidget(TextLabelZ); - aHBoxLayout->addWidget(myZ); - - // "Close" button - QGroupBox* aGroupBox = new QGroupBox(this); - QHBoxLayout* aHBoxLayout2 = new QHBoxLayout(aGroupBox); - aHBoxLayout2->setMargin(11); - aHBoxLayout2->setSpacing(6); - - QPushButton* m_bClose = new QPushButton(tr("&Close"), aGroupBox ); - m_bClose->setObjectName("m_bClose"); - m_bClose->setAutoDefault(TRUE); - m_bClose->setFixedSize(m_bClose->sizeHint()); - connect(m_bClose, SIGNAL(clicked()), this, SLOT(onClickClose())); - - // Layout buttons - aHBoxLayout2->addWidget(m_bClose); - - // Layout top level widgets - layoutDlg->addLayout(aCheckBox,0,0); - layoutDlg->addWidget(myGroupBoxSel,1,0); - layoutDlg->addWidget(myGroupBoxCoord,2,0); - layoutDlg->addWidget(aGroupBox,3,0); - - setEnabled(myGroupBoxSel,!myIsBBCenter->isChecked()); - setEnabled(myGroupBoxCoord,!myIsBBCenter->isChecked()); - - this->resize(400, this->sizeHint().height()); - - connect(view, SIGNAL(Show( QShowEvent * )), this, SLOT(onViewShow())); - connect(view, SIGNAL(Hide( QHideEvent * )), this, SLOT(onViewHide())); -} - -/* - * Destroys the object and frees any allocated resources - */ -OCCViewer_SetRotationPointDlg -::~OCCViewer_SetRotationPointDlg() -{ - // no need to delete child widgets, Qt does it all for us -} - -/*! - Return true if it is the first show for this dialog -*/ -bool -OCCViewer_SetRotationPointDlg -::IsFirstShown() -{ - return myIsBBCenter->isChecked() && myX->text().toDouble() == 0. - && myY->text().toDouble() == 0. && myZ->text().toDouble() == 0.; -} - -void -OCCViewer_SetRotationPointDlg -::setEnabled(QGroupBox* theGrp, const bool theState) -{ - QObjectList aChildren(theGrp->children()); - QObject* anObj; - for(int i = 0; i < aChildren.size(); i++) - { - anObj = aChildren.at(i); - if (anObj !=0 && anObj->inherits("QLineEdit")) - ((QLineEdit*)anObj)->setReadOnly(!theState); - if (anObj !=0 && anObj->inherits("QPushButton")) - ((QLineEdit*)anObj)->setEnabled(theState); - } - -} - -void -OCCViewer_SetRotationPointDlg -::onBBCenterChecked() -{ - setEnabled(myGroupBoxSel,!myIsBBCenter->isChecked()); - setEnabled(myGroupBoxCoord,!myIsBBCenter->isChecked()); - - if ( myIsBBCenter->isChecked() ) - { - if ( mySelectPoint->isChecked() ) - mySelectPoint->toggle(); - myView->activateSetRotationGravity(); - } - else - myView->activateSetRotationSelected(myX->text().toDouble(), - myY->text().toDouble(), - myZ->text().toDouble()); -} - -void -OCCViewer_SetRotationPointDlg -::onToOrigin() -{ - if ( mySelectPoint->isChecked() ) - mySelectPoint->toggle(); - setCoords(); - myView->activateSetRotationSelected(myX->text().toDouble(), - myY->text().toDouble(), - myZ->text().toDouble()); -} - -void -OCCViewer_SetRotationPointDlg -::onSelectPoint() -{ - if ( mySelectPoint->isChecked() ) - myView->activateStartPointSelection(); - else - mySelectPoint->toggle(); -} - -void -OCCViewer_SetRotationPointDlg -::onCoordChanged() -{ - if ( !myIsBBCenter->isChecked() ) - { - if ( mySelectPoint->isChecked() - && - ( myX->hasFocus() || myY->hasFocus() || myZ->hasFocus() ) ) - mySelectPoint->toggle(); - myView->activateSetRotationSelected(myX->text().toDouble(), - myY->text().toDouble(), - myZ->text().toDouble()); - } -} - -void -OCCViewer_SetRotationPointDlg -::setCoords(double theX, double theY, double theZ) -{ - myX->setText(QString::number(theX)); - myY->setText(QString::number(theY)); - myZ->setText(QString::number(theZ)); -} - -void -OCCViewer_SetRotationPointDlg -::toggleChange() -{ - if ( !myIsBBCenter->isChecked() ) - mySelectPoint->toggle(); -} - -void -OCCViewer_SetRotationPointDlg -::onClickClose() -{ - myAction->setChecked( false ); - reject(); -} - -void -OCCViewer_SetRotationPointDlg -::onViewShow() -{ - if(myAction->isChecked()) - show(); - else - hide(); -} - -void -OCCViewer_SetRotationPointDlg -::onViewHide() -{ - hide(); -} - -/*! - Custom handling of close event: toggle action -*/ -void -OCCViewer_SetRotationPointDlg -::closeEvent( QCloseEvent* e ) -{ - myAction->setChecked( false ); - QDialog::closeEvent( e ); -} diff --git a/src/OCCViewer/OCCViewer_SetRotationPointDlg.h b/src/OCCViewer/OCCViewer_SetRotationPointDlg.h deleted file mode 100644 index 8980e718c..000000000 --- a/src/OCCViewer/OCCViewer_SetRotationPointDlg.h +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 OCCVIEWER_SETROTATIONPOINTDLG_H -#define OCCVIEWER_SETROTATIONPOINTDLG_H - -#include "OCCViewer.h" - -#include - -class QtxAction; - -class QLineEdit; -class QPushButton; -class QGroupBox; -class QCheckBox; - -class OCCViewer_ViewWindow; - -class OCCVIEWER_EXPORT OCCViewer_SetRotationPointDlg : public QDialog -{ - Q_OBJECT - -public: - OCCViewer_SetRotationPointDlg(OCCViewer_ViewWindow* , QWidget* parent = 0, - const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0); - ~OCCViewer_SetRotationPointDlg(); - - void SetAction( QtxAction* theAction ) { myAction = theAction; } - bool IsFirstShown(); - - void setCoords(double theX=0., double theY=0., double theZ=0.); - void toggleChange(); - -protected: - OCCViewer_ViewWindow* myView; - QtxAction* myAction; - - QCheckBox* myIsBBCenter; - - QGroupBox * myGroupBoxSel; - QPushButton* myToOrigin; - QPushButton* mySelectPoint; - - QGroupBox* myGroupBoxCoord; - QLineEdit* myX; - QLineEdit* myY; - QLineEdit* myZ; - - void setEnabled(QGroupBox* theGrp, const bool theState); - -protected slots: - void onBBCenterChecked(); - - void onToOrigin(); - void onSelectPoint(); - - void onCoordChanged(); - - void onClickClose(); - - void onViewShow(); - void onViewHide(); - -protected: - void closeEvent( QCloseEvent* ); -}; - -#endif // OCCVIEWER_SETROTATIONPOINTDLG_H diff --git a/src/OCCViewer/OCCViewer_Trihedron.cxx b/src/OCCViewer/OCCViewer_Trihedron.cxx deleted file mode 100755 index f83ec0a4e..000000000 --- a/src/OCCViewer/OCCViewer_Trihedron.cxx +++ /dev/null @@ -1,306 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 -// - -#ifdef WIN32 -#include -#endif - -#include - -#include "OCCViewer_Trihedron.h" - - -#include -#include - -#include -#include -#include -#include -#include -#include - - -#ifndef WIN32 -# include -#endif - - - -#define PI 3.14159265359 - -IMPLEMENT_STANDARD_HANDLE( OCCViewer_Trihedron, AIS_InteractiveObject ) -IMPLEMENT_STANDARD_RTTIEXT( OCCViewer_Trihedron, AIS_InteractiveObject ) - -/*! - * Constructor - */ -OCCViewer_Trihedron::OCCViewer_Trihedron( const PrsMgr_TypeOfPresentation3d t ) - : AIS_InteractiveObject( t ), - myTextList( 0 ) -{ -} - -/*! - * Destructor - */ -OCCViewer_Trihedron::~OCCViewer_Trihedron() -{ - if( myTextList ) - glDeleteLists( myTextList, 256 ); -} - -/*! - * Sets the bounding box (MinMax values). - */ -void OCCViewer_Trihedron::bounds( Graphic3d_CBounds& aMinMax ) const -{ - Standard_Real aXMin = -1, aYMin = -1, aZMin = -1; - Standard_Real aXMax = 1, aYMax = 1, aZMax = 1; - - if( aMinMax.XMin > aXMin ) aMinMax.XMin = aXMin; - if( aMinMax.YMin > aYMin ) aMinMax.YMin = aYMin; - if( aMinMax.ZMin > aZMin ) aMinMax.ZMin = aZMin; - if( aMinMax.XMax < aXMax ) aMinMax.XMax = aXMax; - if( aMinMax.YMax < aYMax ) aMinMax.YMax = aYMax; - if( aMinMax.ZMax < aZMax ) aMinMax.ZMax = aZMax; -} - -/*! - * Redefined method. Calculates the object presentation. - */ -void OCCViewer_Trihedron::Compute( const Handle( PrsMgr_PresentationManager3d )&, - const Handle( Prs3d_Presentation )& aPrs, - const Standard_Integer aMode ) -{ - if( aPrs.IsNull() ) - return; - - Handle( Graphic3d_Group ) aGroup = Prs3d_Root::CurrentGroup( aPrs ); - aGroup->UserDraw( this ); -} - -/*! - * Redefined method. Does nothing. - */ -void OCCViewer_Trihedron::ComputeSelection( const Handle( SelectMgr_Selection )& theSelection, - const Standard_Integer theMode ) -{ -} - -/*! - * Generates text list. - */ -GLuint generateTextList() -{ - bool ok = false; - GLuint aList = glGenLists( 256 ); - -#ifdef WIN32 - HGLRC hglrc = wglGetCurrentContext(); - if( hglrc ) - { - HDC hdc = ::wglGetCurrentDC(); - HFONT font = CreateFont( -12, 0, 0, 0, - FW_BOLD, - 0, 0, 0, - ANSI_CHARSET, - OUT_TT_PRECIS, - CLIP_DEFAULT_PRECIS, - ANTIALIASED_QUALITY, - FF_DONTCARE | DEFAULT_PITCH, - "Courier New" ); - HFONT oldFont = (HFONT)SelectObject( hdc, font ); - - ok = ::wglUseFontBitmaps( hdc, 0, 256, aList ); - SelectObject( hdc, oldFont ); - DeleteObject( font ); - } -#else // X Window - Display* dpy = glXGetCurrentDisplay(); - if( dpy ) - { - int aFontCount = 0; - char** aFontList = XListFonts( dpy, "*-courier-*", 1, &aFontCount ); - if( aFontCount > 0 ) - { - //XFontStruct* fontInfo = XLoadQueryFont( dpy, "-*-courier-*-r-*-*-14-*-*-*-m-*-*-*" ); - Font aFont = XLoadFont( dpy, aFontList[0] ); - glXUseXFont( aFont, 0, 256, aList ); - XUnloadFont( dpy, aFont ); - ok = true; - } - XFreeFontNames( aFontList ); - } -#endif - - if( !ok ) - glDeleteLists( aList, 256 ); - - return aList; -} - -/*! - * Draws text string. - */ -void drawText( GLuint theTextList, const char* theText, GLdouble thePosition[3], GLfloat theColor[3] ) -{ - glColor3fv( theColor ); - glRasterPos3dv( thePosition ); - glListBase( theTextList ); - glCallLists( strlen( theText ), GL_UNSIGNED_BYTE, (GLubyte*)theText ); -} - -/*! - * Displays trihedron. - */ -void OCCViewer_Trihedron::display() -{ - GLdouble TriedronOrigin[3] = { 0.0, 0.0, 0.0 }; - - GLdouble TriedronAxeX[3] = { 1.0, 0.0, 0.0 }; - GLdouble TriedronAxeY[3] = { 0.0, 1.0, 0.0 }; - GLdouble TriedronAxeZ[3] = { 0.0, 0.0, 1.0 }; - - GLfloat TriedronColorX[3] = { 1.0, 0.0, 0.0 }; - GLfloat TriedronColorY[3] = { 0.0, 1.0, 0.0 }; - GLfloat TriedronColorZ[3] = { 0.0, 0.0, 1.0 }; - - GLfloat TriedronLetterColorX[3] = { 1.0, 1.0, 1.0 }; - GLfloat TriedronLetterColorY[3] = { 1.0, 1.0, 1.0 }; - GLfloat TriedronLetterColorZ[3] = { 1.0, 1.0, 1.0 }; - - GLfloat TriedronLineWidth = 2.0; - GLdouble TriedronScale = 0.15; - - GLdouble U, V, minUV; - GLint aViewPort[4]; - glGetIntegerv(GL_VIEWPORT, aViewPort); - U = aViewPort[2]; - V = aViewPort[3]; - - if( U < V ) - minUV = U; - else - minUV = V; - - GLdouble L = minUV * TriedronScale; - - TriedronOrigin[0]= 0.0; - TriedronOrigin[1]= 0.0; - TriedronOrigin[2]= 0.0; - - TriedronAxeX[0] = TriedronOrigin[0] + L; - TriedronAxeX[1] = TriedronOrigin[1] + 0.0; - TriedronAxeX[2] = TriedronOrigin[2] + 0.0; - - TriedronAxeY[0] = TriedronOrigin[0] + 0.0; - TriedronAxeY[1] = TriedronOrigin[1] + L; - TriedronAxeY[2] = TriedronOrigin[2] + 0.0; - - TriedronAxeZ[0] = TriedronOrigin[0] + 0.0; - TriedronAxeZ[1] = TriedronOrigin[1] + 0.0; - TriedronAxeZ[2] = TriedronOrigin[2] + L; - - glPushAttrib( GL_CURRENT_BIT | GL_ENABLE_BIT | GL_LIGHTING_BIT | GL_LINE_BIT | GL_VIEWPORT_BIT ); - - glDepthRange( 0, 0 ); - glDisable( GL_LIGHTING ); - glDisable( GL_COLOR_MATERIAL ); - for( int i = 0; i < GL_MAX_CLIP_PLANES; i++ ) - glDisable( GL_CLIP_PLANE0 + i ); - - glLineWidth( TriedronLineWidth ); - - glColor3fv( TriedronColorX ); - glBegin( GL_LINES ); - glVertex3dv( TriedronOrigin ); - glVertex3dv( TriedronAxeX ); - glEnd(); - - glColor3fv( TriedronColorY ); - glBegin( GL_LINES ); - glVertex3dv( TriedronOrigin ); - glVertex3dv( TriedronAxeY ); - glEnd(); - - glColor3fv( TriedronColorZ ); - glBegin( GL_LINES ); - glVertex3dv( TriedronOrigin ); - glVertex3dv( TriedronAxeZ ); - glEnd(); - - GLdouble l = L - L/4.; - GLdouble rayon = L/20.; - GLint ii, NbFacettes = 12; - GLdouble Angle = 2. * PI / NbFacettes; - GLdouble TriedronCoord[3] = { 1.0, 0.0, 0.0 }; - - if( myTextList == 0 ) - myTextList = generateTextList(); - - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - - glColor3fv( TriedronColorX ); - glBegin( GL_TRIANGLE_FAN ); - glVertex3dv( TriedronAxeX ); - TriedronCoord[0] = TriedronOrigin[0] + l ; - ii = NbFacettes; - while (ii >= 0 ) { - TriedronCoord[1] = TriedronOrigin[1] + ( rayon * sin(ii * Angle) ); - TriedronCoord[2] = TriedronOrigin[2] + ( rayon * cos(ii * Angle) ); - glVertex3dv( TriedronCoord ); - ii--; - } - glEnd(); - - drawText( myTextList, "X", TriedronAxeX, TriedronLetterColorX ); - - glColor3fv( TriedronColorY ); - glBegin( GL_TRIANGLE_FAN ); - glVertex3dv( TriedronAxeY ); - TriedronCoord[1] = TriedronOrigin[1] + l ; - ii = NbFacettes; - while (ii >= 0 ) { - TriedronCoord[0] = TriedronOrigin[0] + (rayon * cos(ii * Angle) ); - TriedronCoord[2] = TriedronOrigin[2] + (rayon * sin(ii * Angle) ); - glVertex3dv( TriedronCoord ); - ii--; - } - glEnd(); - - drawText( myTextList, "Y", TriedronAxeY, TriedronLetterColorY ); - - glColor3fv( TriedronColorZ ); - glBegin( GL_TRIANGLE_FAN ); - glVertex3dv( TriedronAxeZ ); - TriedronCoord[2] = TriedronOrigin[2] + l ; - ii = NbFacettes; - while (ii >= 0 ) { - TriedronCoord[0] = TriedronOrigin[0] + ( rayon * sin(ii * Angle) ); - TriedronCoord[1] = TriedronOrigin[1] + ( rayon * cos(ii * Angle) ); - glVertex3dv( TriedronCoord ); - ii--; - } - glEnd(); - - drawText( myTextList, "Z", TriedronAxeZ, TriedronLetterColorZ ); - - glPopAttrib(); -} diff --git a/src/OCCViewer/OCCViewer_Trihedron.h b/src/OCCViewer/OCCViewer_Trihedron.h deleted file mode 100644 index 5836264e1..000000000 --- a/src/OCCViewer/OCCViewer_Trihedron.h +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 OCCVIEWER_TRIHEDRON_H -#define OCCVIEWER_TRIHEDRON_H - -#include - -#include -#include -#include - -/*! - * \class OCCViewer_Trihedron - * The class for the presentation of the UserDraw object. -*/ -class OCCViewer_Trihedron : public AIS_InteractiveObject -{ -public: - OCCViewer_Trihedron( const PrsMgr_TypeOfPresentation3d = PrsMgr_TOP_AllView ); - virtual ~OCCViewer_Trihedron(); - - virtual void Compute( const Handle(PrsMgr_PresentationManager3d)&, - const Handle(Prs3d_Presentation)&, - const Standard_Integer ); - - virtual void ComputeSelection( const Handle( SelectMgr_Selection )&, - const Standard_Integer ); - - virtual void bounds( Graphic3d_CBounds& ) const; - - virtual void display(); - - DEFINE_STANDARD_RTTI( OCCViewer_Trihedron ) - -private: - unsigned int myTextList; -}; - -DEFINE_STANDARD_HANDLE( OCCViewer_Trihedron, AIS_InteractiveObject ) - -#endif diff --git a/src/OCCViewer/OCCViewer_VService.cxx b/src/OCCViewer/OCCViewer_VService.cxx deleted file mode 100755 index 77ef0aced..000000000 --- a/src/OCCViewer/OCCViewer_VService.cxx +++ /dev/null @@ -1,302 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 "OCCViewer_VService.h" -#include -#include -#include - -#include -#include -#include - -#ifdef WNT -#include -#include -#include -#include -#include -#else -#include -#include -#include -//#include -#include -#endif - -// For 2d -#define LOPTIM -#ifdef WNT -#ifndef LOPTIM -static Handle(WNT_GraphicDevice) XServiceDefault2dDevice; -static Handle(WNT_GraphicDevice) XServiceImageDevice; -#else -static Handle(WNT_GraphicDevice)& _XServiceDefault2dDevice() { -static Handle(WNT_GraphicDevice) XServiceDefault2dDevice; -return XServiceDefault2dDevice; -} -#define XServiceDefault2dDevice _XServiceDefault2dDevice() - -static Handle(WNT_GraphicDevice)& _XServiceImageDevice() { -static Handle(WNT_GraphicDevice) XServiceImageDevice; -return XServiceImageDevice; -} -#define XServiceImageDevice _XServiceImageDevice() -#endif // LOPTIM -#else -#ifndef LOPTIM -static Handle(Xw_GraphicDevice) XServiceDefault2dDevice; -static Handle(Xw_GraphicDevice) XServiceImageDevice; -#else -static Handle(Xw_GraphicDevice)& _XServiceDefault2dDevice() { -static Handle(Xw_GraphicDevice) XServiceDefault2dDevice; -return XServiceDefault2dDevice; -} -#define XServiceDefault2dDevice _XServiceImageDevice() - -static Handle(Xw_GraphicDevice)& _XServiceImageDevice() { -static Handle(Xw_GraphicDevice) XServiceImageDevice; -return XServiceImageDevice; -} -#define XServiceImageDevice _XServiceImageDevice() -#endif // LOPTIM -#endif // WNT - -/*! - Maps CasCade view to the window [ static ] -*/ -void OCCViewer_VService::SetWindow( const Handle(V3d_View)& view, - const Standard_Integer hiwin, - const Standard_Integer lowin, - const Xw_WindowQuality quality ) -{ -#ifdef WNT - Handle(WNT_Window) w = - new WNT_Window( Handle(Graphic3d_WNTGraphicDevice)::DownCast(view->Viewer()->Device()), hiwin, lowin ); -#else - Handle(Xw_Window) w = - new Xw_Window( Handle(Graphic3d_GraphicDevice)::DownCast(view->Viewer()->Device()), hiwin, lowin, quality ); -#endif - view->SetWindow( w ); -} - -/*! - Magnifies 'view' based on previous view [ static ] -*/ -void OCCViewer_VService::SetMagnify( const Handle(V3d_View)& view, - const Standard_Integer hiwin, - const Standard_Integer lowin, - const Handle(V3d_View)& prevView, - const Standard_Integer x1, - const Standard_Integer y1, - const Standard_Integer x2, - const Standard_Integer y2, - const Xw_WindowQuality aQuality ) -{ -#ifdef WNT - Handle(WNT_Window) w = - new WNT_Window( Handle(Graphic3d_WNTGraphicDevice)::DownCast(view->Viewer()->Device()), hiwin, lowin ); -#else - Handle(Xw_Window) w = - new Xw_Window( Handle(Graphic3d_GraphicDevice)::DownCast(view->Viewer()->Device()), hiwin, lowin, aQuality ); -#endif - view->SetMagnify( w, prevView, x1, y1, x2, y2 ); -} - -/*! - Creates viewer 3d [ static ] -*/ -Handle(V3d_Viewer) OCCViewer_VService::Viewer3d( const Standard_CString aDisplay, - const Standard_ExtString aName, - const Standard_CString aDomain, - const Standard_Real ViewSize , - const V3d_TypeOfOrientation ViewProj, - const Standard_Boolean ComputedMode, - const Standard_Boolean aDefaultComputedMode ) -{ -#ifndef WNT - static Handle(Graphic3d_GraphicDevice) defaultdevice; - if ( defaultdevice.IsNull() ) - defaultdevice = new Graphic3d_GraphicDevice( aDisplay ); - return new V3d_Viewer( defaultdevice, aName, aDomain, ViewSize, ViewProj, - Quantity_NOC_GRAY30, V3d_ZBUFFER, V3d_GOURAUD, V3d_WAIT, - ComputedMode, aDefaultComputedMode, V3d_TEX_NONE ); -#else - static Handle(Graphic3d_WNTGraphicDevice) defaultdevice; - if ( defaultdevice.IsNull() ) - defaultdevice = new Graphic3d_WNTGraphicDevice(); - return new V3d_Viewer( defaultdevice, aName, aDomain, ViewSize, ViewProj, - Quantity_NOC_GRAY30, V3d_ZBUFFER, V3d_GOURAUD, V3d_WAIT, - ComputedMode, aDefaultComputedMode, V3d_TEX_NONE); -#endif // WNT -} - -/*! - Creates view 2D and maps it to the window [ static ] -*/ -/*Handle(V2d_View) OCCViewer_VService::View2d( const Handle(V2d_Viewer)& aViewer, - const Standard_Integer hiwin, - const Standard_Integer lowin, - const Xw_WindowQuality aQuality, - const Standard_Boolean Update, - const Quantity_NameOfColor BackColor ) -{ -#ifdef WNT - Handle(WNT_GraphicDevice) GD = Handle(WNT_GraphicDevice)::DownCast(aViewer->Device()); - Handle(WNT_Window) W = new WNT_Window( GD, hiwin, lowin, BackColor ); - Handle(WNT_WDriver) D = new WNT_WDriver( W ); -#else - Handle(Xw_GraphicDevice) GD = Handle(Xw_GraphicDevice)::DownCast(aViewer->Device()); - Handle(Xw_Window) W = new Xw_Window( GD, hiwin, lowin, aQuality, BackColor ); - Handle(Xw_Driver) D = new Xw_Driver( W ); -#endif - Handle(V2d_View) V = new V2d_View( D, aViewer ); - if ( Update ) - V->Update(); - return V; -}*/ - -/*! - Creates view 2D and maps it to the window [ static ] -*/ -/*Handle(V2d_View) OCCViewer_VService::dpsView2d( const Handle(V2d_Viewer)& aViewer, - const Standard_Integer hiwin, - const Standard_Integer lowin, - const Xw_WindowQuality aQuality, - const Standard_Boolean Update, - const Quantity_NameOfColor BackColor ) -{ -#ifdef WNT - Handle(WNT_GraphicDevice) GD = Handle(WNT_GraphicDevice)::DownCast(aViewer->Device()); - Handle(WNT_Window) W = new WNT_Window( GD, hiwin, lowin, BackColor ); - W->SetBackground( BackColor ); - Handle(WNT_WDriver) D = new WNT_WDriver( W ); -#else - Handle(Xw_GraphicDevice) GD = Handle(Xw_GraphicDevice)::DownCast(aViewer->Device()); - Handle(Xw_Window) W = new Xw_Window( GD, hiwin, lowin, aQuality, BackColor ); - Handle(Xdps_Driver) D = new Xdps_Driver( W ); -#endif - Handle(V2d_View) V = new V2d_View( D, aViewer ); - if ( Update ) - V->Update(); - return V; -}*/ - -/*! - Creates viewer 2D [ static ] -*/ -/*Handle(V2d_Viewer) OCCViewer_VService::Viewer2d( const Standard_CString aDisplay, - const Standard_ExtString aName, - const Standard_CString aDomain ) -{ -#ifdef WNT - if ( XServiceDefault2dDevice.IsNull() ) - XServiceDefault2dDevice = new WNT_GraphicDevice(); -#else - if ( XServiceDefault2dDevice.IsNull() ) - XServiceDefault2dDevice = new Xw_GraphicDevice( aDisplay, Xw_TOM_READONLY ); -#endif - return new V2d_Viewer( XServiceDefault2dDevice, aName, aDomain ); -}*/ - -/*! - Creates viewer 2D [ static ] -*/ -/*Handle(V2d_Viewer) OCCViewer_VService::Viewer2d( const Standard_CString aDisplay, - const Handle(Graphic2d_View)& aView, - const Standard_ExtString aName, - const Standard_CString aDomain ) -{ -#ifdef WNT - if ( XServiceDefault2dDevice.IsNull() ) - XServiceDefault2dDevice = new WNT_GraphicDevice(); -#else - if ( XServiceDefault2dDevice.IsNull() ) - XServiceDefault2dDevice = new Xw_GraphicDevice( aDisplay, Xw_TOM_READONLY ); -#endif - return new V2d_Viewer( XServiceDefault2dDevice, aView, aName, aDomain ); -}*/ - -/*! - Creates window driver [ static ] -*/ -Handle(Aspect_WindowDriver) OCCViewer_VService::WindowDriver( const Standard_CString aDisplay, - const Standard_Integer ahiwin, - const Standard_Integer alowin, - const Quantity_NameOfColor aColor ) -{ -#ifdef WNT - if ( XServiceDefault2dDevice.IsNull() ) - XServiceDefault2dDevice = new WNT_GraphicDevice(); - Handle(WNT_Window) W = new WNT_Window( XServiceDefault2dDevice, ahiwin, alowin, aColor ); - return new WNT_WDriver( W ); -#else - if ( XServiceDefault2dDevice.IsNull() ) - XServiceDefault2dDevice = new Xw_GraphicDevice( aDisplay, Xw_TOM_READONLY ); - Handle(Xw_Window) W = new Xw_Window( XServiceDefault2dDevice, ahiwin, alowin, Xw_WQ_DRAWINGQUALITY , aColor ); - return new Xw_Driver( W ); -#endif -} - -/*! - Creates Xdps window driver [ static ] - On Win32 the same as OCCViewer_VService::WindowDriver() -*/ -/* -Handle(Aspect_WindowDriver) OCCViewer_VService::XdpsDriver( const Standard_CString aDisplay, - const Standard_Integer ahiwin, - const Standard_Integer alowin, - const Quantity_NameOfColor aColor ) -{ -#ifdef WNT - if ( XServiceDefault2dDevice.IsNull() ) - XServiceDefault2dDevice = new WNT_GraphicDevice(); - Handle(WNT_Window) W = new WNT_Window( XServiceDefault2dDevice, ahiwin, alowin, aColor ); - return new WNT_WDriver( W ); -#else - if ( XServiceDefault2dDevice.IsNull() ) - XServiceDefault2dDevice = new Xw_GraphicDevice( aDisplay, Xw_TOM_READONLY ); - Handle(Xw_Window) W = new Xw_Window( XServiceDefault2dDevice, ahiwin, alowin, - Xw_WQ_DRAWINGQUALITY, aColor ); - return new Xdps_Driver( W ); -#endif -} -*/ -/*! - Creates Xw window driver [ static ] - On Win32 the same as OCCViewer_VService::WindowDriver() -*/ -Handle(Aspect_WindowDriver) OCCViewer_VService::ImageDriver( const Standard_CString aDisplay, - const Standard_Integer ahiwin, - const Standard_Integer alowin, - const Quantity_NameOfColor aColor ) -{ -#ifdef WNT - if ( XServiceImageDevice.IsNull() ) - XServiceImageDevice = new WNT_GraphicDevice(); - Handle(WNT_Window) W = new WNT_Window( XServiceImageDevice, ahiwin, alowin, aColor ); - return new WNT_WDriver( W ); -#else - if ( XServiceImageDevice.IsNull() ) - XServiceImageDevice = new Xw_GraphicDevice( aDisplay, Xw_TOM_READONLY ); - Handle(Xw_Window) W = new Xw_Window( XServiceImageDevice, ahiwin, alowin, - Xw_WQ_PICTUREQUALITY, aColor ); - return new Xw_Driver( W ); -#endif -} diff --git a/src/OCCViewer/OCCViewer_VService.h b/src/OCCViewer/OCCViewer_VService.h deleted file mode 100755 index b15ab5564..000000000 --- a/src/OCCViewer/OCCViewer_VService.h +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 OCCVIEWER_VSERVICE_H -#define OCCVIEWER_VSERVICE_H - -#ifndef _Handle_V3d_View_HeaderFile -#include -#endif -#ifndef _Standard_Integer_HeaderFile -#include -#endif -#ifndef _Xw_WindowQuality_HeaderFile -#include -#endif -#ifndef _Handle_V3d_Viewer_HeaderFile -#include -#endif -#ifndef _Standard_CString_HeaderFile -#include -#endif -#ifndef _Standard_ExtString_HeaderFile -#include -#endif -#ifndef _Quantity_Length_HeaderFile -#include -#endif -#ifndef _Quantity_NameOfColor_HeaderFile -#include -#endif -#ifndef _V3d_TypeOfOrientation_HeaderFile -#include -#endif -#ifndef _Standard_Boolean_HeaderFile -#include -#endif -#ifndef _Handle_Graphic2d_View_HeaderFile -#include -#endif -#ifndef _Handle_Aspect_WindowDriver_HeaderFile -#include -#endif - -class V3d_View; -class V2d_View; -class V3d_Viewer; -class V2d_Viewer; -class Graphic2d_View; -class Aspect_WindowDriver; - -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - -class Standard_EXPORT OCCViewer_VService -{ -public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if ( anAddress ) Standard::Free((Standard_Address&)anAddress); - } - - // STATIC METHODS - static void SetWindow( const Handle( V3d_View )& view, - const Standard_Integer hiwin, - const Standard_Integer lowin, - const Xw_WindowQuality quality = Xw_WQ_3DQUALITY ); - - static void SetMagnify( const Handle( V3d_View)& view, - const Standard_Integer hiwin, - const Standard_Integer lowin, - const Handle( V3d_View)& aPreviousView, - const Standard_Integer x1, - const Standard_Integer y1, - const Standard_Integer x2, - const Standard_Integer y2, - const Xw_WindowQuality quality = Xw_WQ_3DQUALITY ); - static Handle_V3d_Viewer - Viewer3d( const Standard_CString display, - const Standard_ExtString name, - const Standard_CString domain = "", - const Quantity_Length ViewSize = 1000.0, - const V3d_TypeOfOrientation ViewProj = V3d_XposYnegZpos, - const Standard_Boolean ComputedMode = Standard_True, - const Standard_Boolean DefaultComputedMode = Standard_True ); - - static Handle_Aspect_WindowDriver - WindowDriver( const Standard_CString display, - const Standard_Integer hiwin, - const Standard_Integer lowin, - const Quantity_NameOfColor color = Quantity_NOC_GRAY69 ); - /*static Handle_Aspect_WindowDriver - XdpsDriver( const Standard_CString display, - const Standard_Integer hiwin, - const Standard_Integer lowin, - const Quantity_NameOfColor color = Quantity_NOC_GRAY69 ); - */ - static Handle_Aspect_WindowDriver - ImageDriver( const Standard_CString display, - const Standard_Integer hiwin, - const Standard_Integer lowin, - const Quantity_NameOfColor color = Quantity_NOC_GRAY69 ); - -}; - -#endif diff --git a/src/OCCViewer/OCCViewer_ViewManager.cxx b/src/OCCViewer/OCCViewer_ViewManager.cxx deleted file mode 100755 index 39c740c5d..000000000 --- a/src/OCCViewer/OCCViewer_ViewManager.cxx +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 "OCCViewer_ViewManager.h" -#include "OCCViewer_ViewWindow.h" -#include "SUIT_Desktop.h" - -/*! - Constructor -*/ -OCCViewer_ViewManager::OCCViewer_ViewManager( SUIT_Study* study, SUIT_Desktop* theDesktop, bool DisplayTrihedron ) -: SUIT_ViewManager( study, theDesktop, new OCCViewer_Viewer( DisplayTrihedron ) ) -{ - setTitle( tr( "OCC_VIEW_TITLE" ) ); -} - -/*! - Destructor -*/ -OCCViewer_ViewManager::~OCCViewer_ViewManager() -{ -} - -/*! - Fills popup menu with custom actions - \param popup - popup menu to be filled with -*/ -void OCCViewer_ViewManager::contextMenuPopup( QMenu* popup ) -{ - SUIT_ViewManager::contextMenuPopup( popup ); - // if it is necessary invoke method CreatePopup of ViewPort - // be sure that existing QPopupMenu menu is used for that. -} diff --git a/src/OCCViewer/OCCViewer_ViewManager.h b/src/OCCViewer/OCCViewer_ViewManager.h deleted file mode 100755 index c39e43cf8..000000000 --- a/src/OCCViewer/OCCViewer_ViewManager.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 OCCVIEWER_VIEWMANAGER_H -#define OCCVIEWER_VIEWMANAGER_H - -#include "OCCViewer_ViewModel.h" - -#include "SUIT_ViewManager.h" - -class SUIT_Desktop; - -class OCCVIEWER_EXPORT OCCViewer_ViewManager : public SUIT_ViewManager -{ - Q_OBJECT - -public: - OCCViewer_ViewManager( SUIT_Study* study, SUIT_Desktop* theDesktop, bool DisplayTrihedron = true ); - ~OCCViewer_ViewManager(); - - OCCViewer_Viewer* getOCCViewer() { return (OCCViewer_Viewer*) myViewModel; } - - virtual void contextMenuPopup( QMenu* ); -}; - -#endif diff --git a/src/OCCViewer/OCCViewer_ViewModel.cxx b/src/OCCViewer/OCCViewer_ViewModel.cxx deleted file mode 100755 index 93768a832..000000000 --- a/src/OCCViewer/OCCViewer_ViewModel.cxx +++ /dev/null @@ -1,653 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 "OCCViewer_ViewModel.h" -#include "OCCViewer_ViewWindow.h" -#include "OCCViewer_VService.h" -#include "OCCViewer_ViewPort3d.h" -#include "OCCViewer_Trihedron.h" - -#include "SUIT_ViewWindow.h" -#include "SUIT_ViewManager.h" -#include "SUIT_Desktop.h" -#include "SUIT_Session.h" - -#include "QtxActionToolMgr.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -/*! - Constructor - \param DisplayTrihedron - is trihedron displayed -*/ -OCCViewer_Viewer::OCCViewer_Viewer( bool DisplayTrihedron, bool DisplayStaticTrihedron ) -: SUIT_ViewModel(), -myBgColor( Qt::black ) -{ - // init CasCade viewers - myV3dViewer = OCCViewer_VService::Viewer3d( "", (short*) "Viewer3d", "", 1000., - V3d_XposYnegZpos, true, true ); - - myV3dViewer->Init(); - - myV3dCollector = OCCViewer_VService::Viewer3d( "", (short*) "Collector3d", "", 1000., - V3d_XposYnegZpos, true, true ); - myV3dCollector->Init(); - - // init selector - myAISContext = new AIS_InteractiveContext( myV3dViewer, myV3dCollector); - - myAISContext->SelectionColor( Quantity_NOC_WHITE ); - - // display isoline on planar faces (box for ex.) - myAISContext->IsoOnPlane( true ); - - double h = QApplication::desktop()->screenGeometry( QApplication::desktop()->primaryScreen() ).height() / 300. ; - Handle(Prs3d_Drawer) drawer = myAISContext->DefaultDrawer(); - Handle(Prs3d_TextAspect) ta = drawer->TextAspect(); - ta->SetHeight(100); // VSR: workaround for CAS.CADE bug (is it really needed ???) - ta->SetHeight(h); - drawer->SetTextAspect(ta); - drawer->AngleAspect()->SetTextAspect(ta); - drawer->LengthAspect()->SetTextAspect(ta); - - clearViewAspects(); - - /* create trihedron */ - if( DisplayTrihedron ) - { - Handle(Geom_Axis2Placement) anAxis = new Geom_Axis2Placement(gp::XOY()); - myTrihedron = new AIS_Trihedron(anAxis); - myTrihedron->SetInfiniteState( Standard_True ); - - Quantity_Color Col(193/255., 205/255., 193/255., Quantity_TOC_RGB); - //myTrihedron->SetColor( Col ); - myTrihedron->SetArrowColor( Col.Name() ); - myTrihedron->SetSize(100); - Handle(AIS_Drawer) drawer = myTrihedron->Attributes(); - if (drawer->HasDatumAspect()) { - Handle(Prs3d_DatumAspect) daspect = drawer->DatumAspect(); - daspect->FirstAxisAspect()->SetColor(Quantity_Color(1.0, 0.0, 0.0, Quantity_TOC_RGB)); - daspect->SecondAxisAspect()->SetColor(Quantity_Color(0.0, 1.0, 0.0, Quantity_TOC_RGB)); - daspect->ThirdAxisAspect()->SetColor(Quantity_Color(0.0, 0.0, 1.0, Quantity_TOC_RGB)); - } - - myAISContext->Display(myTrihedron); - myAISContext->Deactivate(myTrihedron); - } - - /* create static trihedron (16551: EDF PAL 501) */ - if( DisplayStaticTrihedron ) - { - Handle(OCCViewer_Trihedron) aTrihedron = new OCCViewer_Trihedron(); - myAISContext->Display(aTrihedron); - myAISContext->Deactivate(aTrihedron); - aTrihedron->SetTransformPersistence(Graphic3d_TMF_TriedronPers, gp_Pnt(-1, -1, 200)); - } - - // selection - mySelectionEnabled = true; - myMultiSelectionEnabled = true; -} - -/*! - Destructor -*/ -OCCViewer_Viewer::~OCCViewer_Viewer() -{ -} - -/*! - \return background color of viewer -*/ -QColor OCCViewer_Viewer::backgroundColor() const -{ - return myBgColor; -} - -/*! - Sets background color - \param c - new background color -*/ -void OCCViewer_Viewer::setBackgroundColor( const QColor& c ) -{ - if ( c.isValid() ) - myBgColor = c; -} - -/*! - Start initialization of view window - \param view - view window to be initialized -*/ -void OCCViewer_Viewer::initView( OCCViewer_ViewWindow* view ) -{ - if ( view ) { - view->initLayout(); - view->initSketchers(); - - OCCViewer_ViewPort3d* vp3d = view->getViewPort(); - if ( vp3d ) - vp3d->setBackgroundColor( myBgColor ); - } -} - -/*! - Creates new view window - \param theDesktop - main window of application -*/ -SUIT_ViewWindow* OCCViewer_Viewer::createView( SUIT_Desktop* theDesktop ) -{ - OCCViewer_ViewWindow* view = new OCCViewer_ViewWindow(theDesktop, this); - initView( view ); - return view; -} - -/*! - Sets new view manager - \param theViewManager - new view manager -*/ -void OCCViewer_Viewer::setViewManager(SUIT_ViewManager* theViewManager) -{ - SUIT_ViewModel::setViewManager(theViewManager); - if (theViewManager) { - connect(theViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), - this, SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*))); - - connect(theViewManager, SIGNAL(mouseMove(SUIT_ViewWindow*, QMouseEvent*)), - this, SLOT(onMouseMove(SUIT_ViewWindow*, QMouseEvent*))); - - connect(theViewManager, SIGNAL(mouseRelease(SUIT_ViewWindow*, QMouseEvent*)), - this, SLOT(onMouseRelease(SUIT_ViewWindow*, QMouseEvent*))); - } -} - -/*! - SLOT: called on mouse button press, stores current mouse position as start point for transformations -*/ -void OCCViewer_Viewer::onMousePress(SUIT_ViewWindow* theWindow, QMouseEvent* theEvent) -{ - myStartPnt.setX(theEvent->x()); myStartPnt.setY(theEvent->y()); -} - -/*! - SLOT: called on mouse move, processes transformation or hilighting -*/ -void OCCViewer_Viewer::onMouseMove(SUIT_ViewWindow* theWindow, QMouseEvent* theEvent) -{ - if (!mySelectionEnabled) return; - if (!theWindow->inherits("OCCViewer_ViewWindow")) return; - - OCCViewer_ViewWindow* aView = (OCCViewer_ViewWindow*) theWindow; - if ( isSelectionEnabled() ) - myAISContext->MoveTo(theEvent->x(), theEvent->y(), aView->getViewPort()->getView()); -} - - -/*! - SLOT: called on mouse button release, finishes transformation or selection -*/ -void OCCViewer_Viewer::onMouseRelease(SUIT_ViewWindow* theWindow, QMouseEvent* theEvent) -{ - if (!mySelectionEnabled) return; - if (theEvent->button() != Qt::LeftButton) return; - if (!theWindow->inherits("OCCViewer_ViewWindow")) return; - - - myEndPnt.setX(theEvent->x()); myEndPnt.setY(theEvent->y()); - OCCViewer_ViewWindow* aView = (OCCViewer_ViewWindow*) theWindow; - bool aHasShift = (theEvent->modifiers() & Qt::ShiftModifier); - - if (!aHasShift) emit deselection(); - - if (myStartPnt == myEndPnt) - { - if (aHasShift && myMultiSelectionEnabled) - myAISContext->ShiftSelect(); - else - myAISContext->Select(); - } - else - { - if (aHasShift && myMultiSelectionEnabled) - myAISContext->ShiftSelect(myStartPnt.x(), myStartPnt.y(), - myEndPnt.x(), myEndPnt.y(), - aView->getViewPort()->getView(), Standard_False ); - else - myAISContext->Select(myStartPnt.x(), myStartPnt.y(), - myEndPnt.x(), myEndPnt.y(), - aView->getViewPort()->getView(), Standard_False ); - - int Nb = myAISContext->NbSelected(); - if( Nb>1 && !myMultiSelectionEnabled ) - { - myAISContext->InitSelected(); - Handle( SelectMgr_EntityOwner ) anOwner = myAISContext->SelectedOwner(); - if( !anOwner.IsNull() ) - { - myAISContext->ClearSelected( Standard_False ); - myAISContext->AddOrRemoveSelected( anOwner, Standard_False ); - } - } - - myAISContext->UpdateCurrentViewer(); - } - emit selectionChanged(); -} - - -/*! - Sets selection enabled status - \param isEnabled - new status -*/ -void OCCViewer_Viewer::enableSelection(bool isEnabled) -{ - mySelectionEnabled = isEnabled; - //!! To be done for view windows - if ( !myViewManager ) - return; - - QVector wins = myViewManager->getViews(); - for ( int i = 0; i < (int)wins.count(); i++ ) - { - OCCViewer_ViewWindow* win = ::qobject_cast( wins.at( i ) ); - if ( win ) - win->updateEnabledDrawMode(); - } -} - -/*! - Sets multiselection enabled status - \param isEnabled - new status -*/ -void OCCViewer_Viewer::enableMultiselection(bool isEnable) -{ - myMultiSelectionEnabled = isEnable; - //!! To be done for view windows - if ( !myViewManager ) - return; - - QVector wins = myViewManager->getViews(); - for ( int i = 0; i < (int)wins.count(); i++ ) - { - OCCViewer_ViewWindow* win = ::qobject_cast( wins.at( i ) ); - if ( win ) - win->updateEnabledDrawMode(); - } -} - -/*! - Builds popup for occ viewer -*/ -void OCCViewer_Viewer::contextMenuPopup(QMenu* thePopup) -{ - thePopup->addAction( tr( "MEN_DUMP_VIEW" ), this, SLOT( onDumpView() ) ); - thePopup->addAction( tr( "MEN_CHANGE_BACKGROUD" ), this, SLOT( onChangeBgColor() ) ); - - thePopup->addSeparator(); - - OCCViewer_ViewWindow* aView = (OCCViewer_ViewWindow*)(myViewManager->getActiveView()); - - //Support of several toolbars in the popup menu - QList lst = qFindChildren( aView ); - QList::const_iterator it = lst.begin(), last = lst.end(); - for( ; it!=last; it++ ) - thePopup->addAction( (*it)->toggleViewAction() ); -} - -/*! - SLOT: called on dump view operation is activated, stores scene to raster file -*/ -void OCCViewer_Viewer::onDumpView() -{ - OCCViewer_ViewWindow* aView = (OCCViewer_ViewWindow*)(myViewManager->getActiveView()); - if ( aView ) - aView->onDumpView(); -} - -/*! - SLOT: called if background color is to be changed changed, passes new color to view port -*/ -void OCCViewer_Viewer::onChangeBgColor() -{ - OCCViewer_ViewWindow* aView = (OCCViewer_ViewWindow*)(myViewManager->getActiveView()); - if( !aView ) - return; - OCCViewer_ViewPort3d* aViewPort3d = aView->getViewPort(); - if( !aViewPort3d ) - return; - QColor aColorActive = aViewPort3d->backgroundColor(); - - QColor selColor = QColorDialog::getColor( aColorActive, aView); - if ( selColor.isValid() ) - aViewPort3d->setBackgroundColor(selColor); -} - -/*! - Updates OCC 3D viewer -*/ -void OCCViewer_Viewer::update() -{ - if (!myV3dViewer.IsNull()) - myV3dViewer->Update(); - - OCCViewer_ViewWindow* aView = (OCCViewer_ViewWindow*)(myViewManager->getActiveView()); - if ( aView ) - aView->updateGravityCoords(); -} - -/*! - \return objects selected in 3D viewer - \param theList - list to be filled with selected objects -*/ -void OCCViewer_Viewer::getSelectedObjects(AIS_ListOfInteractive& theList) -{ - theList.Clear(); - for (myAISContext->InitSelected(); myAISContext->MoreSelected(); myAISContext->NextSelected()) - theList.Append(myAISContext->SelectedInteractive()); -} - -/*! - Selects objects in 3D viewer. Other selected objects are left as selected - \param theList - list objects to be selected -*/ -void OCCViewer_Viewer::setObjectsSelected(const AIS_ListOfInteractive& theList) -{ - AIS_ListIteratorOfListOfInteractive aIt; - for (aIt.Initialize(theList); aIt.More(); aIt.Next()) - myAISContext->AddOrRemoveSelected(aIt.Value(), false); - myAISContext->UpdateCurrentViewer(); -} - -/*! - Auxiliary method to emit signal selectionChanged() -*/ -void OCCViewer_Viewer::performSelectionChanged() -{ - emit selectionChanged(); -} - -/*! - SLOT, clears view aspects -*/ -void OCCViewer_Viewer::onClearViewAspects() -{ - clearViewAspects(); -} - -/*! - Clears view aspects -*/ -void OCCViewer_Viewer::clearViewAspects() -{ - myViewAspects.clear(); -} - -/*! - \return const reference to list of view aspects -*/ -const viewAspectList& OCCViewer_Viewer::getViewAspects() -{ - return myViewAspects; -} - -/*! - Appends new view aspect - \param aParams - new view aspects -*/ -void OCCViewer_Viewer::appendViewAspect( const viewAspect& aParams ) -{ - myViewAspects.append( aParams ); -} - -/*! - Replaces old view aspects by new ones - \param aViewList - list of new view aspects -*/ -void OCCViewer_Viewer::updateViewAspects( const viewAspectList& aViewList ) -{ - myViewAspects = aViewList; -} - -/*! - Hilights/unhilights object in viewer - \param obj - object to be updated - \param hilight - if it is true, object will be hilighted, otherwise it will be unhilighted - \param update - update current viewer -*/ -bool OCCViewer_Viewer::highlight( const Handle(AIS_InteractiveObject)& obj, - bool hilight, bool update ) -{ - bool isInLocal = myAISContext->HasOpenedContext(); - if( !obj.IsNull() ) - if( !isInLocal ) - { - if ( hilight && !myAISContext->IsSelected( obj ) ) - myAISContext->AddOrRemoveCurrentObject( obj, false ); - else if ( !hilight && myAISContext->IsSelected( obj ) ) - myAISContext->AddOrRemoveCurrentObject( obj, false ); - } - - if ( update ) - myV3dViewer->Redraw(); - - return false; -} - -/*! - Unhilights all objects in viewer - \param updateviewer - update current viewer -*/ -bool OCCViewer_Viewer::unHighlightAll( bool updateviewer ) -{ - if ( myAISContext->HasOpenedContext() ) - myAISContext->ClearSelected( updateviewer ); - else - myAISContext->ClearCurrents( updateviewer ); - return false; -} - -/*! - \return true if object is in viewer or in collector - \param obj - object to be checked - \param onlyInViewer - search object only in viewer (so object must be displayed) -*/ -bool OCCViewer_Viewer::isInViewer( const Handle(AIS_InteractiveObject)& obj, - bool onlyInViewer ) -{ - AIS_ListOfInteractive List; - myAISContext->DisplayedObjects(List); - - if( !onlyInViewer ) - { - AIS_ListOfInteractive List1; - myAISContext->ObjectsInCollector(List1); - List.Append(List1); - } - - AIS_ListIteratorOfListOfInteractive ite(List); - for ( ; ite.More(); ite.Next() ) - if( ite.Value()==obj ) - return true; - - return false; -} - -/*! - \return true if object is displayed in viewer - \param obj - object to be checked -*/ -bool OCCViewer_Viewer::isVisible( const Handle(AIS_InteractiveObject)& obj ) -{ - return myAISContext->IsDisplayed( obj ); -} - -/*! - Sets color of object - \param obj - object to be updated - \param color - new color - \param update - update current viewer -*/ -void OCCViewer_Viewer::setColor( const Handle(AIS_InteractiveObject)& obj, - const QColor& color, - bool update ) -{ - if( !obj.IsNull() ) - { - Quantity_Color CSFColor = Quantity_Color ( color.red() / 255., - color.green() / 255., - color.blue() / 255., - Quantity_TOC_RGB ); - obj->SetColor( CSFColor ); - } - - if( update ) - myV3dViewer->Update(); -} - -/*! - Changes display mode of object - \param obj - object to be processed - \param mode - new display mode - \param update - update current viewer -*/ -void OCCViewer_Viewer::switchRepresentation( const Handle(AIS_InteractiveObject)& obj, - int mode, bool update ) -{ - myAISContext->SetDisplayMode( obj, (Standard_Integer)mode, update ); - if( update ) - myV3dViewer->Update(); -} - -/*! - Changes transparency of object - \param obj - object to be processed - \param trans - new transparency - \param update - update current viewer -*/ -void OCCViewer_Viewer::setTransparency( const Handle(AIS_InteractiveObject)& obj, - float trans, bool update ) -{ - myAISContext->SetTransparency( obj, trans, false ); - myAISContext->Redisplay( obj, Standard_False, Standard_True ); - if( update ) - myV3dViewer->Update(); -} - -/*! - Changes visibility of trihedron to opposite -*/ -void OCCViewer_Viewer::toggleTrihedron() -{ - setTrihedronShown( !isTrihedronVisible() ); -} - -/*! - \return true if trihedron is visible -*/ -bool OCCViewer_Viewer::isTrihedronVisible() const -{ - return !myTrihedron.IsNull() && !myAISContext.IsNull() && myAISContext->IsDisplayed( myTrihedron ); -} - -/*! - Sets visibility state of trihedron - \param on - new state -*/ - -void OCCViewer_Viewer::setTrihedronShown( const bool on ) -{ - if ( myTrihedron.IsNull() ) - return; - - if ( on ) - myAISContext->Display( myTrihedron ); - else - myAISContext->Erase( myTrihedron ); -} - -/*! - \return trihedron size -*/ -double OCCViewer_Viewer::trihedronSize() const -{ - double sz = 0; - if ( !myTrihedron.IsNull() ) - sz = myTrihedron->Size(); - return sz; -} - -/*! - Changes trihedron size - \param sz - new size -*/ -void OCCViewer_Viewer::setTrihedronSize( const double sz ) -{ - if ( !myTrihedron.IsNull() ) - myTrihedron->SetSize( sz ); -} - -/*! - Set number of isolines - \param u - u-isolines (first parametric co-ordinate) - \param v - v-isolines (second parametric co-ordinate) -*/ -void OCCViewer_Viewer::setIsos( const int u, const int v ) -{ - Handle(AIS_InteractiveContext) ic = getAISContext(); - if ( ic.IsNull() ) - return; - - ic->SetIsoNumber( u, AIS_TOI_IsoU ); - ic->SetIsoNumber( v, AIS_TOI_IsoV ); -} - -/*! - \return number of isolines - \param u - to return u-isolines (first parametric co-ordinate) - \param v - to return v-isolines (second parametric co-ordinate) -*/ -void OCCViewer_Viewer::isos( int& u, int& v ) const -{ - Handle(AIS_InteractiveContext) ic = getAISContext(); - if ( !ic.IsNull() ) - { - u = ic->IsoNumber( AIS_TOI_IsoU ); - v = ic->IsoNumber( AIS_TOI_IsoV ); - } -} diff --git a/src/OCCViewer/OCCViewer_ViewModel.h b/src/OCCViewer/OCCViewer_ViewModel.h deleted file mode 100755 index 586cb80a7..000000000 --- a/src/OCCViewer/OCCViewer_ViewModel.h +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 OCCVIEWER_VIEWMODEL_H -#define OCCVIEWER_VIEWMODEL_H - -#include -#include - -#include "OCCViewer.h" - -#include "SUIT_ViewModel.h" - -#include -#include -#include - -class QMouseEvent; - -class SUIT_ViewWindow; -class SUIT_Desktop; -class OCCViewer_ViewWindow; - -class AIS_ListOfInteractive; - -struct viewAspect -{ -public: - double scale; - double centerX; - double centerY; - double projX; - double projY; - double projZ; - double twist; - double atX; - double atY; - double atZ; - double eyeX; - double eyeY; - double eyeZ; - double scaleX; - double scaleY; - double scaleZ; - QString name; -}; - -typedef QList viewAspectList; - -#ifdef WIN32 -#pragma warning( disable:4251 ) -#endif - -class OCCVIEWER_EXPORT OCCViewer_Viewer: public SUIT_ViewModel -{ - Q_OBJECT - -public: - static QString Type() { return "OCCViewer"; } - - OCCViewer_Viewer( bool DisplayTrihedron = true, bool DisplayStaticTrihedron = true ); - virtual ~OCCViewer_Viewer(); - - void update(); - - virtual SUIT_ViewWindow* createView(SUIT_Desktop* theDesktop); - - virtual void setViewManager(SUIT_ViewManager* theViewManager); - virtual QString getType() const { return Type(); } - - virtual void contextMenuPopup(QMenu*); - - void getSelectedObjects(AIS_ListOfInteractive& theList); - void setObjectsSelected(const AIS_ListOfInteractive& theList); - void setSelected(const Handle(AIS_InteractiveObject)& theIO) { myAISContext->SetSelected(theIO);} - - void performSelectionChanged(); - // emit signal selectionChanged - - virtual const viewAspectList& getViewAspects(); - virtual void appendViewAspect( const viewAspect& ); - virtual void updateViewAspects( const viewAspectList& ); - virtual void clearViewAspects(); - - QColor backgroundColor() const; - void setBackgroundColor( const QColor& ); - - //! returns true if 3d Trihedron in viewer was created - bool trihedronActivated() const { return !myTrihedron.IsNull(); } - - void toggleTrihedron(); - bool isTrihedronVisible() const; - virtual void setTrihedronShown( const bool ); - - double trihedronSize() const; - virtual void setTrihedronSize( const double ); - -public slots: - void onClearViewAspects(); - -public: - Handle(V3d_Viewer) getViewer3d() const { return myV3dViewer;} - Handle(V3d_Viewer) getCollector3d() const { return myV3dCollector; } - Handle(AIS_InteractiveContext) getAISContext() const { return myAISContext; } - Handle(AIS_Trihedron) getTrihedron() const { return myTrihedron; } - - void enableSelection(bool isEnabled); - bool isSelectionEnabled() const { return mySelectionEnabled; } - - void enableMultiselection(bool isEnable); - bool isMultiSelectionEnabled() const { return myMultiSelectionEnabled; } - - int getSelectionCount() const { return (!myAISContext.IsNull())? myAISContext->NbSelected():0; } - - /* Selection management */ - bool highlight( const Handle(AIS_InteractiveObject)&, bool, bool=true ); - bool unHighlightAll( bool=true ); - bool isInViewer( const Handle(AIS_InteractiveObject)&, bool=false ); - bool isVisible( const Handle(AIS_InteractiveObject)& ); - - void setColor( const Handle(AIS_InteractiveObject)&, const QColor&, bool=true ); - void switchRepresentation( const Handle(AIS_InteractiveObject)&, int, bool=true ); - void setTransparency( const Handle(AIS_InteractiveObject)&, float, bool=true ); - void setIsos( const int u, const int v ); // number of isolines - void isos( int& u, int& v ) const; - -signals: - void selectionChanged(); - void deselection(); - -protected: - void initView( OCCViewer_ViewWindow* view ); - -protected slots: - void onMousePress(SUIT_ViewWindow*, QMouseEvent*); - void onMouseMove(SUIT_ViewWindow*, QMouseEvent*); - void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*); - - void onDumpView(); - void onChangeBgColor(); - -private: - Handle(V3d_Viewer) myV3dViewer; - Handle(V3d_Viewer) myV3dCollector; - - Handle(AIS_Trihedron) myTrihedron; - Handle(AIS_InteractiveContext) myAISContext; - - viewAspectList myViewAspects; - - bool mySelectionEnabled; - bool myMultiSelectionEnabled; - - QColor myBgColor; - QPoint myStartPnt, myEndPnt; -}; - -#ifdef WIN32 -#pragma warning( default:4251 ) -#endif - -#endif diff --git a/src/OCCViewer/OCCViewer_ViewPort.cxx b/src/OCCViewer/OCCViewer_ViewPort.cxx deleted file mode 100755 index d21fb39f3..000000000 --- a/src/OCCViewer/OCCViewer_ViewPort.cxx +++ /dev/null @@ -1,489 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 -// - -#if !defined WNT -#define QT_CLEAN_NAMESPACE /* avoid definition of INT32 and INT8 */ -#endif - -#include "OCCViewer_ViewPort.h" - -#include "SUIT_Session.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#if !defined WNT -#include -#include -#include -#include -#include -#include -#undef QT_CLEAN_NAMESPACE -#include -#include - -struct CMapEntry -{ - CMapEntry(); - ~CMapEntry(); - Colormap cmap; - bool alloc; - XStandardColormap scmap; -}; - -/*! - Constructor -*/ -CMapEntry::CMapEntry() -{ - cmap = 0; - alloc = false; - scmap.colormap = 0; -} - -/*! - Destructor -*/ -CMapEntry::~CMapEntry() -{ - if ( alloc ) - XFreeColormap( QX11Info::display(), cmap ); -} - -static QMultiHash *cmap_dict = 0; -static bool mesa_gl = false; - -static void cleanup_cmaps() -{ - if ( !cmap_dict ) - return; - //while (!cmap_dict->isEmpty()) - // cmap_dict->erase(cmap_dict->begin()); - cmap_dict->clear(); - delete cmap_dict; - cmap_dict = 0; -} - -static Colormap choose_cmap( Display *dpy, XVisualInfo *vi ) -{ - if ( !cmap_dict ) - { - cmap_dict = new QMultiHash; - const char *v = glXQueryServerString( dpy, vi->screen, GLX_VERSION ); - mesa_gl = strstr( v,"Mesa" ) != 0; - qAddPostRoutine( cleanup_cmaps ); - } - - QHash::iterator itH = cmap_dict->find( (long)vi->visualid ); - if ( itH != cmap_dict->end() ) // found colormap for visual - return itH.value().cmap; - - CMapEntry x; - - XStandardColormap *c; - int n, i; - - //#ifdef DEBUG - //cout << "Choosing cmap for vID = " << vi->visualid << endl; - //#endif - - if ( vi->visualid == XVisualIDFromVisual( (Visual*)QX11Info::appVisual() ) ) - { -#ifdef DEBUG - cout << "Using x11AppColormap" << endl; -#endif - return QX11Info::appColormap(); - } - - if ( mesa_gl ) - { - Atom hp_cmaps = XInternAtom( dpy, "_HP_RGB_SMOOTH_MAP_LIST", true ); - if ( hp_cmaps && vi->visual->c_class == TrueColor && vi->depth == 8 ) - { - if ( XGetRGBColormaps( dpy, RootWindow( dpy, vi->screen ), &c, &n, hp_cmaps ) ) - { - i = 0; - while ( i < n && x.cmap == 0 ) - { - if ( c[i].visualid == vi->visual->visualid ) - { - x.cmap = c[i].colormap; - x.scmap = c[i]; - } - i++; - } - XFree( (char*)c ); - } - } - } -#if !defined( _OS_SOLARIS_ ) - if ( !x.cmap ) - { - if ( XmuLookupStandardColormap( dpy, vi->screen, vi->visualid, vi->depth, XA_RGB_DEFAULT_MAP, false, true ) ) - { - if ( XGetRGBColormaps( dpy, RootWindow( dpy, vi->screen ), &c, &n, XA_RGB_DEFAULT_MAP ) ) - { - i = 0; - while ( i < n && x.cmap == 0 ) - { - if ( c[i].visualid == vi->visualid ) - { - x.cmap = c[i].colormap; - x.scmap = c[i]; - } - i++; - } - XFree( (char *)c ); - } - } - } -#endif - if ( !x.cmap ) - { - // no shared cmap found - x.cmap = XCreateColormap( dpy, RootWindow( dpy, vi->screen ), vi->visual, AllocNone ); - x.alloc = true; - } - - cmap_dict->insert( (long)vi->visualid, x ); // associate cmap with visualid - return x.cmap; -} -#endif - - -/*! - Constructor -*/ -OCCViewer_ViewPort::OCCViewer_ViewPort( QWidget* parent ) -: QWidget( parent ) -{ - initialize(); -} - -/*! - Destructor -*/ -OCCViewer_ViewPort::~OCCViewer_ViewPort() -{ - cleanup(); -} - -/*! - Initializes viewport. [ private ] -*/ -void OCCViewer_ViewPort::initialize() -{ - myPaintersRedrawing = false; - myEnableSketching = true; - myEnableTransform = true; - - setMouseTracking( true ); - setBackgroundRole( QPalette::NoRole );//NoBackground ); - // set focus policy to threat QContextMenuEvent from keyboard - setFocusPolicy( Qt::StrongFocus ); - setAttribute( Qt::WA_PaintOnScreen ); - setAttribute( Qt::WA_NoSystemBackground ); -} - -/*! - Cleans up the viewport. [ private ] -*/ -void OCCViewer_ViewPort::cleanup() -{ -} - -/*! - Selects visual ID for OpenGL window ( X11 specific ). [ protected ] -*/ -void OCCViewer_ViewPort::selectVisualId() -{ -#if !defined WNT - XVisualInfo* pVisualInfo; - if ( QX11Info::display() ) - { - /* Initialization with the default VisualID */ - Visual *v = DefaultVisual( QX11Info::display(), DefaultScreen( QX11Info::display() ) ); - int visualID = XVisualIDFromVisual( v ); - - /* Here we use the settings from Optimizer_ViewInfo::TxglCreateWindow() */ - int visualAttr[] = { GLX_RGBA, GLX_DEPTH_SIZE, 1, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, - GLX_BLUE_SIZE, 1, GLX_DOUBLEBUFFER, None }; - - pVisualInfo = ::glXChooseVisual( QX11Info::display(), DefaultScreen( QX11Info::display() ), visualAttr ); - - if ( isVisible() ) - hide(); - - XSetWindowAttributes a; - - a.colormap = choose_cmap( QX11Info::display(), pVisualInfo ); /* find best colormap */ - a.background_pixel = QColormap::instance().pixel( backgroundColor() ); - a.border_pixel = QColormap::instance().pixel( Qt::black ); - Window p = RootWindow( QX11Info::display(), DefaultScreen( QX11Info::display() ) ); - if ( parentWidget() ) - p = parentWidget()->winId(); - - Window w; - /* if ( type == Type2D ) // creating simple X window for 2d - { - unsigned long xbackground = - BlackPixel( QX11Info::display(), DefaultScreen( QX11Info::display() ) ); - unsigned long xforeground = - WhitePixel( QX11Info::display(), DefaultScreen( QX11Info::display() ) ); - - w = XCreateSimpleWindow ( QX11Info::display(), p, x(), y(), width(), - height(), 0, xforeground, xbackground ); - } - else if ( type == Type3D ) - { - w = XCreateWindow( QX11Info::display(), p, x(), y(), width(), height(), - 0, pVisualInfo->depth, InputOutput, pVisualInfo->visual, - CWBackPixel | CWBorderPixel | CWColormap, &a ); - } - else - return;*/ - w = XCreateWindow( QX11Info::display(), p, x(), y(), width(), height(), - 0, pVisualInfo->depth, InputOutput, pVisualInfo->visual, - CWBackPixel | CWBorderPixel | CWColormap, &a ); - - Window *cmw; - Window *cmwret; - int count; - if ( XGetWMColormapWindows( QX11Info::display(), topLevelWidget()->winId(), &cmwret, &count ) ) - { - cmw = new Window[count+1]; - memcpy( (char*)cmw, (char*)cmwret, sizeof(Window) * count ); - XFree( (char*)cmwret ); - int i; - - for ( i = 0; i < count; i++ ) - { - if ( cmw[i] == winId() ) /* replace old window */ - { - cmw[i] = w; - break; - } - } - - if ( i >= count ) /* append new window */ - cmw[count++] = w; - } - else - { - count = 1; - cmw = new Window[count]; - cmw[0] = w; - } - - /* Creating new window (with good VisualID) for this widget */ - create(w); - XSetWMColormapWindows( QX11Info::display(), topLevelWidget()->winId(), cmw, count ); - delete[] cmw; - - if ( isVisible() ) - show(); - - if ( pVisualInfo ) - { - XFree( (char *)pVisualInfo ); - } - XFlush( QX11Info::display() ); - } -#endif -} - -/*! - Sets the background 'color'. [ virtual ] -*/ -void OCCViewer_ViewPort::setBackgroundColor( const QColor& color ) -{ - QPalette pal = palette(); - pal.setColor( QPalette::Background, color ); - setPalette( pal ); - repaint(); - emit vpChangeBGColor( color ); -} - -/*! - Returns the background color. [ virtual ] -*/ -QColor OCCViewer_ViewPort::backgroundColor() const -{ - return palette().color( QPalette::Active, QPalette::Background ); -} - -/*! - Returns 'true' if sketching is enabled in this viewport. [ public ] -*/ -bool OCCViewer_ViewPort::isSketchingEnabled() const -{ - return myEnableSketching; -} - -/*! - Enables / disables sketching [ public ] -*/ -void OCCViewer_ViewPort::setSketchingEnabled( bool enable ) -{ - myEnableSketching = enable; -} - -/*! - Returns 'true' if transformations ( rotation, zoom etc. ) - are enabled in this viewport. [ public ] -*/ -bool OCCViewer_ViewPort::isTransformEnabled() const -{ - return myEnableTransform; -} - -/*! - Enables / disables transformations. [ public ] -*/ -void OCCViewer_ViewPort::setTransformEnabled( bool enable ) -{ - myEnableTransform = enable; -} - -/*! - Emits 'mouseEvent' signal. [ virtual protected ] -*/ -void OCCViewer_ViewPort::mousePressEvent( QMouseEvent *e ) -{ - emit vpMouseEvent( e ); -} - -/*! - Emits 'mouseEvent' signal. [ virtual protected ] -*/ -void OCCViewer_ViewPort::mouseMoveEvent( QMouseEvent* e ) -{ - emit vpMouseEvent( e ); -} - -/*! - Emits 'mouseEvent' signal. [ virtual protected ] -*/ -void OCCViewer_ViewPort::mouseReleaseEvent( QMouseEvent *e ) -{ - emit vpMouseEvent( e ); -} - -/*! - Emits 'mouseEvent' signal. [ virtual protected ] -*/ -void OCCViewer_ViewPort::mouseDoubleClickEvent( QMouseEvent *e ) -{ - emit vpMouseEvent( e ); -} - -/*! - Emits 'keyEvent' signal. [ virtual protected ] -*/ -void OCCViewer_ViewPort::keyPressEvent( QKeyEvent *e ) -{ - emit vpKeyEvent( e ); -} - -/*! - Emits 'keyEvent' signal. [ virtual protected ] -*/ -void OCCViewer_ViewPort::keyReleaseEvent( QKeyEvent *e ) -{ - emit vpKeyEvent( e ); -} - -/*! - Repaints the viewport. [ virtual protected ] -*/ -void OCCViewer_ViewPort::paintEvent( QPaintEvent* ) -{ - if ( myPaintersRedrawing ) - { - QPainter p( this ); - emit vpDrawExternal( &p ); - myPaintersRedrawing = false; - } -} - -/*! - Forces to redraw the viewport by an external painter. [ public ] -*/ -void OCCViewer_ViewPort::redrawPainters() -{ - myPaintersRedrawing = true; - repaint(); -} - -/*! - Updates this view. Does nothing by default. [ virtual public ] -*/ -void OCCViewer_ViewPort::onUpdate() -{ -} - -/*! - Creates the popup. [ virtual protected ] -*/ -/*void OCCViewer_ViewPort::onCreatePopup( QPopupMenu* popup ) -{ - if ( popup ) - { - QtxAction* a = new QtxAction( "", tr( "MEN_VP_CHANGEBGR" ), 0, this ); - a->setStatusTip( tr( "PRP_VP_CHANGEBGR" ) ); - connect( a, SIGNAL( activated() ), SLOT( onChangeBgColor())); - myPopupActions.append( a ); - a->addTo( popup ); - } -}*/ - -/*! - Destroys the popup. [ virtual protected ] -*/ -/*void OCCViewer_ViewPort::onDestroyPopup( QPopupMenu* popup ) -{ - if ( popup ) - { - for ( QtxAction* a = myPopupActions.first(); a; a = myPopupActions.next() ) - a->removeFrom( popup ); - //while (!myPopupActions.isEmpty()) - // delete myPopupActions.takeFirst(); - myPopupActions.clear(); - } -}*/ - -/*! - Sets the background color with color selection dialog. [ virtual protected slot ] -*/ -void OCCViewer_ViewPort::onChangeBgColor() -{ - QColor selColor = QColorDialog::getColor ( backgroundColor(), this ); - if ( selColor.isValid() ) - setBackgroundColor( selColor ); -} diff --git a/src/OCCViewer/OCCViewer_ViewPort.h b/src/OCCViewer/OCCViewer_ViewPort.h deleted file mode 100755 index 49fcc855f..000000000 --- a/src/OCCViewer/OCCViewer_ViewPort.h +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 OCCVIEWER_VIEWPORT_H -#define OCCVIEWER_VIEWPORT_H - -#include "OCCViewer.h" - -#include "QtxAction.h" - -#include -#include - -#include - -class QColor; -class QRect; -class QPainter; -class OCCViewer_ViewSketcher; - -#ifdef WIN32 -#pragma warning ( disable:4251 ) -#endif - -/*! - \class OCCViewer_ViewPort - Visualisation canvas of SUIT-based application -*/ -class OCCVIEWER_EXPORT OCCViewer_ViewPort : public QWidget -{ - Q_OBJECT - - friend class OCCViewer_ViewSketcher; - -public: - OCCViewer_ViewPort( QWidget* parent ); - virtual ~OCCViewer_ViewPort(); - -public: - void setSketchingEnabled( bool ); - bool isSketchingEnabled() const; - void setTransformEnabled( bool ); - bool isTransformEnabled() const; - - virtual QColor backgroundColor() const; - virtual void setBackgroundColor( const QColor& ); - - void redrawPainters(); - - virtual void onUpdate(); - -protected: -// enum ViewType { Type2D, Type3D }; - void selectVisualId(); - -// EVENTS - virtual void paintEvent( QPaintEvent *); - virtual void mouseMoveEvent( QMouseEvent *); - virtual void mouseReleaseEvent( QMouseEvent *); - virtual void mousePressEvent( QMouseEvent *); - virtual void mouseDoubleClickEvent( QMouseEvent *); - virtual void keyPressEvent( QKeyEvent *); - virtual void keyReleaseEvent( QKeyEvent *); - -// TO BE REDEFINED - virtual void reset() = 0; - virtual void pan( int, int ) = 0; - virtual void setCenter( int, int ) = 0; - virtual void fitRect( const QRect& ) = 0; - virtual void zoom( int, int, int, int ) = 0; - virtual void fitAll( bool keepScale = false, bool withZ = true, bool upd = true ) = 0; - -// POPUP -// void onCreatePopup( QPopupMenu* ); -// void onDestroyPopup( QPopupMenu* ); - -protected slots: - virtual void onChangeBgColor(); - -signals: - void vpKeyEvent( QKeyEvent* ); - void vpMouseEvent( QMouseEvent* ); - void vpDrawExternal( QPainter* ); - void vpChangeBGColor( QColor ); - -private: - void initialize(); - void cleanup(); - -protected: - Handle(Aspect_Window) myWindow; - bool myEnableSketching; - bool myEnableTransform; - bool myPaintersRedrawing; /* set to draw externally */ - QList myPopupActions; - -private: - static int nCounter; /* objects counter */ -}; - -#ifdef WIN32 -#pragma warning ( default:4251 ) -#endif - -#endif diff --git a/src/OCCViewer/OCCViewer_ViewPort3d.cxx b/src/OCCViewer/OCCViewer_ViewPort3d.cxx deleted file mode 100755 index 487c81d33..000000000 --- a/src/OCCViewer/OCCViewer_ViewPort3d.cxx +++ /dev/null @@ -1,537 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 "OCCViewer_ViewPort3d.h" - -#include "OCCViewer_VService.h" -#include "OCCViewer_ViewWindow.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#if defined WNT -#include -#else -#include -#endif - -static double rx = 0.; -static double ry = 0.; -static int sx = 0; -static int sy = 0; -static Standard_Boolean zRotation = Standard_False; - -/*! - Constructor -*/ -OCCViewer_ViewPort3d::OCCViewer_ViewPort3d( QWidget* parent, const Handle( V3d_Viewer)& viewer, V3d_TypeOfView type ) -: OCCViewer_ViewPort( parent ), -myScale( 1.0 ), -myDegenerated( true ), -myAnimate( false ) -{ - selectVisualId(); - - if ( type == V3d_ORTHOGRAPHIC ) { - myOrthoView = new V3d_OrthographicView( viewer ); - myActiveView = myOrthoView; - myPerspView = 0; - } else { - myPerspView = new V3d_PerspectiveView( viewer ); - myActiveView = myPerspView; - } - if ( myDegenerated ) - activeView()->SetDegenerateModeOn(); -} - -/*! - Destructor -*/ -OCCViewer_ViewPort3d::~OCCViewer_ViewPort3d() -{ - Handle(V3d_View) aView = activeView(); - if (!aView.IsNull()) - aView->Remove(); -} - -/*! - Activates the desired 'type' of view in the viewer - ( view of 'type' is created if it doesn't exist ). [ public ] -*/ -/*void OCCViewer_ViewPort3d::setActive( V3d_TypeOfView type ) -{ - if ( activeView().IsNull() ) - return; - - if ( activeView()->Type() != type ) - { - if ( type == V3d_ORTHOGRAPHIC ) - setView( myOrthoView ); - if ( type == V3d_PERSPECTIVE ) - setView( myPerspView ); - } -}*/ - -/*! - Maps CasCade 'view' to this viewport. [ private ] -*/ -bool OCCViewer_ViewPort3d::mapView( const Handle(V3d_View)& view ) -{ - if ( !setWindow( view ) ) - return false; - - if ( !mapped( view ) ) - { - view->SetWindow( myWindow ); - if ( view != activeView() ) - view->View()->Deactivate(); - } - return true; -} - -/*! - Sets new CASCADE view on viewport. Returns the previous active view. [ public ] -*/ -Handle( V3d_View ) OCCViewer_ViewPort3d::setView( const Handle( V3d_View )& view ) -{ - /* map the new view */ - if ( view == activeView() || !mapView( view ) ) - return activeView(); - - /* activate the new view*/ - Handle( V3d_View ) oldView = activeView(); - if ( !oldView.IsNull() ) - { - oldView->View()->Deactivate(); - view->SetBackgroundColor( oldView->BackgroundColor() ); - } - if ( myDegenerated ) - view->SetDegenerateModeOn(); - else - view->SetDegenerateModeOff(); - - view->View()->Activate(); - activeView() = view; - return oldView; -} - -/*! - Returns CasCade 3D view. [ public ] -*/ -Handle(V3d_View) OCCViewer_ViewPort3d::getView() const -{ - return activeView(); -} - -/*! - Returns CasCade 3D viewer [ public ] -*/ -Handle(V3d_Viewer) OCCViewer_ViewPort3d::getViewer() const -{ - Handle(V3d_Viewer) viewer; - if ( !activeView().IsNull() ) - viewer = activeView()->Viewer(); - return viewer; -} - -/*! - Syncronizes visual state of this viewport with 'ref' - ( scale, projection, eye etc ) Returns 'true' if copied OK, - 'false' otherwise. [ virtual public ] -*/ -bool OCCViewer_ViewPort3d::syncronize( const OCCViewer_ViewPort3d* ref ) -{ - OCCViewer_ViewPort3d* ref3d = (OCCViewer_ViewPort3d*)ref; - Handle(V3d_View) refView = ref3d->getView(); - Handle(V3d_View) tgtView = getView(); - - /* Syncronize view types */ -/* if ( tgtView->Type() != refView->Type() ) - { - setActive( refView->Type() ); - tgtView = getView(); - }*/ - - /* The following params are copied: - - view type( ortho/persp ) - - position of view point - - orientation of high point - - position of the eye - - projection vector - - view center ( 2D ) - - view twist - - view scale - */ - - /* we'll update after setting all params */ - tgtView->SetImmediateUpdate( Standard_False ); - - /* perspective */ - if ( refView->Type() == V3d_PERSPECTIVE ) - tgtView->SetFocale( refView->Focale() ); - - /* copy params */ - Standard_Real x, y, z; - refView->At( x, y, z ); tgtView->SetAt( x, y, z ); - refView->Up( x, y, z ); tgtView->SetUp( x, y, z ); - refView->Eye( x, y, z ); tgtView->SetEye( x, y, z ); - refView->Proj( x, y, z ); tgtView->SetProj( x, y, z ); - refView->Center( x, y ); tgtView->SetCenter( x, y ); - tgtView->SetScale( refView->Scale() ); - tgtView->SetTwist( refView->Twist() ); - - /* update */ - tgtView->Update(); - tgtView->SetImmediateUpdate( Standard_True ); - return true; -} - -/*! - Returns Z-size of this view. [ public ] -*/ -double OCCViewer_ViewPort3d::getZSize() const -{ - if ( !activeView().IsNull() ) - return activeView()->ZSize(); - return 0; -} - -/*! - Sets Z-size of this view ( for both orthographic and perspective ). [ public ] -*/ -void OCCViewer_ViewPort3d::setZSize( double zsize ) -{ - myActiveView->SetZSize( zsize ); -/* if ( !myOrthoView.IsNull() ) - myOrthoView->SetZSize( zsize ); - if ( !myPerspView.IsNull() ) - myPerspView->SetZSize( zsize );*/ -} - -/*! - Returns the background color [ virtual public ] -*/ -QColor OCCViewer_ViewPort3d::backgroundColor() const -{ - if ( !activeView().IsNull() ) - { - Standard_Real aRed, aGreen, aBlue; - activeView()->BackgroundColor( Quantity_TOC_RGB, aRed, aGreen, aBlue ); - int red = (int) (aRed * 255); - int green = (int) (aGreen * 255); - int blue = (int) (aBlue * 255); - return QColor( red, green, blue ); - } - return OCCViewer_ViewPort::backgroundColor(); -} - -/*! - Sets the background color [ virtual public ] -*/ -void OCCViewer_ViewPort3d::setBackgroundColor( const QColor& color ) -{ - if ( !activeView().IsNull() ) - { - activeView()->SetBackgroundColor( Quantity_TOC_RGB, color.red()/255., - color.green()/255., color.blue()/255.); - activeView()->Update(); - emit vpChangeBGColor( color ); - } -} - -/*! - Set animation mode - \param theDegenerated - degenerated mode -*/ -void OCCViewer_ViewPort3d::setAnimationMode(bool theDegenerated) -{ - if ( !activeView().IsNull() ) - { - myAnimate = theDegenerated; - activeView()->SetAnimationMode(true, theDegenerated); - } -} - -/*! - Updates the active viewport. [ virtual public ] -*/ -void OCCViewer_ViewPort3d::onUpdate() -{ - if ( !activeView().IsNull() ) - activeView()->Update(); -} - -/*! - Called at 'window fit' transformation. [ virtual protected ] -*/ -void OCCViewer_ViewPort3d::fitRect( const QRect& rect ) -{ - if ( !activeView().IsNull() ) - activeView()->WindowFit( rect.left(), rect.top(), rect.right(), rect.bottom() ); -} - -/*! - Called at 'zoom' transformation. [ virtual protected ] -*/ -void OCCViewer_ViewPort3d::zoom( int x0, int y0, int x, int y ) -{ - if ( !activeView().IsNull() ) { - // as OCCT respects a sign of only dx, - // but we want both signes to be taken into account - //activeView()->Zoom( x0, y0, x, y ); - activeView()->Zoom( x0 + y0, 0, x + y, 0 ); - } -} - -/*! - Centers the viewport. [ virtual protected ] -*/ -void OCCViewer_ViewPort3d::setCenter( int x, int y ) -{ - if ( !activeView().IsNull() ) - activeView()->Place( x, y, myScale ); -} - -/*! - Called at 'pan' transformation. [ virtual protected ] -*/ -void OCCViewer_ViewPort3d::pan( int dx, int dy ) -{ - if ( !activeView().IsNull() ) - activeView()->Pan( dx, dy, 1.0 ); -} - -/*! - Inits 'rotation' transformation. [ protected ] -*/ -void OCCViewer_ViewPort3d::startRotation( int x, int y, - int theRotationPointType, - const gp_Pnt& theSelectedPoint ) -{ - if ( !activeView().IsNull() ) - { - myDegenerated = activeView()->DegenerateModeIsOn(); - activeView()->SetDegenerateModeOn(); - if (myAnimate) activeView()->SetAnimationModeOn(); - - //double gx, gy, gz; - //double gx = activeView()->gx; - //activeView()->Gravity(gx,gy,gz); - - switch ( theRotationPointType ) { - case OCCViewer_ViewWindow::GRAVITY: - activeView()->StartRotation( x, y, 0.45 ); - break; - case OCCViewer_ViewWindow::SELECTED: - sx = x; sy = y; - - double X,Y; - activeView()->Size(X,Y); - rx = Standard_Real(activeView()->Convert(X)); - ry = Standard_Real(activeView()->Convert(Y)); - - activeView()->Rotate( 0., 0., 0., - theSelectedPoint.X(),theSelectedPoint.Y(), theSelectedPoint.Z(), - Standard_True ); - - Quantity_Ratio zRotationThreshold; - zRotation = Standard_False; - zRotationThreshold = 0.45; - if( zRotationThreshold > 0. ) { - Standard_Real dx = Abs(sx - rx/2.); - Standard_Real dy = Abs(sy - ry/2.); - Standard_Real dd = zRotationThreshold * (rx + ry)/2.; - if( dx > dd || dy > dd ) zRotation = Standard_True; - } - break; - default: - break; - } - } -} - -/*! - Rotates the viewport. [ protected ] -*/ -void OCCViewer_ViewPort3d::rotate( int x, int y, - int theRotationPointType, - const gp_Pnt& theSelectedPoint ) -{ - if ( !activeView().IsNull() ) { - switch ( theRotationPointType ) { - case OCCViewer_ViewWindow::GRAVITY: - activeView()->Rotation( x, y ); - break; - case OCCViewer_ViewWindow::SELECTED: - double dx, dy, dz; - if( zRotation ) { - dz = atan2(Standard_Real(x)-rx/2., ry/2.-Standard_Real(y)) - - atan2(sx-rx/2.,ry/2.-sy); - dx = dy = 0.; - } - else { - dx = (Standard_Real(x) - sx) * Standard_PI/rx; - dy = (sy - Standard_Real(y)) * Standard_PI/ry; - dz = 0.; - } - - activeView()->Rotate( dx, dy, dz, - theSelectedPoint.X(),theSelectedPoint.Y(), theSelectedPoint.Z(), - Standard_False ); - break; - default: - break; - } - } - // setZSize( getZSize() ); -} - -/*! - Resets the viewport after 'rotation'. [ protected ] -*/ -void OCCViewer_ViewPort3d::endRotation() -{ - if ( !activeView().IsNull() ) - { - if (myAnimate) activeView()->SetAnimationModeOff(); - if ( !myDegenerated ) - activeView()->SetDegenerateModeOff(); - activeView()->ZFitAll(1.); - activeView()->SetZSize(0.); - activeView()->Update(); - } -} - -/*! - Repaints the viewport. [ virtual protected ] -*/ -void OCCViewer_ViewPort3d::paintEvent( QPaintEvent* e ) -{ -#ifndef WNT - /* X11 : map before show doesn't work */ - if ( !mapped( activeView() ) ) - mapView( activeView() ); -#endif - if ( !myWindow.IsNull() ) - { - QApplication::syncX(); - QRect rc = e->rect(); - if ( !myPaintersRedrawing ) - activeView()->Redraw( rc.x(), rc.y(), rc.width(), rc.height() ); - } - OCCViewer_ViewPort::paintEvent( e ); -} - -/*! - Resizes the viewport. [ virtual protected ] -*/ -void OCCViewer_ViewPort3d::resizeEvent( QResizeEvent* e ) -{ -#ifdef WNT - /* Win32 : map before first show to avoid flicker */ - if ( !mapped( activeView() ) ) - mapView( activeView() ); -#endif - QApplication::syncX(); - if ( !activeView().IsNull() ) - activeView()->MustBeResized(); -} - -/*! - Fits all objects in view. [ virtual protected ] -*/ -void OCCViewer_ViewPort3d::fitAll( bool keepScale, bool withZ, bool upd ) -{ - if ( activeView().IsNull() ) - return; - - - if ( keepScale ) - myScale = activeView()->Scale(); - - Standard_Real margin = 0.01; - activeView()->FitAll( margin, withZ, upd ); - activeView()->SetZSize(0.); -} - -/*! - Resets the view. [ virtual protected ] -*/ -void OCCViewer_ViewPort3d::reset() -{ -// double zsize = getZSize(); - if ( !activeView().IsNull() ) - activeView()->Reset(); -// setZSize( zsize ); -} - -/*! - Passed the handle of native window of the component to CASCADE view. [ private ] -*/ -bool OCCViewer_ViewPort3d::setWindow( const Handle(V3d_View)& view ) -{ - if ( !myWindow.IsNull() ) - return true; - - if ( view.IsNull() ) - return false; - - int hwnd = (int)winId(); - if ( !hwnd ) - return false; - - /* set this widget as the drawing window */ - short lo = (short)hwnd; - short hi = (short)( hwnd >> 16 ); - OCCViewer_VService::SetWindow( view, (int)hi, (int)lo, Xw_WQ_SAMEQUALITY ); - myWindow = view->Window(); - return !myWindow.IsNull(); -} - -/*! - Returns the current active view. [ private ] -*/ -Handle(V3d_View) OCCViewer_ViewPort3d::activeView() const -{ - return myActiveView; -} - -/*! - Returns the current inactive view [ private ] -*/ -/*Handle(V3d_View) OCCViewer_ViewPort3d::inactiveView() const -{ - return ( activeView() == myOrthoView ? myPerspView : myOrthoView ); -}*/ - -/*! - Returns 'true' if the given view is mapped to window. [ private ] -*/ -bool OCCViewer_ViewPort3d::mapped( const Handle(V3d_View)& view ) const -{ - return ( !view.IsNull() && view->View()->IsDefined() ); -} diff --git a/src/OCCViewer/OCCViewer_ViewPort3d.h b/src/OCCViewer/OCCViewer_ViewPort3d.h deleted file mode 100755 index 1eb9689f9..000000000 --- a/src/OCCViewer/OCCViewer_ViewPort3d.h +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 OCCVIEWER_VIEWPORT3D_H -#define OCCVIEWER_VIEWPORT3D_H - -#include "OCCViewer_ViewPort.h" - -#include - -class QColor; -class QRect; - -class Handle(V3d_Viewer); - -#ifdef WIN32 -#pragma warning ( disable:4251 ) -#endif - -class OCCVIEWER_EXPORT OCCViewer_ViewPort3d: public OCCViewer_ViewPort -{ - Q_OBJECT - - friend class OCCViewer_ViewTransformer; - -public: - OCCViewer_ViewPort3d( QWidget*, const Handle(V3d_Viewer)&, V3d_TypeOfView = V3d_ORTHOGRAPHIC ); - virtual ~OCCViewer_ViewPort3d(); - -public: - Handle(V3d_View) getView() const; - Handle(V3d_View) setView( const Handle(V3d_View)& ); - Handle(V3d_Viewer) getViewer() const; - - void setAnimationMode(bool theDegenerated); - - virtual void setBackgroundColor( const QColor& color); - virtual QColor backgroundColor() const; - -// void setActive( V3d_TypeOfView ); - virtual bool syncronize( const OCCViewer_ViewPort3d* ); - - double getZSize() const; - void setZSize( double ); - - virtual void onUpdate(); - - // TRANSFORMATIONS - virtual void reset(); - virtual void pan( int , int ); - virtual void setCenter( int , int ); - virtual void fitRect( const QRect& ); - virtual void zoom( int, int, int, int ); - virtual void fitAll( bool keepScale = false, bool withZ = true, bool upd = true ); - - void startRotation( int, int, int, const gp_Pnt& ); - void rotate( int, int, int, const gp_Pnt& ); - void endRotation(); - -protected: - // EVENTS - virtual void paintEvent( QPaintEvent* ); - virtual void resizeEvent( QResizeEvent* ); - -private: - Handle(V3d_View) activeView() const; - Handle(V3d_View) inactiveView() const; - bool mapView( const Handle(V3d_View)& ); - bool setWindow( const Handle(V3d_View)& ); - bool mapped( const Handle(V3d_View)& ) const; - -private: - Handle(V3d_View) myOrthoView; - Handle(V3d_View) myPerspView; - Handle(V3d_View) myActiveView; - bool myDegenerated; - bool myAnimate; - double myScale; -}; - -#ifdef WIN32 -#pragma warning ( default:4251 ) -#endif - -#endif diff --git a/src/OCCViewer/OCCViewer_ViewSketcher.cxx b/src/OCCViewer/OCCViewer_ViewSketcher.cxx deleted file mode 100755 index 335603d48..000000000 --- a/src/OCCViewer/OCCViewer_ViewSketcher.cxx +++ /dev/null @@ -1,540 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 "OCCViewer_ViewSketcher.h" -#include "OCCViewer_ViewWindow.h" -#include "OCCViewer_ViewPort3d.h" - -#include -#include -#include -#include -#include - -/**************************************************************** -** Class: OCCViewer_ViewSketcher -** Level: Public -*****************************************************************/ - -OCCViewer_ViewSketcher::OCCViewer_ViewSketcher( OCCViewer_ViewWindow* vw, int type ) -: QObject( vw ), -mySketchButton( Qt::LeftButton ), -mypViewWindow( vw ), -myType( type ), -mypData( 0 ), -myResult( Neutral ), -myButtonState( 0 ) -{ -} - -OCCViewer_ViewSketcher::~OCCViewer_ViewSketcher() -{ -} - -void OCCViewer_ViewSketcher::activate() -{ - OCCViewer_ViewPort3d* avp = mypViewWindow->getViewPort(); - - mySavedCursor = avp->cursor(); - avp->setCursor( Qt::PointingHandCursor ); - avp->installEventFilter( this ); - qApp->installEventFilter( this ); - - connect( avp, SIGNAL( vpDrawExternal( QPainter* ) ), this, SLOT( onDrawViewPort() ) ); - - myStart = QPoint(); - myResult = Neutral; - - onActivate(); -} - -void OCCViewer_ViewSketcher::deactivate() -{ - OCCViewer_ViewPort3d* avp = mypViewWindow->getViewPort(); - - disconnect( avp, SIGNAL( vpDrawExternal( QPainter* ) ), this, SLOT( onDrawViewPort() ) ); - - qApp->removeEventFilter( this ); - avp->removeEventFilter( this ); - avp->setCursor( mySavedCursor ); - - onDeactivate(); -} - -int OCCViewer_ViewSketcher::type() const -{ - return myType; -} - -void* OCCViewer_ViewSketcher::data() const -{ - return mypData; -} - -int OCCViewer_ViewSketcher::result() const -{ - return myResult; -} - -int OCCViewer_ViewSketcher::buttonState() const -{ - return myButtonState; -} - -void OCCViewer_ViewSketcher::onActivate() -{ -} - -void OCCViewer_ViewSketcher::onDeactivate() -{ -} - -bool OCCViewer_ViewSketcher::isDefault() const -{ - return true; -} - -bool OCCViewer_ViewSketcher::eventFilter( QObject* o, QEvent* e ) -{ - OCCViewer_ViewPort3d* avp = mypViewWindow->getViewPort(); - - SketchState state = EnTrain; - bool ignore = false; - if ( o == avp ) - { - switch ( e->type() ) - { - case QEvent::MouseMove: - case QEvent::MouseButtonPress: - case QEvent::MouseButtonRelease: - case QEvent::MouseButtonDblClick: - { - QMouseEvent* me = (QMouseEvent*)e; - - myButtonState = me->buttons(); - if ( e->type() == QEvent::MouseButtonPress ) - myButtonState |= me->button(); - - if ( myStart.isNull() && ( myButtonState & sketchButton() ) ) - { - state = Debut; - myStart = me->pos(); - } - - myCurr = me->pos(); - - onMouse( me ); - - if ( myResult != Neutral ) - state = Fin; - - ignore = true; - break; - } - case QEvent::Hide: - case QEvent::HideToParent: - myResult = Reject; - onSketch( Fin ); - break; - default: - break; - } - } - if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) - { - ignore = onKey( (QKeyEvent*)e ); - if ( myResult != Neutral ) - state = Fin; - } - - if ( ignore ) - { - onSketch( state ); - return true; - } - return QObject::eventFilter( o, e ); -} - -void OCCViewer_ViewSketcher::onDrawViewPort() -{ - onSketch( Debut ); -} - -bool OCCViewer_ViewSketcher::onKey( QKeyEvent* ) -{ - return false; -} - -void OCCViewer_ViewSketcher::onMouse( QMouseEvent* ) -{ -} - -int OCCViewer_ViewSketcher::sketchButton() -{ - return mySketchButton; -} - -void OCCViewer_ViewSketcher::setSketchButton( int b ) -{ - mySketchButton = b; -} - -/**************************************************************** -** Class: OCCViewer_RectSketcher -** Level: Public -*****************************************************************/ - -OCCViewer_RectSketcher::OCCViewer_RectSketcher( OCCViewer_ViewWindow* vw, int typ ) -: OCCViewer_ViewSketcher( vw, typ ) -{ -} - -OCCViewer_RectSketcher::~OCCViewer_RectSketcher() -{ - delete (QRect*)mypData; -} - -void OCCViewer_RectSketcher::onActivate() -{ - mypData = new QRect(); -} - -void OCCViewer_RectSketcher::onDeactivate() -{ - delete (QRect*)mypData; - mypData = 0; -} - -bool OCCViewer_RectSketcher::onKey( QKeyEvent* e ) -{ - if ( e->key() == Qt::Key_Escape ) - myResult = Reject; - else if ( e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return ) - myResult = Accept; - - return true; -} - -void OCCViewer_RectSketcher::onMouse( QMouseEvent* e ) -{ - OCCViewer_ViewPort3d* avp = mypViewWindow->getViewPort(); - - if ( avp->rect().contains( myCurr ) ) - avp->setCursor( Qt::PointingHandCursor ); - else - avp->setCursor( Qt::ForbiddenCursor ); - - if ( e->type() == QEvent::MouseButtonRelease && e->button() == sketchButton() ) - { - myResult = Accept; - QApplication::postEvent( avp, new QMouseEvent( e->type(), e->pos(), - e->globalPos(), e->button(), - e->buttons(), e->modifiers() ) ); - } -} - -void OCCViewer_RectSketcher::onSketch( SketchState state ) -{ - OCCViewer_ViewPort3d* avp = mypViewWindow->getViewPort(); - - QRect* sketchRect = (QRect*)data(); - if ( myButtonState & sketchButton() ) - { - QRect rect( qMin( myStart.x(), myCurr.x() ), qMin( myStart.y(), myCurr.y() ), - qAbs( myStart.x() - myCurr.x() ), qAbs( myStart.y() - myCurr.y() ) ); - QPainter p( avp ); - p.setPen( Qt::white ); - p.setCompositionMode( QPainter::CompositionMode_Xor ); - if ( state != Debut && !sketchRect->isEmpty() ) - p.drawRect( *sketchRect ); - *sketchRect = rect; - if ( !rect.isEmpty() && state != Fin ) - p.drawRect( *sketchRect ); - } - - if ( state == Fin ) - { - QApplication::syncX(); /* force rectangle redrawing */ - mypViewWindow->activateSketching( OCCViewer_ViewWindow::NoSketching ); - } -} - -/**************************************************************** -** Class: OCCViewer_PolygonSketcher -** Level: Public -*****************************************************************/ - -OCCViewer_PolygonSketcher::OCCViewer_PolygonSketcher( OCCViewer_ViewWindow* vw, int typ ) -: OCCViewer_ViewSketcher( vw, typ ), - myDbl ( false ), - myToler ( 5, 5 ), - mypPoints ( 0L ), - myAddButton ( 0 ), - myDelButton ( 0 ) -{ - mySketchButton = Qt::RightButton; -} - -OCCViewer_PolygonSketcher::~OCCViewer_PolygonSketcher() -{ - delete mypPoints; - delete (QPolygon*)mypData; -} - -void OCCViewer_PolygonSketcher::onActivate() -{ - myDbl = false; - mypData = new QPolygon( 0 ); - mypPoints = new QPolygon( 0 ); - - switch ( sketchButton() ) - { - case Qt::LeftButton: - myAddButton = Qt::RightButton; - myDelButton = Qt::MidButton; - break; - case Qt::MidButton: - myAddButton = Qt::LeftButton; - myDelButton = Qt::RightButton; - break; - case Qt::RightButton: - default: - myAddButton = Qt::LeftButton; - myDelButton = Qt::MidButton; - break; - }; -} - -void OCCViewer_PolygonSketcher::onDeactivate() -{ - delete mypPoints; - mypPoints = 0; - delete (QPolygon*)mypData; - mypData = 0; -} - -bool OCCViewer_PolygonSketcher::onKey( QKeyEvent* e ) -{ - if ( e->key() == Qt::Key_Escape ) - { - myResult = Reject; - return true; - } - else if ( e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return ) - { - QPolygon* points = (QPolygon*)data(); - if ( points->count() ) - { - QPoint last = points->point( points->count() - 1 ); - if ( last != myCurr ) - { - points->resize( points->count() + 1 ); - points->setPoint( points->count() - 1, myCurr ); - } - } - myResult = Accept; - return true; - } - else if ( e->key() == Qt::Key_Backspace && e->type() == QEvent::KeyRelease ) - { - QPolygon* points = (QPolygon*)data(); - if ( points->count() > 1 ) - points->resize( points->count() - 1 ); - onMouse( 0 ); - return true; - } - - return true; -} - -void OCCViewer_PolygonSketcher::onMouse( QMouseEvent* e ) -{ - OCCViewer_ViewPort3d* avp = mypViewWindow->getViewPort(); - - QPolygon* points = (QPolygon*)data(); - if ( !points->count() && !myStart.isNull() ) - { - points->resize( points->count() + 1 ); - points->setPoint( points->count() - 1, myStart ); - } - - bool closed = false; - bool valid = avp->rect().contains( myCurr ); - if ( !myStart.isNull() ) - { - QRect aRect( myStart.x() - myToler.width(), myStart.y() - myToler.height(), - 2 * myToler.width(), 2 * myToler.height() ); - closed = aRect.contains( myCurr ); - } - valid = valid && isValid( points, myCurr ); - if ( closed && !valid ) - closed = false; - - if ( closed ) - avp->setCursor( Qt::CrossCursor ); - else if ( valid ) - avp->setCursor( Qt::PointingHandCursor ); - else - avp->setCursor( Qt::ForbiddenCursor ); - - if ( !e ) - return; - - if ( e->type() == QEvent::MouseButtonRelease && ( e->button() & sketchButton() ) ) - { - myResult = Reject; - QApplication::postEvent( avp, new QMouseEvent( e->type(), e->pos(), - e->globalPos(), e->button(), - e->buttons(), e->modifiers() ) ); - } - else if ( e->type() == QEvent::MouseButtonRelease && ( e->button() & myAddButton ) ) - { - if ( closed ) - myResult = Accept; - else - { - if ( myStart.isNull() ) - myStart = myCurr; - else - { - QPoint last = points->point( points->count() - 1 ); - if ( last != myCurr && valid ) - { - points->resize( points->count() + 1 ); - points->setPoint( points->count() - 1, myCurr ); - } - if ( valid && myDbl ) - myResult = Accept; - } - } - } - else if ( ( e->type() == QEvent::MouseButtonRelease && ( e->button() & myDelButton ) ) || - ( e->type() == QEvent::MouseButtonDblClick && ( e->button() & myDelButton ) ) ) - { - if ( points->count() > 1 ) - points->resize( points->count() - 1 ); - onMouse( 0 ); - } - myDbl = e->type() == QEvent::MouseButtonDblClick && ( e->button() & myAddButton ); -} - -void OCCViewer_PolygonSketcher::onSketch( SketchState state ) -{ - OCCViewer_ViewPort3d* avp = mypViewWindow->getViewPort(); - - QPolygon* points = (QPolygon*)data(); - QPainter p( avp ); - p.setPen( Qt::white ); - p.setCompositionMode( QPainter::CompositionMode_Xor ); - if ( state != Debut ) - p.drawPolyline( *mypPoints ); - - if ( points->count() ) - { - mypPoints->resize( points->count() + 1 ); - for ( uint i = 0; i < points->count(); i++ ) - mypPoints->setPoint( i, points->point( i ) ); - mypPoints->setPoint( points->count(), myCurr ); - if ( state != Fin ) - p.drawPolyline( *mypPoints ); - } - - if ( state == Fin ) - { - QApplication::syncX(); - mypViewWindow->activateSketching( OCCViewer_ViewWindow::NoSketching ); - } -} - -bool OCCViewer_PolygonSketcher::isValid( const QPolygon* aPoints, const QPoint& aCur ) const -{ - if ( !aPoints->count() ) - return true; - - if ( aPoints->count() == 1 && aPoints->point( 0 ) == aCur ) - return false; - - const QPoint& aLast = aPoints->point( aPoints->count() - 1 ); - - if ( aLast == aCur ) - return true; - - bool res = true; - for ( uint i = 0; i < aPoints->count() - 1 && res; i++ ) - { - const QPoint& aStart = aPoints->point( i ); - const QPoint& anEnd = aPoints->point( i + 1 ); - res = !isIntersect( aStart, anEnd, aCur, aLast ); - } - - return res; -} - -bool OCCViewer_PolygonSketcher::isIntersect( const QPoint& aStart1, const QPoint& anEnd1, - const QPoint& aStart2, const QPoint& anEnd2 ) const -{ - if ( ( aStart1 == aStart2 && anEnd1 == anEnd2 ) || - ( aStart1 == anEnd2 && anEnd1 == aStart2 ) ) - return true; - - if ( aStart1 == aStart2 || aStart2 == anEnd1 || - aStart1 == anEnd2 || anEnd1 == anEnd2 ) - return false; - - double x11 = aStart1.x() * 1.0; - double x12 = anEnd1.x() * 1.0; - double y11 = aStart1.y() * 1.0; - double y12 = anEnd1.y() * 1.0; - - double x21 = aStart2.x() * 1.0; - double x22 = anEnd2.x() * 1.0; - double y21 = aStart2.y() * 1.0; - double y22 = anEnd2.y() * 1.0; - - double k1 = x12 == x11 ? 0 : ( y12 - y11 ) / ( x12 - x11 ); - double k2 = x22 == x21 ? 0 : ( y22 - y21 ) / ( x22 - x21 ); - - double b1 = y11 - k1 * x11; - double b2 = y21 - k2 * x21; - - if ( k1 == k2 ) - { - if ( b1 != b2 ) - return false; - else - return !( ( qMax( x11, x12 ) <= qMin( x21, x22 ) || - qMin( x11, x12 ) >= qMax( x21, x22 ) ) && - ( qMax( y11, y12 ) <= qMin( y21, y22 ) || - qMin( y11, y12 ) >= qMax( y21, y22 ) ) ); - } - else - { - double x0 = ( b2 - b1 ) / ( k1 - k2 ); - double y0 = ( k1 * b2 - k2 * b1 ) / ( k1 - k2 ); - - if ( qMin( x11, x12 ) < x0 && x0 < qMax( x11, x12 ) && - qMin( y11, y12 ) < y0 && y0 < qMax( y11, y12 ) && - qMin( x21, x22 ) < x0 && x0 < qMax( x21, x22 ) && - qMin( y21, y22 ) < y0 && y0 < qMax( y21, y22 ) ) - return true; - } - return false; -} - - diff --git a/src/OCCViewer/OCCViewer_ViewSketcher.h b/src/OCCViewer/OCCViewer_ViewSketcher.h deleted file mode 100755 index 55430bed3..000000000 --- a/src/OCCViewer/OCCViewer_ViewSketcher.h +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 OCCVIEWER_VIEWSKETCHER_H -#define OCCVIEWER_VIEWSKETCHER_H - -#include "OCCViewer.h" - -#include -#include -#include - -class OCCViewer_ViewWindow; -class QKeyEvent; -class QMouseEvent; -class QPolygon; - -#ifdef WNT -#pragma warning ( disable:4251 ) -#endif - -/*! - \class OCCViewer_ViewSketcher -*/ - -class OCCVIEWER_EXPORT OCCViewer_ViewSketcher : public QObject -{ - Q_OBJECT - -public: - enum { Neutral, Accept, Reject }; - -public: - OCCViewer_ViewSketcher( OCCViewer_ViewWindow*, int ); - virtual ~OCCViewer_ViewSketcher(); - -public: - int type() const; - int result() const; - int buttonState() const; - void* data() const; - - void activate(); - void deactivate(); - - int sketchButton(); - void setSketchButton( int ); - - virtual bool isDefault() const; - virtual bool eventFilter( QObject*, QEvent* ); - -private slots: - void onDrawViewPort(); - -protected: - enum SketchState { Debut, EnTrain, Fin }; - virtual bool onKey( QKeyEvent* ); - virtual void onMouse( QMouseEvent* ); - virtual void onSketch( SketchState ) = 0; - virtual void onActivate(); - virtual void onDeactivate(); - -protected: - int mySketchButton; - OCCViewer_ViewWindow* mypViewWindow; - int myType; - void* mypData; - int myResult; - QCursor mySavedCursor; - QPoint myStart, myCurr; - int myButtonState; -}; - -/*! - \class OCCViewer_RectSketcher -*/ - -class OCCVIEWER_EXPORT OCCViewer_RectSketcher : public OCCViewer_ViewSketcher -{ -public: - OCCViewer_RectSketcher( OCCViewer_ViewWindow*, int ); - virtual ~OCCViewer_RectSketcher(); - -protected: - virtual bool onKey( QKeyEvent* ); - virtual void onMouse( QMouseEvent* ); - virtual void onSketch( SketchState ); - virtual void onActivate(); - virtual void onDeactivate(); -}; - -/*! - \class OCCViewer_PolygonSketcher -*/ - -class OCCVIEWER_EXPORT OCCViewer_PolygonSketcher : public OCCViewer_ViewSketcher -{ -public: - OCCViewer_PolygonSketcher( OCCViewer_ViewWindow*, int ); - virtual ~OCCViewer_PolygonSketcher(); - -protected: - virtual bool onKey( QKeyEvent* ); - virtual void onMouse( QMouseEvent* ); - virtual void onSketch( SketchState ); - virtual void onActivate(); - virtual void onDeactivate(); - -private: - bool isValid( const QPolygon*, const QPoint& ) const; - bool isIntersect( const QPoint&, const QPoint&, - const QPoint&, const QPoint& ) const; - -private: - bool myDbl; - QSize myToler; - QPolygon* mypPoints; - int myAddButton; - int myDelButton; -}; - -#ifdef WNT -#pragma warning( default:4251 ) -#endif - -#endif diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx deleted file mode 100755 index b42f2d796..000000000 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ /dev/null @@ -1,1707 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 : OCCViewer_ViewWindow.cxx -// Author : -// - -#include "OCCViewer_ViewWindow.h" -#include "OCCViewer_ViewModel.h" -#include "OCCViewer_ViewPort3d.h" -#include "OCCViewer_ViewManager.h" -#include "OCCViewer_ViewSketcher.h" -#include "OCCViewer_CreateRestoreViewDlg.h" -#include "OCCViewer_ClippingDlg.h" -#include "OCCViewer_SetRotationPointDlg.h" -#include "OCCViewer_AxialScaleDlg.h" - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include - -static QEvent* l_mbPressEvent = 0; - -#ifdef WIN32 -# include -#endif - -const char* imageZoomCursor[] = { -"32 32 3 1", -". c None", -"a c #000000", -"# c #ffffff", -"................................", -"................................", -".#######........................", -"..aaaaaaa.......................", -"................................", -".............#####..............", -"...........##.aaaa##............", -"..........#.aa.....a#...........", -".........#.a.........#..........", -".........#a..........#a.........", -"........#.a...........#.........", -"........#a............#a........", -"........#a............#a........", -"........#a............#a........", -"........#a............#a........", -".........#...........#.a........", -".........#a..........#a.........", -".........##.........#.a.........", -"........#####.....##.a..........", -".......###aaa#####.aa...........", -"......###aa...aaaaa.......#.....", -".....###aa................#a....", -"....###aa.................#a....", -"...###aa...............#######..", -"....#aa.................aa#aaaa.", -".....a....................#a....", -"..........................#a....", -"...........................a....", -"................................", -"................................", -"................................", -"................................"}; - -const char* imageRotateCursor[] = { -"32 32 3 1", -". c None", -"a c #000000", -"# c #ffffff", -"................................", -"................................", -"................................", -"................................", -"........#.......................", -".......#.a......................", -"......#######...................", -".......#aaaaa#####..............", -"........#..##.a#aa##........##..", -".........a#.aa..#..a#.....##.aa.", -".........#.a.....#...#..##.aa...", -".........#a.......#..###.aa.....", -"........#.a.......#a..#aa.......", -"........#a.........#..#a........", -"........#a.........#a.#a........", -"........#a.........#a.#a........", -"........#a.........#a.#a........", -".........#.........#a#.a........", -"........##a........#a#a.........", -"......##.a#.......#.#.a.........", -"....##.aa..##.....##.a..........", -"..##.aa.....a#####.aa...........", -"...aa.........aaa#a.............", -"................#.a.............", -"...............#.a..............", -"..............#.a...............", -"...............a................", -"................................", -"................................", -"................................", -"................................", -"................................"}; - -const char* imageCrossCursor[] = { - "32 32 3 1", - ". c None", - "a c #000000", - "# c #ffffff", - "................................", - "................................", - "................................", - "................................", - "................................", - "................................", - "................................", - "...............#................", - "...............#a...............", - "...............#a...............", - "...............#a...............", - "...............#a...............", - "...............#a...............", - "...............#a...............", - "...............#a...............", - ".......#################........", - "........aaaaaaa#aaaaaaaaa.......", - "...............#a...............", - "...............#a...............", - "...............#a...............", - "...............#a...............", - "...............#a...............", - "...............#a...............", - "...............#a...............", - "................a...............", - "................................", - "................................", - "................................", - "................................", - "................................", - "................................", - "................................"}; - - -/*! - \brief Constructor - \param theDesktop main window of application - \param theModel OCC 3D viewer -*/ -OCCViewer_ViewWindow::OCCViewer_ViewWindow( SUIT_Desktop* theDesktop, - OCCViewer_Viewer* theModel ) -: SUIT_ViewWindow( theDesktop ) -{ - myModel = theModel; - myRestoreFlag = 0; - myEnableDrawMode = false; - updateEnabledDrawMode(); - myClippingDlg = 0; - myScalingDlg = 0; - mySetRotationPointDlg = 0; - myRectBand = 0; - - mypSketcher = 0; - myCurSketch = -1; -} - -/*! - \brief Destructor. -*/ -OCCViewer_ViewWindow::~OCCViewer_ViewWindow() -{ - endDrawRect(); - qDeleteAll( mySketchers ); -} - -/*! - \brief Internal initialization. -*/ -void OCCViewer_ViewWindow::initLayout() -{ - myViewPort = new OCCViewer_ViewPort3d( this, myModel->getViewer3d(), V3d_ORTHOGRAPHIC ); - myViewPort->setBackgroundColor(Qt::black); - myViewPort->installEventFilter(this); - setCentralWidget(myViewPort); - myOperation = NOTHING; - - myCurrPointType = GRAVITY; - myPrevPointType = GRAVITY; - mySelectedPoint = gp_Pnt(0.,0.,0.); - myRotationPointSelection = false; - - setTransformRequested ( NOTHING ); - setTransformInProcess ( false ); - - createActions(); - createToolBar(); -} - -/*! - \brief Detect viewer operation according the the mouse button pressed - and key modifiers used. - \param theEvent mouse event - \return type of the operation -*/ -OCCViewer_ViewWindow::OperationType -OCCViewer_ViewWindow::getButtonState( QMouseEvent* theEvent ) -{ - OperationType aOp = NOTHING; - if( (theEvent->modifiers() == SUIT_ViewModel::myStateMap[SUIT_ViewModel::ZOOM]) && - (theEvent->button() == SUIT_ViewModel::myButtonMap[SUIT_ViewModel::ZOOM]) ) - aOp = ZOOMVIEW; - else if( (theEvent->modifiers() == SUIT_ViewModel::myStateMap[SUIT_ViewModel::PAN]) && - (theEvent->button() == SUIT_ViewModel::myButtonMap[SUIT_ViewModel::PAN]) ) - aOp = PANVIEW; - else if( (theEvent->modifiers() == SUIT_ViewModel::myStateMap[SUIT_ViewModel::ROTATE]) && - (theEvent->button() == SUIT_ViewModel::myButtonMap[SUIT_ViewModel::ROTATE]) ) - aOp = ROTATE; - - return aOp; -} - -/*! - \brief Customize event handling - \param watched event receiver object - \param e event - \return \c true if the event processing should be stopped -*/ -bool OCCViewer_ViewWindow::eventFilter( QObject* watched, QEvent* e ) -{ - if ( watched == myViewPort ) { - int aType = e->type(); - switch(aType) { - case QEvent::MouseButtonPress: - vpMousePressEvent((QMouseEvent*) e); - return true; - - case QEvent::MouseButtonRelease: - vpMouseReleaseEvent((QMouseEvent*) e); - return true; - - case QEvent::MouseMove: - vpMouseMoveEvent((QMouseEvent*) e); - return true; - - case QEvent::MouseButtonDblClick: - emit mouseDoubleClicked(this, (QMouseEvent*)e); - return true; - - case QEvent::Wheel: - { - QWheelEvent* aEvent = (QWheelEvent*) e; - double aDelta = aEvent->delta(); - double aScale = (aDelta < 0) ? 100./(-aDelta) : aDelta/100.; - myViewPort->getView()->SetZoom(aScale); - } - return true; - - case QEvent::ContextMenu: - { - QContextMenuEvent * aEvent = (QContextMenuEvent*)e; - if ( aEvent->reason() != QContextMenuEvent::Mouse ) - emit contextMenuRequested( aEvent ); - } - return true; - - default: - break; - } - } - return SUIT_ViewWindow::eventFilter(watched, e); -} - -/*! - \brief Update state of enable draw mode state. -*/ -void OCCViewer_ViewWindow::updateEnabledDrawMode() -{ - if ( myModel ) - myEnableDrawMode = myModel->isSelectionEnabled() && myModel->isMultiSelectionEnabled(); -} - -/*! - \brief Handle mouse press event - \param theEvent mouse event -*/ -void OCCViewer_ViewWindow::vpMousePressEvent( QMouseEvent* theEvent ) -{ - myStartX = theEvent->x(); - myStartY = theEvent->y(); - switch ( myOperation ) { - case WINDOWFIT: - if ( theEvent->button() == Qt::LeftButton ) - emit vpTransformationStarted ( WINDOWFIT ); - break; - - case PANGLOBAL: - if ( theEvent->button() == Qt::LeftButton ) - emit vpTransformationStarted ( PANGLOBAL ); - break; - - case ZOOMVIEW: - if ( theEvent->button() == Qt::LeftButton ) - emit vpTransformationStarted ( ZOOMVIEW ); - break; - - case PANVIEW: - if ( theEvent->button() == Qt::LeftButton ) - emit vpTransformationStarted ( PANVIEW ); - break; - - case ROTATE: - if ( theEvent->button() == Qt::LeftButton ) { - myViewPort->startRotation(myStartX, myStartY, myCurrPointType, mySelectedPoint); - emit vpTransformationStarted ( ROTATE ); - } - break; - - default: - /* Try to activate a transformation */ - switch ( getButtonState(theEvent) ) { - case ZOOMVIEW: - activateZoom(); - break; - case PANVIEW: - activatePanning(); - break; - case ROTATE: - activateRotation(); - myViewPort->startRotation(myStartX, myStartY, myCurrPointType, mySelectedPoint); - break; - default: - if ( myRotationPointSelection ) - { - if ( theEvent->button() == Qt::LeftButton ) - { - Handle(AIS_InteractiveContext) ic = myModel->getAISContext(); - ic->Select(); - for ( ic->InitSelected(); ic->MoreSelected(); ic->NextSelected() ) - { - TopoDS_Shape aShape = ic->SelectedShape(); - if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) - { - gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( ic->SelectedShape() ) ); - if ( mySetRotationPointDlg ) - { - myRotationPointSelection = false; - mySetRotationPointDlg->setCoords(aPnt.X(), aPnt.Y(), aPnt.Z()); - } - } - else - { - myCurrPointType = myPrevPointType; - break; - } - } - if ( ic->NbSelected() == 0 ) myCurrPointType = myPrevPointType; - if ( mySetRotationPointDlg ) mySetRotationPointDlg->toggleChange(); - ic->CloseAllContexts(); - myOperation = NOTHING; - myViewPort->setCursor( myCursor ); - myCursorIsHand = false; - myRotationPointSelection = false; - } - } - else - emit mousePressed(this, theEvent); - break; - } - /* notify that we start a transformation */ - if ( transformRequested() ) - emit vpTransformationStarted ( myOperation ); - } - if ( transformRequested() ) - setTransformInProcess( true ); - - /* we may need it for sketching... */ - if ( l_mbPressEvent ) - delete l_mbPressEvent; - l_mbPressEvent = new QMouseEvent( *theEvent ); -} - - -/*! - \brief Start zooming operation. - - Sets the corresponding cursor for the widget. -*/ -void OCCViewer_ViewWindow::activateZoom() -{ - if ( !transformRequested() && !myCursorIsHand ) - myCursor = cursor(); /* save old cursor */ - - if ( myOperation != ZOOMVIEW ) { - QPixmap zoomPixmap (imageZoomCursor); - QCursor zoomCursor (zoomPixmap); - setTransformRequested ( ZOOMVIEW ); - myViewPort->setCursor( zoomCursor ); - } -} - - -/*! - \brief Start panning operation. - - Sets the corresponding cursor for the widget. -*/ -void OCCViewer_ViewWindow::activatePanning() -{ - if ( !transformRequested() && !myCursorIsHand ) - myCursor = cursor(); // save old cursor - - if ( myOperation != PANVIEW ) { - QCursor panCursor (Qt::SizeAllCursor); - setTransformRequested ( PANVIEW ); - myViewPort->setCursor( panCursor ); - } -} - -/*! - \brief Start rotation operation - - Sets the corresponding cursor for the widget. -*/ -void OCCViewer_ViewWindow::activateRotation() -{ - if ( !transformRequested() && !myCursorIsHand ) - myCursor = cursor(); // save old cursor - - if ( myOperation != ROTATE ) { - QPixmap rotatePixmap (imageRotateCursor); - QCursor rotCursor (rotatePixmap); - setTransformRequested ( ROTATE ); - myViewPort->setCursor( rotCursor ); - } -} - -/*! - \brief Compute the gravity center. - \param theX used to return X coordinate of the gravity center - \param theY used to return Y coordinate of the gravity center - \param theZ used to return Z coordinate of the gravity center - \return \c true if the gravity center is computed -*/ -bool OCCViewer_ViewWindow::computeGravityCenter( double& theX, double& theY, double& theZ ) -{ - Handle(Visual3d_View) aView = myViewPort->getView()->View(); - - Standard_Real Xmin,Ymin,Zmin,Xmax,Ymax,Zmax,U,V,W ; - Standard_Real Umin,Vmin,Umax,Vmax ; - Standard_Integer Nstruct,Npoint ; - Graphic3d_MapOfStructure MySetOfStructures; - - aView->DisplayedStructures (MySetOfStructures); - Nstruct = MySetOfStructures.Extent() ; - - Graphic3d_MapIteratorOfMapOfStructure MyIterator(MySetOfStructures) ; - aView->ViewMapping().WindowLimit(Umin,Vmin,Umax,Vmax) ; - Npoint = 0 ; theX = theY = theZ = 0. ; - for( ; MyIterator.More(); MyIterator.Next()) { - if (!(MyIterator.Key())->IsEmpty()) { - (MyIterator.Key())->MinMaxValues(Xmin,Ymin,Zmin, - Xmax,Ymax,Zmax) ; - - Standard_Real LIM = ShortRealLast() -1.; - if (! (fabs(Xmin) > LIM || fabs(Ymin) > LIM || fabs(Zmin) > LIM - || fabs(Xmax) > LIM || fabs(Ymax) > LIM || fabs(Zmax) > LIM )) { - - aView->Projects(Xmin,Ymin,Zmin,U,V,W) ; - if( U >= Umin && U <= Umax && V >= Vmin && V <= Vmax ) { - Npoint++ ; theX += Xmin ; theY += Ymin ; theZ += Zmin ; - } - aView->Projects(Xmax,Ymin,Zmin,U,V,W) ; - if( U >= Umin && U <= Umax && V >= Vmin && V <= Vmax ) { - Npoint++ ; theX += Xmax ; theY += Ymin ; theZ += Zmin ; - } - aView->Projects(Xmin,Ymax,Zmin,U,V,W) ; - if( U >= Umin && U <= Umax && V >= Vmin && V <= Vmax ) { - Npoint++ ; theX += Xmin ; theY += Ymax ; theZ += Zmin ; - } - aView->Projects(Xmax,Ymax,Zmin,U,V,W) ; - if( U >= Umin && U <= Umax && V >= Vmin && V <= Vmax ) { - Npoint++ ; theX += Xmax ; theY += Ymax ; theZ += Zmin ; - } - aView->Projects(Xmin,Ymin,Zmax,U,V,W) ; - if( U >= Umin && U <= Umax && V >= Vmin && V <= Vmax ) { - Npoint++ ; theX += Xmin ; theY += Ymin ; theZ += Zmax ; - } - aView->Projects(Xmax,Ymin,Zmax,U,V,W) ; - if( U >= Umin && U <= Umax && V >= Vmin && V <= Vmax ) { - Npoint++ ; theX += Xmax ; theY += Ymin ; theZ += Zmax ; - } - aView->Projects(Xmin,Ymax,Zmax,U,V,W) ; - if( U >= Umin && U <= Umax && V >= Vmin && V <= Vmax ) { - Npoint++ ; theX += Xmin ; theY += Ymax ; theZ += Zmax ; - } - aView->Projects(Xmax,Ymax,Zmax,U,V,W) ; - if( U >= Umin && U <= Umax && V >= Vmin && V <= Vmax ) { - Npoint++ ; theX += Xmax ; theY += Ymax ; theZ += Zmax ; - } - } - } - } - if( Npoint > 0 ) { - theX /= Npoint ; theY /= Npoint ; theZ /= Npoint ; - } - return true; -} - -/*! - \brief Set the gravity center as a rotation point. -*/ -void OCCViewer_ViewWindow::activateSetRotationGravity() -{ - if ( myRotationPointSelection ) - { - Handle(AIS_InteractiveContext) ic = myModel->getAISContext(); - ic->CloseAllContexts(); - myOperation = NOTHING; - myViewPort->setCursor( myCursor ); - myCursorIsHand = false; - myRotationPointSelection = false; - } - - myPrevPointType = myCurrPointType; - myCurrPointType = GRAVITY; - - Standard_Real Xcenter, Ycenter, Zcenter; - if ( computeGravityCenter( Xcenter, Ycenter, Zcenter ) ) - mySetRotationPointDlg->setCoords( Xcenter, Ycenter, Zcenter ); -} - -/*! - \brief Update gravity center in the "Set Rotation Point" dialog box. - \sa OCCViewer_SetRotationPointDlg class -*/ -void OCCViewer_ViewWindow::updateGravityCoords() -{ - if ( mySetRotationPointDlg && mySetRotationPointDlg->isVisible() && myCurrPointType == GRAVITY ) - { - Standard_Real Xcenter, Ycenter, Zcenter; - if ( computeGravityCenter( Xcenter, Ycenter, Zcenter ) ) - mySetRotationPointDlg->setCoords( Xcenter, Ycenter, Zcenter ); - } -} - -/*! - \brief Set the point selected by the user as a rotation point. - \param theX X coordinate of the rotation point - \param theY Y coordinate of the rotation point - \param theZ Z coordinate of the rotation point -*/ -void OCCViewer_ViewWindow::activateSetRotationSelected( double theX, double theY, double theZ ) -{ - if ( myRotationPointSelection ) - { - Handle(AIS_InteractiveContext) ic = myModel->getAISContext(); - ic->CloseAllContexts(); - myOperation = NOTHING; - myViewPort->setCursor( myCursor ); - myCursorIsHand = false; - myRotationPointSelection = false; - } - - myPrevPointType = myCurrPointType; - myCurrPointType = SELECTED; - mySelectedPoint.SetCoord(theX,theY,theZ); -} - -/*! - \brief Start the point selection process. -*/ -void OCCViewer_ViewWindow::activateStartPointSelection() -{ - myPrevPointType = myCurrPointType; - myCurrPointType = SELECTED; - - // activate selection ------> - Handle(AIS_InteractiveContext) ic = myModel->getAISContext(); - - ic->OpenLocalContext(); - - AIS_ListOfInteractive aList; - ic->DisplayedObjects( aList ); - for ( AIS_ListIteratorOfListOfInteractive it( aList ); it.More(); it.Next() ) - { - Handle(AIS_InteractiveObject) anObj = it.Value(); - if ( !anObj.IsNull() && anObj->HasPresentation() && - anObj->IsKind( STANDARD_TYPE(AIS_Shape) ) ) - { - ic->Load(anObj,-1); - ic->Activate(anObj,AIS_Shape::SelectionMode(TopAbs_VERTEX)); - } - } - // activate selection <------ - - if ( !myCursorIsHand ) - { - QCursor handCursor (Qt::PointingHandCursor); - myCursorIsHand = true; - myCursor = cursor(); - myViewPort->setCursor( handCursor ); - } - myRotationPointSelection = true; -} - -/*! - \brief Start global panning operation - - Sets the corresponding cursor for the widget. -*/ -void OCCViewer_ViewWindow::activateGlobalPanning() -{ - Handle(V3d_View) aView3d = myViewPort->getView(); - if ( !aView3d.IsNull() ) { - QPixmap globalPanPixmap (imageCrossCursor); - QCursor glPanCursor (globalPanPixmap); - myCurScale = aView3d->Scale(); - aView3d->FitAll(0.01, false); - myCursor = cursor(); // save old cursor - myViewPort->fitAll(); // fits view before selecting a new scene center - setTransformRequested( PANGLOBAL ); - myViewPort->setCursor( glPanCursor ); - } -} - -/*! - \brief Starts fit operation. - - Sets the corresponding cursor for the widget. -*/ -void OCCViewer_ViewWindow::activateWindowFit() -{ - if ( !transformRequested() && !myCursorIsHand ) - myCursor = cursor(); /* save old cursor */ - - if ( myOperation != WINDOWFIT ) { - QCursor handCursor (Qt::PointingHandCursor); - setTransformRequested ( WINDOWFIT ); - myViewPort->setCursor ( handCursor ); - myCursorIsHand = true; - } -} - -/*! - \brief Start delayed viewer operation. -*/ -void OCCViewer_ViewWindow::setTransformRequested( OperationType op ) -{ - myOperation = op; - myViewPort->setMouseTracking( myOperation == NOTHING ); -} - - -/*! - \brief Handle mouse move event. - \param theEvent mouse event -*/ -void OCCViewer_ViewWindow::vpMouseMoveEvent( QMouseEvent* theEvent ) -{ - myCurrX = theEvent->x(); - myCurrY = theEvent->y(); - switch (myOperation) { - case ROTATE: - myViewPort->rotate(myCurrX, myCurrY, myCurrPointType, mySelectedPoint); - break; - - case ZOOMVIEW: - myViewPort->zoom(myStartX, myStartY, myCurrX, myCurrY); - myStartX = myCurrX; - myStartY = myCurrY; - break; - - case PANVIEW: - myViewPort->pan(myCurrX - myStartX, myStartY - myCurrY); - myStartX = myCurrX; - myStartY = myCurrY; - break; - -/* case WINDOWFIT: - myDrawRect = true; - repaint(); - break; -*/ - case PANGLOBAL: - break; - - default: - if ( myRotationPointSelection ) - emit mouseMoving( this, theEvent ); - else - { - int aState = theEvent->modifiers(); - int aButton = theEvent->buttons(); - if ( aButton == Qt::LeftButton && ( aState == Qt::NoModifier || Qt::ShiftModifier ) ) { - myDrawRect = myEnableDrawMode; - if ( myDrawRect ) { - drawRect(); - if ( !myCursorIsHand ) { // we are going to sketch a rectangle - QCursor handCursor (Qt::PointingHandCursor); - myCursorIsHand = true; - myCursor = cursor(); - myViewPort->setCursor( handCursor ); - } - } - } - else if ( aButton == Qt::RightButton && ( aState == Qt::NoModifier || Qt::ShiftModifier ) ) { - OCCViewer_ViewSketcher* sketcher = 0; - QList::Iterator it; - for ( it = mySketchers.begin(); it != mySketchers.end() && !sketcher; ++it ) - { - OCCViewer_ViewSketcher* sk = (*it); - if( sk->isDefault() && sk->sketchButton() == aButton ) - sketcher = sk; - } - if ( sketcher && myCurSketch == -1 ) - { - activateSketching( sketcher->type() ); - if ( mypSketcher ) - { - myCurSketch = mypSketcher->sketchButton(); - - if ( l_mbPressEvent ) - { - QApplication::sendEvent( getViewPort(), l_mbPressEvent ); - delete l_mbPressEvent; - l_mbPressEvent = 0; - } - QApplication::sendEvent( getViewPort(), theEvent ); - } - } - } - else - emit mouseMoving( this, theEvent ); - } - } -} - -/*! - \brief Handle mouse release event. - \param theEvent mouse event -*/ -void OCCViewer_ViewWindow::vpMouseReleaseEvent(QMouseEvent* theEvent) -{ - switch ( myOperation ) { - case NOTHING: - { - int prevState = myCurSketch; - if(theEvent->button() == Qt::RightButton) - { - QList::Iterator it; - for ( it = mySketchers.begin(); it != mySketchers.end() && myCurSketch != -1; ++it ) - { - OCCViewer_ViewSketcher* sk = (*it); - if( ( sk->sketchButton() & theEvent->button() ) && sk->sketchButton() == myCurSketch ) - myCurSketch = -1; - } - } - - emit mouseReleased(this, theEvent); - if(theEvent->button() == Qt::RightButton && prevState == -1) - { - QContextMenuEvent aEvent( QContextMenuEvent::Mouse, - theEvent->pos(), theEvent->globalPos() ); - emit contextMenuRequested( &aEvent ); - } - } - break; - case ROTATE: - myViewPort->endRotation(); - resetState(); - break; - - case PANVIEW: - case ZOOMVIEW: - resetState(); - break; - - case PANGLOBAL: - if ( theEvent->button() == Qt::LeftButton ) { - myViewPort->setCenter( theEvent->x(), theEvent->y() ); - myViewPort->getView()->SetScale(myCurScale); - resetState(); - } - break; - - case WINDOWFIT: - if ( theEvent->button() == Qt::LeftButton ) { - myCurrX = theEvent->x(); - myCurrY = theEvent->y(); - drawRect(); - QRect rect = SUIT_Tools::makeRect(myStartX, myStartY, myCurrX, myCurrY); - if ( !rect.isEmpty() ) myViewPort->fitRect(rect); - endDrawRect(); - resetState(); - } - break; - } - - // NOTE: viewer 3D detects a rectangle of selection using this event - // so we must emit it BEFORE resetting the selection rectangle - - if ( theEvent->button() == Qt::LeftButton && myDrawRect ) { - drawRect(); - endDrawRect(); - resetState(); - myViewPort->update(); - } - - if ( l_mbPressEvent ) - { - delete l_mbPressEvent; - l_mbPressEvent = 0; - } -} - -/*! - \brief Reset the viewport to its initial state - ( no transformations in process etc. ) -*/ -void OCCViewer_ViewWindow::resetState() -{ - myDrawRect = false; - - if ( myRotationPointSelection ) - { - QCursor handCursor (Qt::PointingHandCursor); - myViewPort->setCursor( handCursor ); - } - else - { - if ( transformRequested() || myCursorIsHand ) - myViewPort->setCursor( myCursor ); - myCursorIsHand = false; - } - - if ( transformRequested() ) - emit vpTransformationFinished (myOperation); - - setTransformInProcess( false ); - setTransformRequested( NOTHING ); -} - - -/*! - \brief Draw rubber band rectangle. -*/ -void OCCViewer_ViewWindow::drawRect() -{ - if ( !myRectBand ) { - myRectBand = new QRubberBand( QRubberBand::Rectangle, myViewPort ); -#ifdef WIN32 - myRectBand->setStyle(new QWindowsStyle); -#endif - QPalette palette; - palette.setColor(myRectBand->foregroundRole(), Qt::white); - myRectBand->setPalette(palette); - } - myRectBand->hide(); - - QRect aRect = SUIT_Tools::makeRect(myStartX, myStartY, myCurrX, myCurrY); - myRectBand->setGeometry( aRect ); - myRectBand->setVisible( aRect.isValid() ); -} - -/*! - \brief Clear rubber band rectangle on the end on the dragging operation. -*/ -void OCCViewer_ViewWindow::endDrawRect() -{ - delete myRectBand; - myRectBand = 0; -} - -/*! - \brief Create actions. -*/ -void OCCViewer_ViewWindow::createActions() -{ - if( !toolMgr()->isEmpty() ) - return; - - SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); - - QtxAction* aAction; - - // Dump view - aAction = new QtxAction(tr("MNU_DUMP_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_DUMP" ) ), - tr( "MNU_DUMP_VIEW" ), 0, this); - aAction->setStatusTip(tr("DSC_DUMP_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onDumpView())); - toolMgr()->registerAction( aAction, DumpId ); - - // FitAll - aAction = new QtxAction(tr("MNU_FITALL"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_FITALL" ) ), - tr( "MNU_FITALL" ), 0, this); - aAction->setStatusTip(tr("DSC_FITALL")); - connect(aAction, SIGNAL(activated()), this, SLOT(onFitAll())); - toolMgr()->registerAction( aAction, FitAllId ); - - // FitRect - aAction = new QtxAction(tr("MNU_FITRECT"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_FITAREA" ) ), - tr( "MNU_FITRECT" ), 0, this); - aAction->setStatusTip(tr("DSC_FITRECT")); - connect(aAction, SIGNAL(activated()), this, SLOT(activateWindowFit())); - toolMgr()->registerAction( aAction, FitRectId ); - - // Zoom - aAction = new QtxAction(tr("MNU_ZOOM_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_ZOOM" ) ), - tr( "MNU_ZOOM_VIEW" ), 0, this); - aAction->setStatusTip(tr("DSC_ZOOM_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(activateZoom())); - toolMgr()->registerAction( aAction, ZoomId ); - - // Panning - aAction = new QtxAction(tr("MNU_PAN_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_PAN" ) ), - tr( "MNU_PAN_VIEW" ), 0, this); - aAction->setStatusTip(tr("DSC_PAN_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(activatePanning())); - toolMgr()->registerAction( aAction, PanId ); - - // Global Panning - aAction = new QtxAction(tr("MNU_GLOBALPAN_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_GLOBALPAN" ) ), - tr( "MNU_GLOBALPAN_VIEW" ), 0, this); - aAction->setStatusTip(tr("DSC_GLOBALPAN_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(activateGlobalPanning())); - toolMgr()->registerAction( aAction, GlobalPanId ); - - // Rotation Point - mySetRotationPointAction = new QtxAction(tr("MNU_CHANGINGROTATIONPOINT_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_ROTATION_POINT" ) ), - tr( "MNU_CHANGINGROTATIONPOINT_VIEW" ), 0, this); - mySetRotationPointAction->setStatusTip(tr("DSC_CHANGINGROTATIONPOINT_VIEW")); - mySetRotationPointAction->setCheckable( true ); - connect(mySetRotationPointAction, SIGNAL(toggled( bool )), this, SLOT(onSetRotationPoint( bool ))); - toolMgr()->registerAction( mySetRotationPointAction, ChangeRotationPointId ); - - // Rotation - aAction = new QtxAction(tr("MNU_ROTATE_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_ROTATE" ) ), - tr( "MNU_ROTATE_VIEW" ), 0, this); - aAction->setStatusTip(tr("DSC_ROTATE_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(activateRotation())); - toolMgr()->registerAction( aAction, RotationId ); - - // Projections - aAction = new QtxAction(tr("MNU_FRONT_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_FRONT" ) ), - tr( "MNU_FRONT_VIEW" ), 0, this); - aAction->setStatusTip(tr("DSC_FRONT_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onFrontView())); - toolMgr()->registerAction( aAction, FrontId ); - - aAction = new QtxAction(tr("MNU_BACK_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_BACK" ) ), - tr( "MNU_BACK_VIEW" ), 0, this); - aAction->setStatusTip(tr("DSC_BACK_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onBackView())); - toolMgr()->registerAction( aAction, BackId ); - - aAction = new QtxAction(tr("MNU_TOP_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_TOP" ) ), - tr( "MNU_TOP_VIEW" ), 0, this); - aAction->setStatusTip(tr("DSC_TOP_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onTopView())); - toolMgr()->registerAction( aAction, TopId ); - - aAction = new QtxAction(tr("MNU_BOTTOM_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_BOTTOM" ) ), - tr( "MNU_BOTTOM_VIEW" ), 0, this); - aAction->setStatusTip(tr("DSC_BOTTOM_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onBottomView())); - toolMgr()->registerAction( aAction, BottomId ); - - aAction = new QtxAction(tr("MNU_LEFT_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_LEFT" ) ), - tr( "MNU_LEFT_VIEW" ), 0, this); - aAction->setStatusTip(tr("DSC_LEFT_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onLeftView())); - toolMgr()->registerAction( aAction, LeftId ); - - aAction = new QtxAction(tr("MNU_RIGHT_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_RIGHT" ) ), - tr( "MNU_RIGHT_VIEW" ), 0, this); - aAction->setStatusTip(tr("DSC_RIGHT_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onRightView())); - toolMgr()->registerAction( aAction, RightId ); - - // Reset - aAction = new QtxAction(tr("MNU_RESET_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_RESET" ) ), - tr( "MNU_RESET_VIEW" ), 0, this); - aAction->setStatusTip(tr("DSC_RESET_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onResetView())); - toolMgr()->registerAction( aAction, ResetId ); - - // Reset - aAction = new QtxAction(tr("MNU_CLONE_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_CLONE_VIEW" ) ), - tr( "MNU_CLONE_VIEW" ), 0, this); - aAction->setStatusTip(tr("DSC_CLONE_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onCloneView())); - toolMgr()->registerAction( aAction, CloneId ); - - myClippingAction = new QtxAction(tr("MNU_CLIPPING"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_CLIPPING" ) ), - tr( "MNU_CLIPPING" ), 0, this); - myClippingAction->setStatusTip(tr("DSC_CLIPPING")); - myClippingAction->setCheckable( true ); - connect(myClippingAction, SIGNAL(toggled( bool )), this, SLOT(onClipping( bool ))); - toolMgr()->registerAction( myClippingAction, ClippingId ); - - aAction = new QtxAction(tr("MNU_SHOOT_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_SHOOT_VIEW" ) ), - tr( "MNU_SHOOT_VIEW" ), 0, this); - aAction->setStatusTip(tr("DSC_SHOOT_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onMemorizeView())); - toolMgr()->registerAction( aAction, MemId ); - - aAction = new QtxAction(tr("MNU_PRESETS_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_PRESETS_VIEW" ) ), - tr( "MNU_PRESETS_VIEW" ), 0, this); - aAction->setStatusTip(tr("DSC_PRESETS_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onRestoreView())); - toolMgr()->registerAction( aAction, RestoreId ); - - if (myModel->trihedronActivated()) { - aAction = new QtxAction(tr("MNU_SHOW_TRIHEDRE"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_TRIHEDRON" ) ), - tr( "MNU_SHOW_TRIHEDRE" ), 0, this); - aAction->setStatusTip(tr("DSC_SHOW_TRIHEDRE")); - connect(aAction, SIGNAL(activated()), this, SLOT(onTrihedronShow())); - toolMgr()->registerAction( aAction, TrihedronShowId ); - } - - // Scale - aAction = new QtxAction(tr("MNU_SCALING"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_SCALING" ) ), - tr( "MNU_SCALING" ), 0, this); - aAction->setStatusTip(tr("DSC_SCALING")); - connect(aAction, SIGNAL(activated()), this, SLOT(onAxialScale())); - toolMgr()->registerAction( aAction, AxialScaleId ); -} - -/*! - \brief Create toolbar. -*/ -void OCCViewer_ViewWindow::createToolBar() -{ - int tid = toolMgr()->createToolBar( tr( "LBL_TOOLBAR_LABEL" ) ); - - toolMgr()->append( DumpId, tid ); - if( myModel->trihedronActivated() ) - toolMgr()->append( TrihedronShowId, tid ); - - QtxMultiAction* aScaleAction = new QtxMultiAction( this ); - aScaleAction->insertAction( toolMgr()->action( FitAllId ) ); - aScaleAction->insertAction( toolMgr()->action( FitRectId ) ); - aScaleAction->insertAction( toolMgr()->action( ZoomId ) ); - toolMgr()->append( aScaleAction, tid ); - - QtxMultiAction* aPanningAction = new QtxMultiAction( this ); - aPanningAction->insertAction( toolMgr()->action( PanId ) ); - aPanningAction->insertAction( toolMgr()->action( GlobalPanId ) ); - toolMgr()->append( aPanningAction, tid ); - - toolMgr()->append( ChangeRotationPointId, tid ); - toolMgr()->append( RotationId, tid ); - - QtxMultiAction* aViewsAction = new QtxMultiAction( this ); - aViewsAction->insertAction( toolMgr()->action( FrontId ) ); - aViewsAction->insertAction( toolMgr()->action( BackId ) ); - aViewsAction->insertAction( toolMgr()->action( TopId ) ); - aViewsAction->insertAction( toolMgr()->action( BottomId ) ); - aViewsAction->insertAction( toolMgr()->action( LeftId ) ); - aViewsAction->insertAction( toolMgr()->action( RightId ) ); - toolMgr()->append( aViewsAction, tid ); - - toolMgr()->append( ResetId, tid ); - - QtxMultiAction* aMemAction = new QtxMultiAction( this ); - aMemAction->insertAction( toolMgr()->action( MemId ) ); - aMemAction->insertAction( toolMgr()->action( RestoreId ) ); - toolMgr()->append( aMemAction, tid ); - - toolMgr()->append( toolMgr()->separator(), tid ); - toolMgr()->append( CloneId, tid ); - - toolMgr()->append( toolMgr()->separator(), tid ); - toolMgr()->append( ClippingId, tid ); - toolMgr()->append( AxialScaleId, tid ); -} - -/*! - \brief Perform 'fit all' operation. -*/ -void OCCViewer_ViewWindow::onViewFitAll() -{ - myViewPort->fitAll(); -} - -/*! - \brief Perform "front view" transformation. -*/ -void OCCViewer_ViewWindow::onFrontView() -{ - emit vpTransformationStarted ( FRONTVIEW ); - Handle(V3d_View) aView3d = myViewPort->getView(); - if ( !aView3d.IsNull() ) aView3d->SetProj (V3d_Xpos); - onViewFitAll(); -} - -/*! - \brief Perform "back view" transformation. -*/ -void OCCViewer_ViewWindow::onBackView() -{ - emit vpTransformationStarted ( BACKVIEW ); - Handle(V3d_View) aView3d = myViewPort->getView(); - if ( !aView3d.IsNull() ) aView3d->SetProj (V3d_Xneg); - onViewFitAll(); -} - -/*! - \brief Perform "top view" transformation. -*/ -void OCCViewer_ViewWindow::onTopView() -{ - emit vpTransformationStarted ( TOPVIEW ); - Handle(V3d_View) aView3d = myViewPort->getView(); - if ( !aView3d.IsNull() ) aView3d->SetProj (V3d_Zpos); - onViewFitAll(); -} - -/*! - \brief Perform "bottom view" transformation. -*/ -void OCCViewer_ViewWindow::onBottomView() -{ - emit vpTransformationStarted ( BOTTOMVIEW ); - Handle(V3d_View) aView3d = myViewPort->getView(); - if ( !aView3d.IsNull() ) aView3d->SetProj (V3d_Zneg); - onViewFitAll(); -} - -/*! - \brief Perform "left view" transformation. -*/ -void OCCViewer_ViewWindow::onLeftView() -{ - emit vpTransformationStarted ( LEFTVIEW ); - Handle(V3d_View) aView3d = myViewPort->getView(); - if ( !aView3d.IsNull() ) aView3d->SetProj (V3d_Yneg); - onViewFitAll(); -} - -/*! - \brief Perform "right view" transformation. -*/ -void OCCViewer_ViewWindow::onRightView() -{ - emit vpTransformationStarted ( RIGHTVIEW ); - Handle(V3d_View) aView3d = myViewPort->getView(); - if ( !aView3d.IsNull() ) aView3d->SetProj (V3d_Ypos); - onViewFitAll(); -} - -/*! - \brief Perform "reset view" transformation. - - Sets default orientation of the viewport camera. -*/ -void OCCViewer_ViewWindow::onResetView() -{ - emit vpTransformationStarted( RESETVIEW ); - bool upd = myViewPort->getView()->SetImmediateUpdate( false ); - myViewPort->getView()->Reset( false ); - myViewPort->fitAll( false, true, false ); - myViewPort->getView()->SetImmediateUpdate( upd ); - myViewPort->getView()->Update(); -} - -/*! - \brief Perform "fit all" transformation. -*/ -void OCCViewer_ViewWindow::onFitAll() -{ - emit vpTransformationStarted( FITALLVIEW ); - myViewPort->fitAll(); -} - -/*! - \brief Called if 'change rotation point' operation is activated. - \param on action state -*/ -void OCCViewer_ViewWindow::onSetRotationPoint( bool on ) -{ - if ( on ) - { - if ( !mySetRotationPointDlg ) - { - mySetRotationPointDlg = new OCCViewer_SetRotationPointDlg( this, myDesktop ); - mySetRotationPointDlg->SetAction( mySetRotationPointAction ); - } - - if ( !mySetRotationPointDlg->isVisible() ) - { - if ( mySetRotationPointDlg->IsFirstShown() ) - { - Standard_Real Xcenter, Ycenter, Zcenter; - if ( computeGravityCenter( Xcenter, Ycenter, Zcenter ) ) - mySetRotationPointDlg->setCoords( Xcenter, Ycenter, Zcenter ); - } - mySetRotationPointDlg->show(); - } - } - else - { - if ( mySetRotationPointDlg->isVisible() ) - mySetRotationPointDlg->hide(); - } -} - -/*! - \brief Create one more window with same content. -*/ -void OCCViewer_ViewWindow::onCloneView() -{ - SUIT_ViewWindow* vw = myManager->createViewWindow(); - //vw->show(); - emit viewCloned( vw ); -} - -/*! - \brief called if clipping operation is activated. - - Enables/disables clipping plane displaying. - - \parma on action state -*/ -void OCCViewer_ViewWindow::onClipping( bool on ) -{ - /* - SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); - if ( on ) - myActionsMap[ ClippingId ]->setIcon(aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_CLIPPING_PRESSED" ))); - else - myActionsMap[ ClippingId ]->setIcon(aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_CLIPPING" ))); - */ - if ( on ) - { - if ( !myClippingDlg ) - { - myClippingDlg = new OCCViewer_ClippingDlg( this, myDesktop ); - myClippingDlg->SetAction( myClippingAction ); - } - - if ( !myClippingDlg->isVisible() ) - myClippingDlg->show(); - } - else - { - if ( myClippingDlg->isVisible() ) - myClippingDlg->hide(); - setCuttingPlane(false); - } -} - -/*! - Creates one more window with same content -*/ -void OCCViewer_ViewWindow::onAxialScale() -{ - if ( !myScalingDlg ) - myScalingDlg = new OCCViewer_AxialScaleDlg( this, myDesktop ); - - if ( !myScalingDlg->isVisible() ) - myScalingDlg->show(); -} - -/*! - \brief Store view parameters. -*/ -void OCCViewer_ViewWindow::onMemorizeView() -{ - myModel->appendViewAspect( getViewParams() ); -} - -/*! - \brief Restore view parameters. -*/ -void OCCViewer_ViewWindow::onRestoreView() -{ - OCCViewer_CreateRestoreViewDlg* aDlg = new OCCViewer_CreateRestoreViewDlg( centralWidget(), myModel ); - connect( aDlg, SIGNAL( dlgOk() ), this, SLOT( setRestoreFlag() ) ); - aDlg->exec(); - myModel->updateViewAspects( aDlg->parameters() ); - if( myRestoreFlag && aDlg->parameters().count() ) - performRestoring( aDlg->currentItem() ); -} - -/*! - \brief Restore view parameters. - \param anItem view parameters -*/ -void OCCViewer_ViewWindow::performRestoring( const viewAspect& anItem ) -{ - Handle(V3d_View) aView3d = myViewPort->getView(); - - Standard_Boolean prev = aView3d->SetImmediateUpdate( Standard_False ); - aView3d->SetScale( anItem.scale ); - aView3d->SetCenter( anItem.centerX, anItem.centerY ); - aView3d->SetTwist( anItem.twist ); - aView3d->SetAt( anItem.atX, anItem.atY, anItem.atZ ); - aView3d->SetImmediateUpdate( prev ); - aView3d->SetEye( anItem.eyeX, anItem.eyeY, anItem.eyeZ ); - aView3d->SetProj( anItem.projX, anItem.projY, anItem.projZ ); - aView3d->SetAxialScale( anItem.scaleX, anItem.scaleY, anItem.scaleZ ); - - myRestoreFlag = 0; -} - -/*! - \brief Set restore flag. -*/ -void OCCViewer_ViewWindow::setRestoreFlag() -{ - myRestoreFlag = 1; -} - -/*! - \brief Called when action "show/hide trihedron" is activated. -*/ -void OCCViewer_ViewWindow::onTrihedronShow() -{ - myModel->toggleTrihedron(); -} - -/*! - \brief Dump view window contents to the pixmap. - \return pixmap containing all scene rendered in the window -*/ -QImage OCCViewer_ViewWindow::dumpView() -{ - QPixmap px = QPixmap::grabWindow( myViewPort->winId() ); - return px.toImage(); -} - -/*! - \brief Set parameters of the cutting plane - \param on if \c true, cutting plane is enabled - \param x X position of plane point - \param y Y position of plane point - \param z Z position of plane point - \param dx X coordinate of plane normal - \param dy Y coordinate of plane normal - \param dz Z coordinate of plane normal -*/ -void OCCViewer_ViewWindow::setCuttingPlane( bool on, const double x, const double y, const double z, - const double dx, const double dy, const double dz ) -{ - Handle(V3d_View) view = myViewPort->getView(); - if ( view.IsNull() ) - return; - - if ( on ) { - Handle(V3d_Viewer) viewer = myViewPort->getViewer(); - - // try to use already existing plane or create a new one - Handle(V3d_Plane) clipPlane; - view->InitActivePlanes(); - if ( view->MoreActivePlanes() ) - clipPlane = view->ActivePlane(); - else - clipPlane = new V3d_Plane( viewer ); - - // set new a,b,c,d values for the plane - gp_Pln pln( gp_Pnt( x, y, z ), gp_Dir( dx, dy, dz ) ); - double a, b, c, d; - pln.Coefficients( a, b, c, d ); - clipPlane->SetPlane( a, b, c, d ); - - view->SetPlaneOn( clipPlane ); - } - else - view->SetPlaneOff(); - - view->Update(); - view->Redraw(); -} - -/*! - \brief Check if any cutting plane is enabled - \return \c true if at least one cutting plane is enabled -*/ -bool OCCViewer_ViewWindow::isCuttingPlane() -{ - Handle(V3d_View) view = myViewPort->getView(); - view->InitActivePlanes(); - return (view->MoreActivePlanes()); -} - -/*! - \brief Get the visual parameters of the view window. - \return visual parameters of view window -*/ -viewAspect OCCViewer_ViewWindow::getViewParams() const -{ - double centerX, centerY, projX, projY, projZ, twist; - double atX, atY, atZ, eyeX, eyeY, eyeZ; - double aScaleX, aScaleY, aScaleZ; - - Handle(V3d_View) aView3d = myViewPort->getView(); - - aView3d->Center( centerX, centerY ); - aView3d->Proj( projX, projY, projZ ); - aView3d->At( atX, atY, atZ ); - aView3d->Eye( eyeX, eyeY, eyeZ ); - twist = aView3d->Twist(); - - aView3d->AxialScale(aScaleX,aScaleY,aScaleZ); - - QString aName = QTime::currentTime().toString() + QString::fromLatin1( " h:m:s" ); - - viewAspect params; - params.scale = aView3d->Scale(); - params.centerX = centerX; - params.centerY = centerY; - params.projX = projX; - params.projY = projY; - params.projZ = projZ; - params.twist = twist; - params.atX = atX; - params.atY = atY; - params.atZ = atZ; - params.eyeX = eyeX; - params.eyeY = eyeY; - params.eyeZ = eyeZ; - params.scaleX = aScaleX; - params.scaleY = aScaleY; - params.scaleZ = aScaleZ; - params.name = aName; - - return params; -} - - -/*! - \brief Get visual parameters of this view window. - \return visual parameters of view window -*/ -QString OCCViewer_ViewWindow::getVisualParameters() -{ - viewAspect params = getViewParams(); - QString retStr; - retStr.sprintf( "%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e*%.12e", params.scale, - params.centerX, params.centerY, params.projX, params.projY, params.projZ, params.twist, - params.atX, params.atY, params.atZ, params.eyeX, params.eyeY, params.eyeZ, - params.scaleX, params.scaleY, params.scaleZ ); - return retStr; -} - -/*! - \brief Restore visual parameters of the view window. - \param parameters visual parameters of view window -*/ -void OCCViewer_ViewWindow::setVisualParameters( const QString& parameters ) -{ - QStringList paramsLst = parameters.split( '*' ); - if ( paramsLst.size() >= 13 ) { - viewAspect params; - params.scale = paramsLst[0].toDouble(); - params.centerX = paramsLst[1].toDouble(); - params.centerY = paramsLst[2].toDouble(); - params.projX = paramsLst[3].toDouble(); - params.projY = paramsLst[4].toDouble(); - params.projZ = paramsLst[5].toDouble(); - params.twist = paramsLst[6].toDouble(); - params.atX = paramsLst[7].toDouble(); - params.atY = paramsLst[8].toDouble(); - params.atZ = paramsLst[9].toDouble(); - params.eyeX = paramsLst[10].toDouble(); - params.eyeY = paramsLst[11].toDouble(); - params.eyeZ = paramsLst[12].toDouble(); - if ( paramsLst.size() == 16 ) { - params.scaleX = paramsLst[13].toDouble(); - params.scaleY = paramsLst[14].toDouble(); - params.scaleZ = paramsLst[15].toDouble(); - } - else { - params.scaleX = 1.; - params.scaleY = 1.; - params.scaleZ = 1.; - } - - performRestoring( params ); - } -} - -/*! - \brief Handle show event. - - Emits Show() signal. - - \param theEvent show event -*/ -void OCCViewer_ViewWindow::showEvent( QShowEvent* theEvent ) -{ - emit Show( theEvent ); -} - -/*! - \brief Handle hide event. - - Emits Hide() signal. - - \param theEvent hide event -*/ -void OCCViewer_ViewWindow::hideEvent( QHideEvent* theEvent ) -{ - emit Hide( theEvent ); -} - - -/*! - Creates default sketcher. [ virtual protected ] -*/ -OCCViewer_ViewSketcher* OCCViewer_ViewWindow::createSketcher( int type ) -{ - if ( type == Rect ) - return new OCCViewer_RectSketcher( this, type ); - if ( type == Polygon ) - return new OCCViewer_PolygonSketcher( this, type ); - return 0; -} - -void OCCViewer_ViewWindow::initSketchers() -{ - if ( mySketchers.isEmpty() ) - { - mySketchers.append( createSketcher( Rect ) ); - mySketchers.append( createSketcher( Polygon ) ); - } -} - -OCCViewer_ViewSketcher* OCCViewer_ViewWindow::getSketcher( const int typ ) -{ - OCCViewer_ViewSketcher* sketcher = 0; - QList::Iterator it; - for ( it = mySketchers.begin(); it != mySketchers.end() && !sketcher; ++it ) - { - OCCViewer_ViewSketcher* sk = (*it); - if ( sk->type() == typ ) - sketcher = sk; - } - return sketcher; -} - -/*! - Handles requests for sketching in the active view. [ virtual public ] -*/ -void OCCViewer_ViewWindow::activateSketching( int type ) -{ - OCCViewer_ViewPort3d* vp = getViewPort(); - if ( !vp ) - return; - - if ( !vp->isSketchingEnabled() ) - return; - - /* Finish current sketching */ - if ( type == NoSketching ) - { - if ( mypSketcher ) - { - onSketchingFinished(); - mypSketcher->deactivate(); - mypSketcher = 0; - } - } - /* Activate new sketching */ - else - { - activateSketching( NoSketching ); /* concurrency not suported */ - mypSketcher = getSketcher( type ); - if ( mypSketcher ) - { - mypSketcher->activate(); - onSketchingStarted(); - } - } -} - -/*! - Unhilights detected entities. [ virtual protected ] -*/ -void OCCViewer_ViewWindow::onSketchingStarted() -{ -} - -/*! - Selection by rectangle or polygon. [ virtual protected ] -*/ -void OCCViewer_ViewWindow::onSketchingFinished() -{ - if ( mypSketcher && mypSketcher->result() == OCCViewer_ViewSketcher::Accept ) - { - Handle(AIS_InteractiveContext) ic = myModel->getAISContext(); - bool append = bool( mypSketcher->buttonState() & Qt::ShiftModifier ); - switch( mypSketcher->type() ) - { - case Rect: - { - QRect* aRect = (QRect*)mypSketcher->data(); - if( aRect ) - { - int aLeft = aRect->left(); - int aRight = aRect->right(); - int aTop = aRect->top(); - int aBottom = aRect->bottom(); - - if( append ) - ic->ShiftSelect( aLeft, aBottom, aRight, aTop, getViewPort()->getView(), Standard_False ); - else - ic->Select( aLeft, aBottom, aRight, aTop, getViewPort()->getView(), Standard_False ); - } - } - break; - case Polygon: - { - QPolygon* aPolygon = (QPolygon*)mypSketcher->data(); - if( aPolygon ) - { - int size = aPolygon->size(); - TColgp_Array1OfPnt2d anArray( 1, size ); - - QPolygon::Iterator it = aPolygon->begin(); - QPolygon::Iterator itEnd = aPolygon->end(); - for( int index = 1; it != itEnd; ++it, index++ ) - { - QPoint aPoint = *it; - anArray.SetValue( index, gp_Pnt2d( aPoint.x(), aPoint.y() ) ); - } - - if( append ) - ic->ShiftSelect( anArray, getViewPort()->getView(), Standard_False ); - else - ic->Select( anArray, getViewPort()->getView(), Standard_False ); - } - } - break; - default: - break; - } - - OCCViewer_ViewManager* aViewMgr = ( OCCViewer_ViewManager* )getViewManager(); - aViewMgr->getOCCViewer()->performSelectionChanged(); - } -} - -OCCViewer_ViewPort3d* OCCViewer_ViewWindow::getViewPort() -{ - return myViewPort; -} - -bool OCCViewer_ViewWindow::transformRequested() const -{ - return ( myOperation != NOTHING ); -} - -bool OCCViewer_ViewWindow::transformInProcess() const -{ - return myEventStarted; -} - -void OCCViewer_ViewWindow::setTransformInProcess( bool bOn ) -{ - myEventStarted = bOn; -} diff --git a/src/OCCViewer/OCCViewer_ViewWindow.h b/src/OCCViewer/OCCViewer_ViewWindow.h deleted file mode 100755 index c13873886..000000000 --- a/src/OCCViewer/OCCViewer_ViewWindow.h +++ /dev/null @@ -1,205 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 OCCVIEWER_VIEWWINDOW_H -#define OCCVIEWER_VIEWWINDOW_H - -#include "OCCViewer.h" -#include "SUIT_ViewWindow.h" -#include - -class QRubberBand; -class SUIT_Desktop; -class OCCViewer_ViewPort3d; -class OCCViewer_ViewSketcher; -class OCCViewer_ClippingDlg; -class OCCViewer_AxialScaleDlg; -class OCCViewer_SetRotationPointDlg; -class OCCViewer_Viewer; -class viewAspect; -class QtxAction; - -#ifdef WIN32 -#pragma warning( disable:4251 ) -#endif - -class OCCVIEWER_EXPORT OCCViewer_ViewWindow : public SUIT_ViewWindow -{ - Q_OBJECT - -public: - enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, - ChangeRotationPointId, RotationId, - FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId, CloneId, ClippingId, MemId, RestoreId, - TrihedronShowId, AxialScaleId }; - - enum OperationType{ NOTHING, PANVIEW, ZOOMVIEW, ROTATE, - PANGLOBAL, WINDOWFIT, FITALLVIEW, RESETVIEW, - FRONTVIEW, BACKVIEW, TOPVIEW, BOTTOMVIEW, LEFTVIEW, RIGHTVIEW }; - - enum RotationPointType{ GRAVITY, SELECTED }; - - enum SketchingType { NoSketching, Rect, Polygon }; - - OCCViewer_ViewWindow(SUIT_Desktop* theDesktop, OCCViewer_Viewer* theModel); - virtual ~OCCViewer_ViewWindow(); - - OCCViewer_ViewPort3d* getViewPort(); - - bool eventFilter(QObject* watched, QEvent* e); - - void performRestoring( const viewAspect& ); - - virtual void initLayout(); - - void updateEnabledDrawMode(); - - void setCuttingPlane( bool on, const double x = 0 , const double y = 0 , const double z = 0, - const double dx = 0, const double dy = 0, const double dz = 1); - - bool isCuttingPlane(); - - virtual QString getVisualParameters(); - virtual void setVisualParameters( const QString& parameters ); - - virtual void initSketchers(); - OCCViewer_ViewSketcher* getSketcher( const int ); - - void activateSketching( int ); - -public slots: - void onFrontView(); - void onViewFitAll(); - void onBackView(); - void onTopView(); - void onBottomView(); - void onLeftView(); - void onRightView(); - void onResetView(); - void onFitAll(); - void activateZoom(); - void activateWindowFit(); - void activateRotation(); - void activatePanning(); - void activateGlobalPanning(); - void onSetRotationPoint( bool on ); - void onCloneView(); - void onClipping( bool on ); - void onAxialScale(); - void onMemorizeView(); - void onRestoreView(); - void onTrihedronShow(); - void setRestoreFlag(); - - void activateSetRotationGravity(); - void activateSetRotationSelected( double theX, double theY, double theZ ); - void activateStartPointSelection(); - void updateGravityCoords(); - - virtual void showEvent( QShowEvent * ); - virtual void hideEvent( QHideEvent * ); - -signals: - void vpTransformationStarted(OCCViewer_ViewWindow::OperationType type); - void vpTransformationFinished(OCCViewer_ViewWindow::OperationType type); - void viewCloned( SUIT_ViewWindow* ); - - void Show( QShowEvent * ); - void Hide( QHideEvent * ); - -protected: - QImage dumpView(); - - /* Transformation selected but not started yet */ - bool transformRequested() const; - void setTransformRequested ( OperationType ); - - /* Transformation is selected and already started */ - bool transformInProcess() const; - void setTransformInProcess( bool ); - - void vpMousePressEvent(QMouseEvent* theEvent); - void vpMouseReleaseEvent(QMouseEvent* theEvent); - void vpMouseMoveEvent(QMouseEvent* theEvent); - - void resetState(); - void drawRect(); - void endDrawRect(); - - void createActions(); - void createToolBar(); - - virtual OperationType getButtonState(QMouseEvent* theEvent); - - viewAspect getViewParams() const; - - bool computeGravityCenter( double& theX, double& theY, double& theZ ); - - virtual void onSketchingStarted(); - virtual void onSketchingFinished(); - - virtual OCCViewer_ViewSketcher* createSketcher( int ); - - OCCViewer_ViewSketcher* mypSketcher; - QList mySketchers; - - int myCurSketch; - - OperationType myOperation; - OCCViewer_Viewer* myModel; - OCCViewer_ViewPort3d* myViewPort; - - RotationPointType myCurrPointType; - RotationPointType myPrevPointType; - gp_Pnt mySelectedPoint; - bool myRotationPointSelection; - - int myRestoreFlag; - - int myStartX; - int myStartY; - int myCurrX; - int myCurrY; - - bool myEventStarted; // set when transformation is in process - bool myCursorIsHand; - bool myDrawRect; // set when a rect is used for selection or magnify - bool myEnableDrawMode; - bool myPaintersRedrawing; // set to draw with external painters - - QCursor myCursor; - - double myCurScale; - -private: - OCCViewer_ClippingDlg* myClippingDlg; - QtxAction* myClippingAction; - - OCCViewer_AxialScaleDlg* myScalingDlg; - - OCCViewer_SetRotationPointDlg* mySetRotationPointDlg; - QtxAction* mySetRotationPointAction; - - QRubberBand* myRectBand; //!< selection rectangle rubber band -}; - -#ifdef WIN32 -#pragma warning( default:4251 ) -#endif - -#endif diff --git a/src/OCCViewer/resources/OCCViewer_images.po b/src/OCCViewer/resources/OCCViewer_images.po deleted file mode 100755 index 4ab78a38d..000000000 --- a/src/OCCViewer/resources/OCCViewer_images.po +++ /dev/null @@ -1,99 +0,0 @@ -# SALOME SALOMEGUI : implementation of desktop and GUI kernel -# -# 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 : SALOMEGUI_icons.po -# Module : SALOME - -msgid "" -msgstr "" -"Project-Id-Version: example-Qt-message-extraction\n" -"POT-Creation-Date: 1999-02-23 15:38+0200\n" -"PO-Revision-Date: 1999-02-23 15:38+0200\n" -"Last-Translator: \n" -"Content-Type: text/plain; charset=iso-8859-1\n" - -msgid "ICON_OCCVIEWER_VIEW_BACK" -msgstr "view_back.png" - -msgid "ICON_OCCVIEWER_VIEW_BOTTOM" -msgstr "view_bottom.png" - -msgid "ICON_OCCVIEWER_VIEW_FITALL" -msgstr "view_fitall.png" - -msgid "ICON_OCCVIEWER_VIEW_FITAREA" -msgstr "view_fitarea.png" - -msgid "ICON_OCCVIEWER_VIEW_FRONT" -msgstr "view_front.png" - -msgid "ICON_OCCVIEWER_VIEW_GLOBALPAN" -msgstr "view_glpan.png" - -msgid "ICON_OCCVIEWER_VIEW_LEFT" -msgstr "view_left.png" - -msgid "ICON_OCCVIEWER_VIEW_PAN" -msgstr "view_pan.png" - -msgid "ICON_OCCVIEWER_VIEW_RESET" -msgstr "view_reset.png" - -msgid "ICON_OCCVIEWER_VIEW_RIGHT" -msgstr "view_right.png" - -msgid "ICON_OCCVIEWER_VIEW_ROTATION_POINT" -msgstr "view_rotation_point.png" - -msgid "ICON_OCCVIEWER_VIEW_ROTATE" -msgstr "view_rotate.png" - -msgid "ICON_OCCVIEWER_VIEW_TOP" -msgstr "view_top.png" - -msgid "ICON_OCCVIEWER_VIEW_ZOOM" -msgstr "view_zoom.png" - -msgid "ICON_OCCVIEWER_VIEW_TRIHEDRON" -msgstr "view_triedre.png" - -msgid "ICON_OCCVIEWER_VIEW_DUMP" -msgstr "view_camera_dump.png" - -msgid "ICON_OCCVIEWER_CLONE_VIEW" -msgstr "view_clone.png" - -msgid "ICON_OCCVIEWER_CLIPPING" -msgstr "view_clipping.png" - -msgid "ICON_OCCVIEWER_CLIPPING_PRESSED" -msgstr "view_clipping_pressed.png" - -msgid "ICON_OCCVIEWER_SHOOT_VIEW" -msgstr "view_shoot.png" - -msgid "ICON_OCCVIEWER_PRESETS_VIEW" -msgstr "view_presets.png" - - - diff --git a/src/OCCViewer/resources/OCCViewer_images.ts b/src/OCCViewer/resources/OCCViewer_images.ts deleted file mode 100644 index 9da198c96..000000000 --- a/src/OCCViewer/resources/OCCViewer_images.ts +++ /dev/null @@ -1,93 +0,0 @@ - - - @default - - ICON_OCCVIEWER_VIEW_GLOBALPAN - occ_view_glpan.png - - - ICON_OCCVIEWER_CLIPPING_PRESSED - occ_view_clipping_pressed.png - - - ICON_OCCVIEWER_VIEW_FITAREA - occ_view_fitarea.png - - - ICON_OCCVIEWER_CLONE_VIEW - occ_view_clone.png - - - ICON_OCCVIEWER_PRESETS_VIEW - occ_view_presets.png - - - ICON_OCCVIEWER_VIEW_TOP - occ_view_top.png - - - ICON_OCCVIEWER_VIEW_PAN - occ_view_pan.png - - - ICON_OCCVIEWER_SHOOT_VIEW - occ_view_shoot.png - - - ICON_OCCVIEWER_VIEW_ROTATION_POINT - occ_view_rotation_point.png - - - ICON_OCCVIEWER_VIEW_DUMP - occ_view_camera_dump.png - - - ICON_OCCVIEWER_VIEW_BACK - occ_view_back.png - - - ICON_OCCVIEWER_VIEW_ZOOM - occ_view_zoom.png - - - ICON_OCCVIEWER_VIEW_LEFT - occ_view_left.png - - - ICON_OCCVIEWER_VIEW_FITALL - occ_view_fitall.png - - - ICON_OCCVIEWER_VIEW_BOTTOM - occ_view_bottom.png - - - ICON_OCCVIEWER_VIEW_ROTATE - occ_view_rotate.png - - - ICON_OCCVIEWER_VIEW_FRONT - occ_view_front.png - - - ICON_OCCVIEWER_VIEW_RESET - occ_view_reset.png - - - ICON_OCCVIEWER_VIEW_RIGHT - occ_view_right.png - - - ICON_OCCVIEWER_CLIPPING - occ_view_clipping.png - - - ICON_OCCVIEWER_VIEW_TRIHEDRON - occ_view_triedre.png - - - ICON_OCCVIEWER_SCALING - occ_view_scaling.png - - - diff --git a/src/OCCViewer/resources/OCCViewer_msg_en.po b/src/OCCViewer/resources/OCCViewer_msg_en.po deleted file mode 100755 index 71689709e..000000000 --- a/src/OCCViewer/resources/OCCViewer_msg_en.po +++ /dev/null @@ -1,220 +0,0 @@ -# SALOME SALOMEGUI : implementation of desktop and GUI kernel -# -# 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 : SALOMEGUI_msg_en.po -# Module : SALOME - -msgid "" -msgstr "" -"Project-Id-Version: example-Qt-message-extraction\n" -"POT-Creation-Date: 1999-02-23 15:38+0200\n" -"PO-Revision-Date: 1999-02-23 15:38+0200\n" -"Last-Translator: \n" -"Content-Type: text/plain; charset=iso-8859-1\n" - -msgid "LBL_TOOLBAR_LABEL" -msgstr "View Operations" - -msgid "DSC_FRONT_VIEW" -msgstr "Front View" - -msgid "MNU_FRONT_VIEW" -msgstr "Front" - -msgid "DSC_BACK_VIEW" -msgstr "Back View" - -msgid "MNU_BACK_VIEW" -msgstr "Back" - -msgid "DSC_TOP_VIEW" -msgstr "Top View" - -msgid "MNU_TOP_VIEW" -msgstr "Top" - -msgid "DSC_BOTTOM_VIEW" -msgstr "Bottom View" - -msgid "MNU_BOTTOM_VIEW" -msgstr "Bottom" - -msgid "DSC_LEFT_VIEW" -msgstr "Left View" - -msgid "MNU_LEFT_VIEW" -msgstr "Left" - -msgid "DSC_RIGHT_VIEW" -msgstr "Right View" - -msgid "MNU_RIGHT_VIEW" -msgstr "Right" - -msgid "DSC_RESET_VIEW" -msgstr "Reset View Point" - -msgid "MNU_RESET_VIEW" -msgstr "Reset" - -msgid "DSC_FITALL" -msgstr "Fit all objects inside the view frame" - -msgid "MNU_FITALL" -msgstr "Fit All" - -msgid "DSC_FITRECT" -msgstr "Fit area within the view frame" - -msgid "MNU_FITRECT" -msgstr "Fit Area" - -msgid "DSC_ZOOM_VIEW" -msgstr "Zoom the view" - -msgid "MNU_ZOOM_VIEW" -msgstr "Zoom" - -msgid "DSC_PAN_VIEW" -msgstr "Panning the view" - -msgid "MNU_PAN_VIEW" -msgstr "Panning" - -msgid "DSC_GLOBALPAN_VIEW" -msgstr "Selection of a new center of the view" - -msgid "MNU_GLOBALPAN_VIEW" -msgstr "Global Panning" - -msgid "DSC_CHANGINGROTATIONPOINT_VIEW" -msgstr "Change the point, around which the rotation is performed" - -msgid "DSC_ROTATE_VIEW" -msgstr "Rotation of the point of view around the scene center" - -msgid "OCCViewer_SetRotationPointDlg::CAPTION" -msgstr "Set Rotation Point" - -msgid "OCCViewer_SetRotationPointDlg::USE_BBCENTER" -msgstr "Use Bounding Box Center" - -msgid "OCCViewer_SetRotationPointDlg::LBL_TOORIGIN" -msgstr "Set to Origin" - -msgid "OCCViewer_SetRotationPointDlg::LBL_SELECTPOINT" -msgstr "Select Point from View" - -msgid "OCCViewer_SetRotationPointDlg::LBL_X" -msgstr "X :" - -msgid "OCCViewer_SetRotationPointDlg::LBL_Y" -msgstr "Y :" - -msgid "OCCViewer_SetRotationPointDlg::LBL_Z" -msgstr "Z :" - -msgid "MNU_CHANGINGROTATIONPOINT_VIEW" -msgstr "Change Rotation Point" - -msgid "MNU_ROTATIONPOINTGRAVITY_VIEW" -msgstr "Rotation Point : the gravity center" - -msgid "MNU_ROTATIONPOINT000_VIEW" -msgstr "Rotation Point : (0,0,0)" - -msgid "MNU_ROTATIONPOINTSELECTED_VIEW" -msgstr "Rotation Point : the point selected by the user" - -msgid "MNU_ROTATE_VIEW" -msgstr "Rotation" - -msgid "DSC_CLONE_VIEW" -msgstr "Create new OCC viewer for the active scene" - -msgid "MNU_CLONE_VIEW" -msgstr "Clone View" - -msgid "MNU_DUMP_VIEW" -msgstr "Dump view" - -msgid "DSC_CLIPPING" -msgstr "Set clipping plane" - -msgid "MNU_CLIPPING" -msgstr "Clipping" - -msgid "DSC_DUMP_VIEW" -msgstr "Saves the active view in the image file" - -msgid "MNU_SHOOT_VIEW" -msgstr "Memorize View" - -msgid "DSC_SHOOT_VIEW" -msgstr "Memorizes the state of the active view and adds it to the list" - -msgid "MNU_PRESETS_VIEW" -msgstr "Restore View" - -msgid "DSC_PRESETS_VIEW" -msgstr "Selection of the memorized state of the active view" - -msgid "OCC_IMAGE_FILES" -msgstr "Images Files (*.bmp *.png *.jpg *.jpeg)" - -msgid "INF_APP_DUMP_VIEW" -msgstr "Dump view" - -msgid "INF_APP_SHOOT_VIEW" -msgstr "Memorize view" - -msgid "INF_APP_PRESETS_VIEW" -msgstr "Restore view" - -msgid "ERR_DOC_CANT_SAVE_FILE" -msgstr "Cannot save file" - -msgid "ERROR" -msgstr "Error" - -msgid "OCCViewer_Viewer::MEN_DUMP_VIEW" -msgstr "Dump view..." - -msgid "OCCViewer_Viewer::MEN_SHOW_TOOLBAR" -msgstr "Show toolbar" - -msgid "OCCViewer_Viewer::MEN_CHANGE_BACKGROUD" -msgstr "Change background..." - -msgid "OCCViewer_ViewManager::OCC_VIEW_TITLE" -msgstr "OCC scene:%M - viewer:%V" - - -msgid "OCCViewer_CreateRestoreViewDlg::CAPTION" -msgstr "Restore view" - -msgid "MNU_SHOW_TRIHEDRE" -msgstr "Show/Hide trihedron" - -msgid "DSC_SHOW_TRIHEDRE" -msgstr "Show/Hide trihedron in the current view" diff --git a/src/OCCViewer/resources/OCCViewer_msg_en.ts b/src/OCCViewer/resources/OCCViewer_msg_en.ts deleted file mode 100644 index 2cc935170..000000000 --- a/src/OCCViewer/resources/OCCViewer_msg_en.ts +++ /dev/null @@ -1,292 +0,0 @@ - - - @default - - MNU_FRONT_VIEW - Front - - - ERROR - Error - - - MNU_DUMP_VIEW - Dump view - - - DSC_TOP_VIEW - Top View - - - MNU_PAN_VIEW - Panning - - - MNU_CLONE_VIEW - Clone View - - - DSC_SHOW_TRIHEDRE - Show/Hide trihedron in the current view - - - MNU_SHOW_TRIHEDRE - Show/Hide trihedron - - - MNU_TOP_VIEW - Top - - - DSC_GLOBALPAN_VIEW - Selection of a new center of the view - - - DSC_ROTATE_VIEW - Rotation of the point of view around the scene center - - - MNU_ZOOM_VIEW - Zoom - - - DSC_PAN_VIEW - Panning the view - - - DSC_LEFT_VIEW - Left View - - - DSC_SHOOT_VIEW - Memorizes the state of the active view and adds it to the list - - - DSC_FITALL - Fit all objects inside the view frame - - - MNU_FITALL - Fit All - - - MNU_ROTATE_VIEW - Rotation - - - OCC_IMAGE_FILES - Images Files (*.bmp *.png *.jpg *.jpeg) - - - DSC_FRONT_VIEW - Front View - - - MNU_ROTATIONPOINTGRAVITY_VIEW - Rotation Point : the gravity center - - - MNU_GLOBALPAN_VIEW - Global Panning - - - INF_APP_DUMP_VIEW - Dump view - - - DSC_CLIPPING - Set clipping plane - - - DSC_CLONE_VIEW - Create new OCC viewer for the active scene - - - INF_APP_SHOOT_VIEW - Memorize view - - - MNU_CLIPPING - Clipping - - - MNU_BACK_VIEW - Back - - - MNU_SHOOT_VIEW - Memorize View - - - DSC_CHANGINGROTATIONPOINT_VIEW - Change the point, around which the rotation is performed - - - MNU_BOTTOM_VIEW - Bottom - - - MNU_RESET_VIEW - Reset - - - MNU_LEFT_VIEW - Left - - - DSC_RIGHT_VIEW - Right View - - - MNU_CHANGINGROTATIONPOINT_VIEW - Change Rotation Point - - - DSC_FITRECT - Fit area within the view frame - - - MNU_FITRECT - Fit Area - - - DSC_BOTTOM_VIEW - Bottom View - - - DSC_DUMP_VIEW - Saves the active view in the image file - - - DSC_ZOOM_VIEW - Zoom the view - - - MNU_ROTATIONPOINT000_VIEW - Rotation Point : (0,0,0) - - - MNU_ROTATIONPOINTSELECTED_VIEW - Rotation Point : the point selected by the user - - - DSC_RESET_VIEW - Reset View Point - - - ERR_DOC_CANT_SAVE_FILE - Cannot save file - - - DSC_PRESETS_VIEW - Selection of the memorized state of the active view - - - MNU_PRESETS_VIEW - Restore View - - - MNU_RIGHT_VIEW - Right - - - INF_APP_PRESETS_VIEW - Restore view - - - LBL_TOOLBAR_LABEL - View Operations - - - DSC_BACK_VIEW - Back View - - - DSC_SCALING - Change scale of axes - - - MNU_SCALING - Scaling - - - - OCCViewer_CreateRestoreViewDlg - - CAPTION - Restore view - - - - OCCViewer_SetRotationPointDlg - - LBL_X - X: - - - LBL_Y - Y: - - - LBL_Z - Z: - - - USE_BBCENTER - Use Bounding Box Center - - - LBL_TOORIGIN - Set to Origin - - - CAPTION - Set Rotation Point - - - LBL_SELECTPOINT - Select Point from View - - - - OCCViewer_ViewManager - - OCC_VIEW_TITLE - OCC scene:%M - viewer:%V - - - - OCCViewer_Viewer - - MEN_DUMP_VIEW - Dump view... - - - MEN_SHOW_TOOLBAR - Show toolbar - - - MEN_CHANGE_BACKGROUD - Change background... - - - - OCCViewer_AxialScaleDlg - - DLG_SCALING - Axes scaling - - - LBL_X - X: - - - LBL_Y - Y: - - - LBL_Z - Z: - - - diff --git a/src/OCCViewer/resources/occ_view_back.png b/src/OCCViewer/resources/occ_view_back.png deleted file mode 100755 index 51beb0c73e5fa109819e0d38cacb60c467e540b5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 432 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VXMsm#F#`j)FbFd;%$g$s6l6(v z^mSxl*w|O|J8&|PuaN8!Y85oZ=>2VsZ z*|B4WqSelM8i#wf{7CTOSGdP0;NbJ3?dMNl#apQghtI|SW_jEcbAlNt8e+u5$H3Gf zD54n^6{T{VXH(*w9)HIxEDCW90uCPxT*~IIdR4n8u|p(Jf$t^q z>bS!nR-h>-40+fb+8DXnCM1eC{NOkd(7=$iXi}o}f-m6>3`*9o6ODOP_yimhm>Zui zG}`hbQ1Rdy@qqk8yv&RZ3{8?JcvHL^y5xm;{xF$-(cYxsz+f1(n~QY85oZ=>2VsZ z*|B5B!*98+i+FBt(PTgNh2fDbP^Kks#{Byti(=V~&Kyry>ftU@4rc>h5?ccECN?~SvV9{NplD|gqRB`G_1%| z0J`JBB!;6Vb_>@1<5+D007H_2!PC{x JWt~$(699I+gjE0l diff --git a/src/OCCViewer/resources/occ_view_camera_dump.png b/src/OCCViewer/resources/occ_view_camera_dump.png deleted file mode 100755 index b02616f2975e7a3865a236ee75380bdae5ce59f7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 682 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VXMsm#F#`j)FbFd;%$g$s6l6(v z^mSxl*w|O|J8&|PuaN8!GAr-fh{`~)M&uq%*z+h+?Aj!ZYz}<83#0idNZ{NHLm{arOf}-0Di4NZr z4h;-Rj?WrQvR=Mwyy^F?%;4dFDJdx)KR>?&vt5iYrhzo>YRaCjpLk={x^?G1e0dpc zAf2Wt^rJsV!+{}D;>9cZGar846mH{Q?tkd0S>BzF%TD3t{4*BXIQ-IfVA%M8i#s*c zlr1kVj?FMpku6S6PGNSxV@Sx9M(Gn`0zzpIgandKboIMkOJX=8&cMX6ys@Kkl!Hi5Cs~Z*GuUfUrsH3ynxPybcSy{#2e*VG@J6ax= z#n~Osp1^ImwK3)gt3rdprHAi&vk!iGdwaWNpPVI=nU9lGQ{we?u{?kG+WrXQ(cn=9 z+IG10^fX=PhwiSfjl8q1O0@zxr4<@xOt_qoo~}Mam+y-f$9#+0wuLz-jo8f1&D+fL z?z+m40n#|u4mYG61ddHVaiyUq`r4~d9q8ZdYn zozP=;ncaEPUC6S9SjZ)j11xdTOVx|PwNDx OD+W(jKbLh*2~7Z6;rO)x diff --git a/src/OCCViewer/resources/occ_view_clipping.png b/src/OCCViewer/resources/occ_view_clipping.png deleted file mode 100644 index 0356a9a319903f0f6864653fbfdb4c5e57b030c7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 809 zcmV+^1J?YBP)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ;pGibPRCwBA{Qv(y12q9a05K7xXz}93{}~w>iLx0W zfS5>h06{|m0tjp%&~`X(DF_6)Mi_`WVPePtS?#p6U<|bY0fgZ~RnUh1}2F7cOZU)=HqXSY`|D#1!;t*WN>JK06+jSK~(%>_{Q{? z;Ttmqe`op2px(V=GEnLfmN5J-mAFmr3sBt`rhg1yfJS}#|BvCrA4nzw2q3TvUo!s$ z+VmgnLPnq>Mu_X)0`W~OE(C!$&lr9IBl17Pe_#au2BwVPe;~dD2p|S%X#)!Qa3C(7 zS>p~8=m6qGScHHQHYlb3M=hFU=P$R0sjUa;1(^X5KrApDf%q5@UwFd)w+rerT&{z= z^4@Q-t8OA?fNuZ+#DJwd1i8uzIl16)Ay%~j0mOpMX0S~VObB481qdK)27ZTPVgQC( nfB<47u?qMPNvXI2K!5=NR>;YS7u$tM00000NkvXXu0mjf*2zO> diff --git a/src/OCCViewer/resources/occ_view_clipping_pressed.png b/src/OCCViewer/resources/occ_view_clipping_pressed.png deleted file mode 100644 index e38a8aa7ee31c1798621f901830915d7a2c3312e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 560 zcmV-00?+-4P)04c=%i9-MY0li5? zK~xyit&}}$6j2n0pL6bf>^O-LR_$zrXeAbcAPa(4wjwqbf)WX~Vr5991RHw^SXm1G zg{@)}h$tb2h(U-1Togo?jdAAQV=;uC5H>sF9=Ofr@|^d*=R-P6i^c>)n>?C7HOrfY zCzAv2#mb|{{|>y?TW_4;*5{4!z&Htwf$>av;4T8Vu4~{0DFhBLA=LYDAc28;2Ch0gk>~EQ*^$7T+ZX6NPhSIl0zWPAqqL#IuWlFA z5CPGExbbbX%^xtsyif$8C~KCV)|&YC&MGgni(`QcpDr_Zy332rtA~%?m(({Nz0E?# y&vI8UH3oLKuKeHnn)p7P7;t&(Bb}wiM!>&e=7IA=3Uh4$0000-v3#%^mv{$y}th4;LG>j22D2@7>_Us*Zlq_=-C#s zYEDYRj;g7RiPv=64t;PfC~RP8lGf1Cai7$<`5yCC?^YuN6BCBHJJ|L31RM&OfB!Z; z`E67C@e~Vbg@%X?o|A;imJ`U!$JxT8>BqEDi*Z^1rtpt-1)%5 zD(=8wD7g5->O#efZA>fzj?8nl(kG;7I4}sB6vS7v9qyOEFS+gNap6=2pu&m5VLxKH z1srsaNHKl3VrN&s6OglxjYB~!DW-Xy;PgZV2B6%HP5c}Z>emc9v{xiu?a;SjWa?m@ z^iIK*pQEA6NPySq&C}-FD((6X3=h8;ZQR(!$H3Il*?5Wp=x7d6_a#gX3`s1Zj8|9~ b7}*#co=2>4HtstE3}yyTS3j3^P6z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ;rb$FWRCwBA{Qv(y12q9a0I`6G?+lD6rgAd;XCy{5 zHhlmA#Dc^@mIHB63}s|w3&>x^7VEp$V z!_S{T8NPo0%wTSB4^{^=10aA{2t*_sGYc!&H9+&gF8uxbH^cX@Ux5bxVEFUvH&_hp zNhkmaASMC^p1OMBJi~90i+=rL`10u!!-sco89u&$$ME^%M~1IozA)UpbP22urU4*; z81W@+U>Ndq^YVU}wt5|dps+B*k8j@@e*E~(@bkwHhQELQGJN^`k)bg^7i72+(46}q zJpciO*M(YIT7fc>k_-*mnGENS9|s!*!oPv8y?^^ALw|iO$gn1uVITkyKn&QD3J3!Y zt1#5l`yc4!^j}9?`#%#C(;-P2+5cJwhW{mHWkKFL1H{Sb`Tzn5YousvYge$bu(Yd+ zi!(g^@BtL?iGTn8T>uOM_2*9>%K?=<1!}&AO)o$IVT2*juu`C5U1~tXo&y8^?Uyf= zSFc{}AhvJ-2p}dj!}3{~naMT`1ONgE>_SkfVWO=i2{i0E$eXW$2^NUUfQEGwYY@l` zP;LPTAh-*gnwp;TadI-eff!amiebp56hHvMT?i_^fL=}k3i1H)bfAI1NHGa!20#G8 u4Wv>5%K#8S$g%vNP}zvfo5&o100RIgKz|e1YHVKs0000aa diff --git a/src/OCCViewer/resources/occ_view_fitarea.png b/src/OCCViewer/resources/occ_view_fitarea.png deleted file mode 100755 index 450dc56c6ce722c040b4e5b77459207e8256cd58..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 912 zcmV;B18@9^P)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ<21!IgRCwBA`2YVu0|yT@j4)mLY4&S1Wi z-OcbHM57sG48)m^9-he_0f7usvT_X1pFT0(yLC(8&W#(k0Oh^{@n4u?fB<44!Y5g^ z-MvYH5s?faC;S8YMon9X!N%2{!P42~V^d*1!@s|O;pPAY5EB8zLY%$4ll;RYzy^Ww zzyAz>|Nmq7`|lrvqn8hZdq5CKT`^1pKmZXkFx1h@8)yK~5THSSfQEqa-+v50fBt0n z`uQ`1xxGC|T`bJU00BhE%bd(CtYFsw%>%pe_wU~f-@kqZ8u)|Z&#&KLF(43ts^eU0F)F)_Iu>vs%)X>*Rt^|Sq00D$yAS*L-7tFAGPoM68`t<2NpzvEDJ`2PkgPEZQ zf?W3=>e4ST{Qv>Pgyb@bC5sj@fV}w<7@K#WJlO{{>@HC171XfPKztRHl%RYNeIJNF z01K4gATvM(3qSzDi!W_$?G#}ip4rTdj11l(AtV=F=_OOZ1q?s{!3|_&WMorRR4o7X z>z4u0Wlx|ky9mWEfcQ5q!$2+r83v*O0tneaP`Ky0YCsD8wiRZ mF(6igmT$M9kwFpw2rvMsC6+#;$I7?>0000Y85oZ=>2VsZ z*|B5B!*98+i+FBt(PTgNh2fDbP^Kks#{Byti(=V~&Kyry>ftU@fIOolmwP)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZc>jKeOv$OzL15I`)*h9FA-UC3*1Z~uwm?OTSQ4<0bQ ze(?e}13&j7BtjOg8oBY{u_wj195)S?b{&f6+rwNh(Uq* zK0ZGF9!TB4fBzVey$%pSph#d!NlE$3!NI}s_3KxL7r?*=#V#=XRDg2aKr9Qy%0Mg# zwcu`6R@RnZzkY$$K7Ra|;oiM_44*%L1}7(g00Oy$^}~k`3@Z!_7=WS-7i47_^npo& z_1d*NKskL-Yy$BYAm#zl;o;#2riOWv!1Q5tTw%b52J!EBN z_zMj9Ye2(a0MpVAL405VabQDXA%mWt-g{_beh*a#GW3?PurN#?D4ah51P}|7@?T7UooaWF76FUtY(e=N8Ih<%~* zEa-Xx0ti>}^$+SLM<6zX=4AnBQUWFN&ro@cDgYqB0GrW?VpB4t`v3p{07*qoM6N<$ Eg6tg6&Hw-a diff --git a/src/OCCViewer/resources/occ_view_left.png b/src/OCCViewer/resources/occ_view_left.png deleted file mode 100755 index 1b787b0433413a7117083cefce238d0219b55484..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 427 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VXMsm#F#`j)FbFd;%$g$s6l6(v z^mSxl*w|O|J8&|PuaN8!cxAr-fh{`~)M&uq%*z_77_!_Cc2#L?H+cT&#Iy1!N(L5z>Y85oZ=>2VsZ z*|B5B!*98+i+FBt(PTgNh2fDbP^KmC#?I{d9c7Xy4CLo`8t9#9wE>E{s2+a6pwJL8 z;qV!cZhoyh-WMEl+8P-g7!Dp5xLNA`-0Tsr^OAzYKsOvY;*iQ9;1FUipwO@)Pr-p9 z@UBAx!=hb{AX~kiLciL@^}c%5zoCnnMWC&*WfBk1fh!J^FNg)$u|3iU+0>VK;-z4O zK?Bcjh9m9{ZA>fz!c%!}GcMf^WGSz(xpL`}($0V*X%ZeX3JnL?m`*#VW_(=i)HG9n z!Mzq~HYNr}7UK!hC#Ero+N((XV9k0Fp5oZRkhG*sltCbY;YM8g@#-Jb&H@9L!PC{x JWt~$(69BoFkt+ZI diff --git a/src/OCCViewer/resources/occ_view_pan.png b/src/OCCViewer/resources/occ_view_pan.png deleted file mode 100755 index ec56cacc779342a978f183ecf747860c8b6dafb4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 982 zcmV;{11bE8P)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZb!otG-18H_3W&!c>DFz52f`;Yh z=KlYG@Zf(vJw1@2;y}!e&rpB>!e<*(Vq)UoNnv3OZ?0TnIIE=v5_imOsnQ(>_Q@}D9Q|HpzmfY=u#@9*!A5&HlE#0WDiKR^HPSD@Ek zzkbaCa@oa;7a4y4{_O{p(+6UCAm#(&Px|`$DQaqJ3~X#{4Da5(V|e)RA;Yz6*FdiR z0t!=r00NsF6BF}yLQoI`!>?Zq4Bx&nFns>Zz!(z)vWNqS-$A_va>-9lVB{=URRycP zpsdWG&(6-kdhOZ^SVRE?5Q~nE&fmqMp$spM9AUWs@+E@^Q1mI#KqwFe;@8la1=_~I z2J*$jJ9ilVe*DOA?ZXF#7k~dU%-7RnNW63j9QyzP#B$}z6$wUv{}&HSOBrrFdBPyW z&(HAr=TDe{d{D#gLnA=o6)=Lf|NhPJ2I#_XKyN<>8oU@7aj@722p~`x$^o%15O2W} zQ4K(R5QwirT?%sXD=g|(05K?CodF0SP#A)o^9gFhL?B)Zjj^{zMn(Vgg6j zxpU_jK79D#4wN$jVr3vsfvN|&{yoSXfB<5F#?CWnLd}P!GmwE_`1tr3R)vHxJUVoU z;RMiI;U7Ty82F(McnHLu(3}E_l-nS400M{wntfhCo&E)yX#avZ-#{@A45MF<9x;Hz z4lSY{BV~fOP)EH02p|@y4KPE$Kyv_tjEu~^`}glN965WI;l_&>3~!m4VFpeGVn3)0 zVaeeeEFA&_5G?D#4E+fW52hzio+tt7dm^Ah;l~e#JMZ4X4D5u`pP`QU2lWw%{s$01 zxUwNTH0uR`vRkc+3M|{L0pd2OxFS>?3IGToW*i2Bk`pV``xg$qd*=yF8X#vr0J$9M zy07T20tg^xJOwPwRUpGpK{Y>y#^wX4;lH73-~b@N0A_|Q{Wj4Xb^rhX07*qoM6N<$ Ef)-GsSpWb4 diff --git a/src/OCCViewer/resources/occ_view_presets.png b/src/OCCViewer/resources/occ_view_presets.png deleted file mode 100755 index b436f946d809ea5f2331543a6d2482ba0789ced1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 545 zcmV++0^a?JP)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ-mq|oHRCwCNl)-A-KoEw%4LNKehvanvy;S4{l2g3U zQ|Kw=VcZQEoLo{?ImtE&>Y+vjlhV9O4hHEU&>jqvgKX6+x3L9<4h-6Fg?|2>nUxX| z6pB>{h+=J{W9+SifUKU`G!ua)y9+Ah<>xN|M&pFn`75Jw(!5T_iKI`d>?Wvc2PYp+ z060H8$Mg)|d%iuT0Qk~Vl*Nt?rLI{rsvX(B#r7?xXDG^o_`y;63Kkt}=)G^&$4AEi z^ezlqYYq+%(1&`vqWmtoxY)^ZYa?CkBz;T;sk`>K3>=!CAsHpy4R28j;;#;XyWuTW zS>YFct3egaq1qe|cVCN|PiBYXqW0H0eM~9Jf~u^z{CtV+Tk<03>iUZ8d$v_CQjr9L zT5I&8F1(A~Mpr+cM$P)iG}~Z+KrlLuR5s1T?|b~h2VGx%G#Cz+GyvMX-sSglIRWji zw;2eJye;Af$7DQN(gbMp|8$tob8fy^X3w+6Q9cj3lSA9Lfulch=Ng6%XF!|VH|5|LZ6HnY2DTKF00000NkvXXu0mjf48-Oy diff --git a/src/OCCViewer/resources/occ_view_reset.png b/src/OCCViewer/resources/occ_view_reset.png deleted file mode 100755 index 66f81e60471b7b587c37166a4e206b45f74e7fc2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 918 zcmV;H18Mw;P)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ<3`s;mRCwBA`2YVu0}KO!sHi9>h~bSaP6`GHAOZXQ009Iu ztVK?a_y6WCKL3CH$@>5IfA;^Iw`2aBnTdlW&7exTp@zi+u{AD30Ro7Lk&#hUNQk5Q z?D;STpjR1~nHj+nii&(-KGfwPzyqZXfLH~Ij{*P!hzW=@vvYJAfQEtvwrzdL@b~Y3 zhTx#>3=Q?CrT~SeL)CtP(l4O+3pN7*0*D2Ojg5^(!JOKflMHLu++jF%N|j;rru$QX z!I2B}0Zi>zGy}h4GY}wvKrZ|XauEp3n0^K5WhREsj&mSx69e%89{T_R1ajfcn>Rmz zIq%;60AXz)^A6B;zi?=K-}sfC-?tzTH62r z+1dZM`}+RpVPyp=a)o&VAb=Q=3jlDg;ox}n@#jy5zyJSR0p*SZ#Xz=e0L9NFXlO8m zC@V8qN=Sg!-~8}_;lk_J40EqvXW0Gtu^UimH$VWPmo_{g8)rH={0C|R3ET$aE+9^W z#_sAO0|T(@KsZfX8>D6hvI_wMh!MSr0=mcm=$i9OU0oSe`1u*u-@C_f=i^5PHYO$p zdueHgKqVyxW?=4l`t>V=_OfLRAAkK40Gja;rXL`H7_pRjAVWa`o#`Ya<56K`#Na9` ziz0vj(Y85oZ=>2VsZ z*|B5B!*98+i+FBt(PTgNh2fDbP^Kks#{Byti(=V~-rU*hZ=iRg)dnc)qI&oNgF=IZ z+e1T-)tEt-^Qz2HlD1A~(F>qKK76+Qun1m?!43yrq?2vj_HMm!+@5HB-h z14EPK3EmX%hAw#_o&BefBz>vE(*)?7Fuoo~q89ZJ6T-G@yGywqE CrHFz@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ;>`6pHRCwBA{Qv(y12R~;bm{-kpFcBXWMnWhkO2S! zh!NSqB}nm z_#K0zqZ|V(D=WjUUAu@f7$ATcKn6xcL;xu(AT|MFC6Lhn$B!BQ-@VK5ALvjZpYgx7 zwe^1|C#U~lNjw-JfZz;ORn`9w9x(jhw~yifBP`+xG}xButP{r|6^ zpz#0SKaeu^{~*hO@{?f(!3+aofB<4dk7WS?0kC9s^&AE_w@?O<^q)V#kOc;9VxlU; z?b~;NzENS&)YJs4-?V8HO4tGf5EFWs{`m1Dg_)Td7#X2pgMR&j81~}_14CcmZ3Z

_Vnz58}j`-1H-p(2n+(i@MQS?`!|ES zx;=;+j;t9VfLO2?s3j(*3Dyh@GoVI@D?x^T`SOK;2)s#xwr&D>UEJd0|XE@ z1Al$^@Qag!gA?p!NcjC^`1I*D!^e*=zzTrof(`uo^&N=&7g;kv0AVxm!p)nP>@QyI zX7KP>0Cd@Bpld$>4SWSQ@aolD3??S}49d!`4A-yk1*t!dtQjDHFbs5aa|0V@W77-F zdJn*cefjbZY~bh5AVYyp`ui6w_wwaUkd`&b`T+t6ZlIr^-+x##0LI+pFJF3c^!0s# zhP?qA1j4U@?6*KeAl|)m=P)pg|7HPG#V=$70RjjmmBTPF(TW1`G$keD|2{qy|2;iR z|J&Lo{r~WR;lH7w;eQ?;eo(@0$CmW~0tj!u1Z6QGzQNBg3e1Mm|F2(X_^+$03o^_G zmmYusVjz^+p$5wVu`v)3EF1s=2qWuJ3IGC#iGj)hAb_ZDAV7ct0CqnRZB|4ZssI20 M07*qoM6N<$f-H}K!2kdN diff --git a/src/OCCViewer/resources/occ_view_rotation_point.png b/src/OCCViewer/resources/occ_view_rotation_point.png deleted file mode 100755 index fc303e3ea1641720028b23ddcba356ec9564f733..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 858 zcmV-g1Eu_lP)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ;&`Cr=RCwBA{Qv(y12q9a05LI882|(j3n2xJjEp=$ zUwlF0Gntv0{Y6)I>eMMdAoU9%fLI6^=ETFpv=>P8f((Tjrjxc7uI9?DU>H*th+hK) z5DOl|(wrQ)X5N4Bo8ilsf1*JCH<-(i3}FzmDPVYaWCDn(4a8Rg0*D2NVIDx2&Ft+I zVKA|J1QOx_Vpb4CIdl?S-QCrB$l7Fp_%T2LF<~(*lZ}mW`_lOm3@S>j4AtdA47xh( zmw-}Je*E|WR>O5;Ha2&F!jJgz1R9!?lPNH{t5t-7lamoeE-v{6!_gC>3?d>T$g#Tx zNIeANi$Hu5Ab=P^1|nl1UT15$7oh-U)v zN+4be3JM@D1Y#FZI06I^Mx+1@1;u1BDE-;na;A0kyk~gy_z%O(DPj!jYHT1S!capw zf%qp7zXjs^Q2ZVsfEaOQJ)nUG!0 zfcQDkyOG|W+zhtPk3nM72$fC%0R(d)HxO&VybMZ*Kn%(T(<@2@|NHrHgTyKbxekN@ z0tlRJfJp>opga&808C$X-6moRSbzY68ORPz1|V-rL*<@A k6RS8-%_(9_Y=8g*0FLr@0@O3lmjD0&07*qoM6N<$f_(BtfB*mh diff --git a/src/OCCViewer/resources/occ_view_scaling.png b/src/OCCViewer/resources/occ_view_scaling.png deleted file mode 100644 index fa8cbbc71e4c929f859c045ef73c53a8e431fcad..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1128 zcmV-u1eg1XP)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ<-bqA3RCwBAWME+U&wvRS8OQ_x0R+T(>KN|dzmIO{e|!cB3JNm3fB&8lAb?mvoPYm+0}cDluw~ADhHu}# zG5q-P10*a9#BYH3JIJtY+qN;tm^=cjy$r;^{{3V)KS_(hL0F$5wapM@7}#Kd0Ad0W zfB*kt_zP6vnkd5HlO@6M{X57E1{WY!2O0Kq(sG7hzkUH-|CQm)-_H!+fcVS=4TcXN zzcZw?8ZdMu9)>wo9Uy?fF8l*D4CGyq!OJ>sgIx&(hCng7LB{F@=9M24Za_ZLW*3q(Awn8@%T`x(Ra?aB=A+%Gfy`1g(BOpOi0 z_aA>4_O4B3@RrbI`1tKD+=T!E!~zR%5M0^ykm2XgpD3>Q_vJg#t6#vb26^@8|L+W6 zz5;{jFGStfA0HULe*XYh4-h~si0Ecy2rrWdht=fCNCy7+2@H}S41fOoVfYP>yuS?p z|NUk7_xBH2{>QIx3_pK=gR2J!AQnWL_zzAO%i8aux$qmSM44 zr-1U$nf5XKV*UkJ4-h~oUS0(ZLuis=Ko-BSN{7K9>@vf?A3)cA{ljpf#f-s4+zKc= zn?d-O6~o+ZWgw+On`RgZ&3zzHiG8lwhV)*wDHLox+F@tGj!$1Ha zfKXh>$iM`4B{FDiYy=YMDR4W(X#{63lEgQF00QUbOK%r}vmPu9nu+DY6yAhlbtuLM zKv8`YAb?O@xPIaja3pYYax!pnaV3LjW@csvMn*`afszgggVh7YKx~kDaKr)g|NsC0 z4FLiO6c7#RWxn8?qGry;plQj?!1`5*p=)Ij1M?SohNcC+3{0P885-t!1Nm|ct&9B` zSidPSv@G&xVE>`W(7rr?f$f_jL+6Shh6NLLX8;7?n9NZC1cD&gPZ0f+h~E$dUv997 z^c=3o1`ZQcQc)$9g%(I*1S?!wIIfhpHy^Hq6@qo(gwI*_q|P z00M{M{=1zFpFVzL`1z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ;uSrBfRCwBAWMFV${ipVyfq{Y3f@8+V452(`t#1s! z+WvGL_|5}2@EupOvSlHoVQU0DVRhW89V8K3|lfLJ&}nHUTh>=>Rhd}VmSAO@8C z!Jx))li{5kQ1%4F6NbMKg#ZD>^8e2-7I}uZ4DT3Jfzo#wn1F&m85kLUYXOBGGrWW; z1PCCYI3v(38wP!bGYqy2%?wfu-xv-td|+T?W8i1t0_y_A8U4TeyL z+YCw!{tRIZtPDSYGoS!~0Al(Qe}jP?sF4-u(_)}29T@T$UNaOixa*)Q1PCCe-v_?D z|MCAn11Hd)^FYshV>rO@4CsphZltgQ0)PNwI{4_k)x<5Ufv(m9Vs4<@uK^W41Uk?{ zjX@9?R!{&CKrBG~?%~RQAy#Q-Aako!Dw`?8Mg~uYyZ=6lFz7IxWB3SB2oOLZg&!HN zK3@;?wkQMpve&;1d0CzSL-qEL>ue123<59{0Rjl5@E0)n{xG~^Fk}$_!nEKK1Gk2q z2p2m8I57Uf6aoYg3)sP*fnoCz=w)#RW(FPxWqxZ82EP9cZy0U?0{{vD0*D1l|6zCz zRLTJiCk_TRjwo^7H{XE1I>qqXSwTkh$!P`#fB<5K2h=}c%zb6}0#yEnKlY&r%m0&% z!s-fc-wW>~3hP^J0tg^R1`MEG7Siy6(~jXHFtGT5;qx8nr|;JQ0*K{5ilXqX7Z(K= ziZ!UEXCG$x!2X2oDCRSqb?1*)Kp#J6_yiW@WRPay00=MuP5R37E0wPP00000NkvXXu0mjf DY-mW# diff --git a/src/OCCViewer/resources/occ_view_top.png b/src/OCCViewer/resources/occ_view_top.png deleted file mode 100755 index cef95040afe84ada0bd453b6e4057004c3d75c5f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 419 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VXMsm#F#`j)FbFd;%$g$s6l6(v z^mSxl*w|O|J8&|PuaN8!Y85oZ=>2Vsp zxwF;ZMLKQCQTF62hL3y=3`vWw7|74>G|)TIY6Dc`qI&oNgF-{Zgu^^1f3h%|9d-cn z9wfeaZqBN=VpY}rhu?Bt=d|VCn$jH1r_eA%Vg(NaQ^zYdCKiFKyeu3FtE4#u974O2ZYzRgvtQ98zfuwPaa_K;WgpRWqg{f@Q+Er!RLuY+Z?$@R^}5MxE*R( zQZyVG3mdKI;Vst0Grx_ AY5)KL diff --git a/src/OCCViewer/resources/occ_view_triedre.png b/src/OCCViewer/resources/occ_view_triedre.png deleted file mode 100755 index bc5894dc380f7595ee865b43f1a94779c5aee3fa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 698 zcmV;r0!96aP)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ;FiAu~RCwBA{Qv(y12q9a05O0Jgkf}$kdQ#KZ2$qp zgirF{zkdv;PoMsO_Uv+^4F(7xoCZcjMEw8w@gqZEU?9-ozaSxbAm$=uAV2`&^D>u- ziOK&nXO{jydUWRhEnC|DLk-0X00Ib~m$_cQe$8;_4l~1#ADW1qB5eL_|aw*x6aZd?0=erEvm)0Aj%>DI_Gsz`?-* zbR`>z`;{020RjlGfvl{o3`|TQPp}c44gmrPZ#raTWP~VU!fvm(w>L)800b`7drzdCp!Z(GYbPq`|sbs7`}Y@&hY2YUj~2x zLUCbYV&Z?8VOzFr0kQ4&?CAl~%Yb+e5Vr$y4H9mTjEwx>-JJnalL1l>5I`s{w6nAO z|MKNah7~KC7>tY}O!n{ZJLBkB)B#O<-=Hy#4!EJ|6C`&XAb?N|1SXOHKY#vY0A@9Y z@83T&xVV%QBN_A%nrzSk$S^G^`x-z1p@*SnO-;=;V`Dak=g;3Vym|A9p{{PeC)BWq zIMN_22Z6wAfB-@_5R_Lz2ADvF9suzfD1JjsIs^zH^aKX-(rGALgix-)1^@yGTe3kf g1c=JRFaQu>05%EfVPBu~R{#J207*qoM6N<$g3D|Y2LJ#7 diff --git a/src/OCCViewer/resources/occ_view_zoom.png b/src/OCCViewer/resources/occ_view_zoom.png deleted file mode 100755 index 386c966d156f0a6f53e780aed211b78aa473a11b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 797 zcmV+&1LFLNP)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ;lSxEDRCwBA{Qv(y12q9a05LI882|(j3yAp6z=+{Y zPKN)C$b3dd#y}ty1;mO#{0NBG0DZR%T^~RIu^?$iH}pTm97baxo$2V|nd}h|$RH&v z$MF2=6XU&Gw*&&^{D5-Pfd(IhX#xl!22dE{!$2^nw!8QLxyR4`p9SL6kDmTN`QXX_ zWA`8bZ*#;G5q}bli};<&kW}F_F#1|4FCbe zLcl;aW)@bkYk=l~UHJR=Z-(z*zXA>X!SLtTZ?G6R8lV6mfC#zp)YS{;8GeIY^y?SH zmrtJL&@bUdShR+{AGJO5=h2iF{4FCbeh%aFS!;qhwm-oZ8)$14pg@qY@ zeEZJuHQCMa{8~Mt^J>giRqA}jO>3c z1H=E4va%p=odM!xbbSB;gf&vMwY4kQSXkOs#l;z(e)s?i_{6_||1JOqf%@|&kL7?$ zo&q&r!=@J?fH1-kXjm!Gur4*AVb6g9|Mtt5%Bxqec3{&C%ChKL6d-_@&RKiH#D= b009O7QZ{F9XF19?00000NkvXXu0mjfwM|pG diff --git a/src/PyConsole/Makefile.am b/src/PyConsole/Makefile.am deleted file mode 100755 index a32cef86f..000000000 --- a/src/PyConsole/Makefile.am +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms 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 : Vladimir Klyachin (OCN) -# Module : PyConsole -# $Header$ - -include $(top_srcdir)/adm_local/unix/make_common_starter.am - -lib_LTLIBRARIES = libPyConsole.la - -salomeinclude_HEADERS= \ - PyConsole.h \ - PyConsole_Console.h \ - PyConsole_Editor.h \ - PyConsole_Interp.h - -dist_libPyConsole_la_SOURCES= \ - PyConsole_Console.cxx \ - PyConsole_Editor.cxx \ - PyConsole_Interp.cxx - -MOC_FILES= \ - PyConsole_Editor_moc.cxx \ - PyConsole_Console_moc.cxx - -nodist_libPyConsole_la_SOURCES= $(MOC_FILES) - -nodist_salomeres_DATA= \ - PyConsole_msg_en.qm - -libPyConsole_la_CPPFLAGS= $(PYTHON_INCLUDES) $(QT_INCLUDES) \ - -I$(srcdir)/../PyInterp -I$(srcdir)/../SUIT -I$(srcdir)/../Qtx - -libPyConsole_la_LDFLAGS= $(PYTHON_LIBS) $(QT_MT_LIBS) -libPyConsole_la_LIBADD=../Qtx/libqtx.la ../SUIT/libsuit.la ../PyInterp/libPyInterp.la diff --git a/src/PyConsole/PyConsole.h b/src/PyConsole/PyConsole.h deleted file mode 100644 index d27c40c0f..000000000 --- a/src/PyConsole/PyConsole.h +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 : PyConsole.h -// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// - -#if !defined ( PYCONSOLE_H ) -#define PYCONSOLE_H - -// ======================================================== -// set dllexport type for Win platform -#ifdef WIN32 -# ifdef PYCONSOLE_EXPORTS -# define PYCONSOLE_EXPORT __declspec(dllexport) -# else -# define PYCONSOLE_EXPORT __declspec(dllimport) -# endif -#else // WIN32 -# define PYCONSOLE_EXPORT -#endif // WIN32 - -// ======================================================== -// avoid warning messages -#ifdef WIN32 -#pragma warning (disable : 4786) -#pragma warning (disable : 4251) -#endif - -#endif // PYCONSOLE_H diff --git a/src/PyConsole/PyConsole.pro b/src/PyConsole/PyConsole.pro deleted file mode 100644 index 4839a6c3d..000000000 --- a/src/PyConsole/PyConsole.pro +++ /dev/null @@ -1,41 +0,0 @@ -TEMPLATE = lib -TARGET = PyConsole -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -PYTHONVER=2.4 -PYTHONHOME=$$(PYTHONHOME) -PYTHONINC=$${PYTHONHOME}/include/python$${PYTHONVER} -PYTHONLIB=$${PYTHONHOME}/lib - -INCLUDEPATH += ../../include $${PYTHONINC} -INCLUDEPATH += ../Qtx ../SUIT ../PyInterp -unix:LIBS += -L$${PYTHONLIB} -lpython$${PYTHONVER} -win32:LIBS += /LIBPATH:$$(PYTHONLIB) -LIBS += -L../../lib -lqtx -lsuit -lPyInterp - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += PYCONSOLE_EXPORTS - -HEADERS = PyConsole.h -HEADERS += PyConsole_Console.h -HEADERS += PyConsole_Editor.h -HEADERS += PyConsole_Interp.h - -SOURCES = PyConsole_Console.cxx -SOURCES += PyConsole_Editor.cxx -SOURCES += PyConsole_Interp.cxx - -TRANSLATIONS = resources/PyConsole_msg_en.ts - -includes.files = $$HEADERS -includes.path = ../../include - -resources.files = resources/*.qm -resources.path = ../../resources - -INSTALLS += includes resources diff --git a/src/PyConsole/PyConsole_Console.cxx b/src/PyConsole/PyConsole_Console.cxx deleted file mode 100644 index 85df7307a..000000000 --- a/src/PyConsole/PyConsole_Console.cxx +++ /dev/null @@ -1,261 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 : PyConsole_Console.cxx -// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// - -/*! - \class PyConsole_Console - \brief Python console widget. -*/ - -#include "PyConsole_Interp.h" /// !!! WARNING !!! THIS INCLUDE MUST BE VERY FIRST !!! -#include "PyConsole_Console.h" -#include "PyConsole_Editor.h" - -#include - -#include -#include -#include -#include -#include -#include - -/*! - \brief Constructor. - - Creates new python console widget. - \param parent parent widget - \param interp python interpreter -*/ -PyConsole_Console::PyConsole_Console( QWidget* parent, PyConsole_Interp* interp ) -: QWidget( parent ), - myEditor( 0 ) -{ - // create python interpreter - myInterp = interp; - if ( !myInterp ) - myInterp = new PyConsole_Interp(); - - // initialize Python interpretator - myInterp->initialize(); - - // create editor console - QVBoxLayout* lay = new QVBoxLayout( this ); - lay->setMargin( 0 ); - myEditor = new PyConsole_Editor( myInterp, this ); - myEditor->viewport()->installEventFilter( this ); - lay->addWidget( myEditor ); - - createActions(); -} - -/*! - \brief Destructor. - - Does nothing for the moment. -*/ -PyConsole_Console::~PyConsole_Console() -{ -} - -/*! - \brief Execute python command in the interpreter. - \param command string with command and arguments -*/ -void PyConsole_Console::exec( const QString& command ) -{ - if ( myEditor ) - myEditor->exec( command ); -} - -/*! - \brief Execute python command in the interpreter - and wait until it is finished. - - Block execution of main application until the python command is executed. - \param command string with command and arguments -*/ -void PyConsole_Console::execAndWait( const QString& command ) -{ - if ( myEditor ) - myEditor->execAndWait( command ); -} - -/*! - \brief Get synchronous mode flag value. - - \sa setIsSync() - \return True if python console works in synchronous mode -*/ -bool PyConsole_Console::isSync() const -{ - return myEditor->isSync(); -} - -/*! - \brief Set synchronous mode flag value. - - In synhronous mode the Python commands are executed in the GUI thread - and the GUI is blocked until the command is finished. In the asynchronous - mode each Python command is executed in the separate thread that does not - block the main GUI loop. - - \param on synhronous mode flag -*/ -void PyConsole_Console::setIsSync( const bool on ) -{ - myEditor->setIsSync( on ); -} - -/*! - \brief Change the python console's font. - \param f new font -*/ -void PyConsole_Console::setFont( const QFont& f ) -{ - if( myEditor ) - myEditor->setFont( f ); -} - -/*! - \brief Get python console font. - \return current python console's font -*/ -QFont PyConsole_Console::font() const -{ - QFont res; - if( myEditor ) - res = myEditor->font(); - return res; -} - -/*! - \brief Event handler. - - Handles context menu request event. - - \param o object - \param e event - \return True if the event is processed and further processing should be stopped -*/ -bool PyConsole_Console::eventFilter( QObject* o, QEvent* e ) -{ - if ( o == myEditor->viewport() && e->type() == QEvent::ContextMenu ) - { - contextMenuRequest( (QContextMenuEvent*)e ); - return true; - } - return QWidget::eventFilter( o, e ); -} - -/*! - \brief Create the context popup menu. - - Fill in the popup menu with the commands. - - \param menu context popup menu -*/ -void PyConsole_Console::contextMenuPopup( QMenu* menu ) -{ - if ( myEditor->isReadOnly() ) - return; - - menu->addAction( myActions[CopyId] ); - menu->addAction( myActions[PasteId] ); - menu->addAction( myActions[ClearId] ); - menu->addSeparator(); - menu->addAction( myActions[SelectAllId] ); - - Qtx::simplifySeparators( menu ); - - updateActions(); -} - -/*! - \brief Set actions to be visible in the context popup menu. - - Actions, which IDs are set in \a flags parameter, will be shown in the - context popup menu. Other actions will not be shown. - - \param flags ORed together actions flags -*/ -void PyConsole_Console::setMenuActions( const int flags ) -{ - myActions[CopyId]->setVisible( flags & CopyId ); - myActions[PasteId]->setVisible( flags & PasteId ); - myActions[ClearId]->setVisible( flags & ClearId ); - myActions[SelectAllId]->setVisible( flags & SelectAllId ); -} - -/*! - \brief Get menu actions which are currently visible in the context popup menu. - \return ORed together actions flags - \sa setMenuActions() -*/ -int PyConsole_Console::menuActions() const -{ - int ret = 0; - ret = ret | ( myActions[CopyId]->isVisible() ? CopyId : 0 ); - ret = ret | ( myActions[PasteId]->isVisible() ? PasteId : 0 ); - ret = ret | ( myActions[ClearId]->isVisible() ? ClearId : 0 ); - ret = ret | ( myActions[SelectAllId]->isVisible() ? SelectAllId : 0 ); - return ret; -} - -/*! - \brief Create menu actions. - - Create context popup menu actions. -*/ -void PyConsole_Console::createActions() -{ - QAction* a = new QAction( tr( "EDIT_COPY_CMD" ), this ); - a->setStatusTip( tr( "EDIT_COPY_CMD" ) ); - connect( a, SIGNAL( triggered( bool ) ), myEditor, SLOT( copy() ) ); - myActions.insert( CopyId, a ); - - a = new QAction( tr( "EDIT_PASTE_CMD" ), this ); - a->setStatusTip( tr( "EDIT_PASTE_CMD" ) ); - connect( a, SIGNAL( triggered( bool ) ), myEditor, SLOT( paste() ) ); - myActions.insert( PasteId, a ); - - a = new QAction( tr( "EDIT_CLEAR_CMD" ), this ); - a->setStatusTip( tr( "EDIT_CLEAR_CMD" ) ); - connect( a, SIGNAL( triggered( bool ) ), myEditor, SLOT( clear() ) ); - myActions.insert( ClearId, a ); - - a = new QAction( tr( "EDIT_SELECTALL_CMD" ), this ); - a->setStatusTip( tr( "EDIT_SELECTALL_CMD" ) ); - connect( a, SIGNAL( triggered( bool ) ), myEditor, SLOT( selectAll() ) ); - myActions.insert( SelectAllId, a ); -} - -/*! - \brief Update menu actions. - - Update context popup menu action state. -*/ -void PyConsole_Console::updateActions() -{ - myActions[CopyId]->setEnabled( myEditor->textCursor().hasSelection() ); - myActions[PasteId]->setEnabled( !myEditor->isReadOnly() && !QApplication::clipboard()->text().isEmpty() ); - myActions[SelectAllId]->setEnabled( !myEditor->document()->isEmpty() ); -} diff --git a/src/PyConsole/PyConsole_Console.h b/src/PyConsole/PyConsole_Console.h deleted file mode 100644 index ed1203b83..000000000 --- a/src/PyConsole/PyConsole_Console.h +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 : PyConsole_Console.h -// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// - -#ifndef PYCONSOLE_CONSOLE_H -#define PYCONSOLE_CONSOLE_H - -#include "PyConsole.h" - -#include -#include -#include - -class PyConsole_Interp; -class PyConsole_Editor; - -class PYCONSOLE_EXPORT PyConsole_Console : public QWidget, public SUIT_PopupClient -{ - Q_OBJECT - -public: - //! Context popup menu actions flags - enum - { - CopyId = 0x01, //!< "Copy" menu action - PasteId = 0x02, //!< "Paste" menu action - ClearId = 0x04, //!< "Clear" menu action - SelectAllId = 0x08, //!< "Select All" menu action - All = CopyId | PasteId | ClearId | SelectAllId //!< all menu actions - }; - -public: - PyConsole_Console( QWidget* parent, PyConsole_Interp* interp = 0 ); - virtual ~PyConsole_Console(); - - //! \brief Get python interperter - PyConsole_Interp* getInterp() { return myInterp; } - QFont font() const; - virtual void setFont( const QFont& ); - - bool isSync() const; - void setIsSync( const bool ); - - void exec( const QString& ); - void execAndWait( const QString& ); - - virtual bool eventFilter( QObject*, QEvent* ); - - //! \brief Get popup client symbolic name - virtual QString popupClientType() const { return QString( "PyConsole" ); } - virtual void contextMenuPopup( QMenu* ); - - void setMenuActions( const int ); - int menuActions() const; - -private: - void createActions(); - void updateActions(); - -private: - PyConsole_Interp* myInterp; //!< python interpreter - PyConsole_Editor* myEditor; //!< python console editor widget - QMap myActions; //!< menu actions list -}; - -#endif // PYCONSOLE_CONSOLE_H diff --git a/src/PyConsole/PyConsole_Editor.cxx b/src/PyConsole/PyConsole_Editor.cxx deleted file mode 100644 index af69ea1fb..000000000 --- a/src/PyConsole/PyConsole_Editor.cxx +++ /dev/null @@ -1,1075 +0,0 @@ -// SALOME SALOMEGUI : implementation of desktop and GUI kernel -// -// 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 : PyConsole_Editor.cxx -// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// - -/*! - \class PyConsole_Editor - \brief Python command line interpreter front-end GUI widget. - - This class provides simple GUI interface to the Python interpreter, including basic - navigation operations, executing commands (both interactively and programmatically), - copy-paste operations, history of the commands and so on. - - Here below is the shortcut keyboard boundings used for navigation and other operations: - - : execute current command - - : clear current command - - : clear current command - - : previous command in the history - - : move cursor one row up with selection - - : move cursor one row up without selection - - : move cursor one row up with selection - - : next command in the history - - : move cursor one row down with selection - - : move cursor one row down without selection - - : move cursor one row down with selection - - : move one symbol left without selection - - : move one symbol left with selection - - : move one word left without selection - - : move one word left with selection - - : move one symbol right without selection - - : move one symbol right with selection - - : move one word right without selection - - : move one word right with selection - - : first command in the history - - : move one page up with selection - - : move one page up without selection - - : scroll one page up - - : last command in the history - - : move one page down with selection - - : move one page down without selection - - : scroll one page down - - : move to the beginning of the line without selection - - : move to the beginning of the line with selection - - : move to the very first symbol without selection - - : move to the very first symbol with selection - - : move to the end of the line without selection - - : move to the end of the line with selection - - : move to the very last symbol without selection - - : move to the very last symbol with selection - - : delete symbol before the cursor - / remove selected text and put it to the clipboard (cut) - - : delete previous word - / remove selected text and put it to the clipboard (cut) - - : delete text from the cursor to the beginning of the line - / remove selected text and put it to the clipboard (cut) - - : delete symbol after the cursor - / remove selected text and put it to the clipboard (cut) - - : delete next word - / remove selected text and put it to the clipboard (cut) - - : delete text from the cursor to the end of the line - / remove selected text and put it to the clipboard (cut) - - : copy - - : paste - - : paste - - : copy - - : cut - - : paste - - TODO: - - paste multiline text: process each line as separate command - (including mouse middle-button click pasting) - - the same for drag-n-drop of multiline text -*/ - -#include "PyConsole_Interp.h" // !!! WARNING !!! THIS INCLUDE MUST BE THE VERY FIRST !!! -#include "PyConsole_Editor.h" -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static QString READY_PROMPT = ">>> "; -static QString DOTS_PROMPT = "... "; -#define PROMPT_SIZE myPrompt.length() - -#define PRINT_EVENT 65432 - -/*! - \class ExecCommand - \brief Python command execution request. - \internal -*/ - -class ExecCommand : public PyInterp_LockRequest -{ -public: - /*! - \brief Constructor. - - Creates new python command execution request. - \param theInterp python interpreter - \param theCommand python command - \param theListener widget to get the notification messages - \param sync if True the request is processed synchronously - */ - ExecCommand( PyInterp_Interp* theInterp, - const QString& theCommand, - PyConsole_Editor* theListener, - bool sync = false ) - : PyInterp_LockRequest( theInterp, theListener, sync ), - myCommand( theCommand ), myState( PyInterp_Event::ES_OK ) - {} - -protected: - /*! - \brief Execute the python command in the interpreter and - get its execution status. - */ - virtual void execute() - { - if ( myCommand != "" ) - { - int ret = getInterp()->run( myCommand.toLatin1() ); - if ( ret < 0 ) - myState = PyInterp_Event::ES_ERROR; - else if ( ret > 0 ) - myState = PyInterp_Event::ES_INCOMPLETE; - } - } - - /*! - \brief Create and return a notification event. - \return new notification event - */ - virtual QEvent* createEvent() const - { - if ( IsSync() ) - QCoreApplication::sendPostedEvents( listener(), PRINT_EVENT ); - return new PyInterp_Event( myState, (PyInterp_Request*)this ); - } - -private: - QString myCommand; //!< Python command - int myState; //!< Python command execution status -}; - -/*! - \class PrintEvent - \brief Python command output backend event. - \internal -*/ - -class PrintEvent : public QEvent -{ -public: - /*! - \brief Constructor - \param c message text (python trace) - */ - PrintEvent( const char* c ) : QEvent( (QEvent::Type)PRINT_EVENT ), myText( c ) {} - /*! - \brief Get message - \return message text (python trace) - */ - QString text() const { return myText; } - -private: - QString myText; //!< Event message (python trace) -}; - -void staticCallback( void* data, char* c ) -{ - QApplication::postEvent( (PyConsole_Editor*)data, new PrintEvent( c ) ); -} - -/*! - \brief Constructor. - - Creates python editor window. - \param theInterp python interper - \param theParent parent widget -*/ -PyConsole_Editor::PyConsole_Editor( PyConsole_Interp* theInterp, - QWidget* theParent ) -: QTextEdit( theParent ), - myInterp( 0 ), - myCmdInHistory( -1 ), - myEventLoop( 0 ), - myIsSync( false ) -{ - QString fntSet( "" ); - QFont aFont = SUIT_Tools::stringToFont( fntSet ); - setFont( aFont ); - setUndoRedoEnabled( false ); - - myPrompt = READY_PROMPT; - setLineWrapMode( QTextEdit::WidgetWidth ); - setWordWrapMode( QTextOption::WrapAnywhere ); - setAcceptRichText( false ); - - theInterp->setvoutcb( staticCallback, this ); - theInterp->setverrcb( staticCallback, this ); - - // san - This is necessary for troubleless initialization - onPyInterpChanged( theInterp ); -} - -/*! - \brief Destructor. - - Does nothing for the moment. -*/ -PyConsole_Editor::~PyConsole_Editor() -{ -} - -/*! - \brief Get synchronous mode flag value. - - \sa setIsSync() - \return True if python console works in synchronous mode -*/ -bool PyConsole_Editor::isSync() const -{ - return myIsSync; -} - -/*! - \brief Set synchronous mode flag value. - - In synhronous mode the Python commands are executed in the GUI thread - and the GUI is blocked until the command is finished. In the asynchronous - mode each Python command is executed in the separate thread that does not - block the main GUI loop. - - \param on synhronous mode flag -*/ -void PyConsole_Editor::setIsSync( const bool on ) -{ - myIsSync = on; -} - -/*! - \brief Put the string \a str to the python editor. - \param str string to be put in the command line of the editor - \param newBlock if True, then the string is printed on a new line -*/ -void PyConsole_Editor::addText( const QString& str, - const bool newBlock ) -{ - moveCursor( QTextCursor::End ); - if ( newBlock ) - textCursor().insertBlock(); - textCursor().insertText( str ); - moveCursor( QTextCursor::End ); - ensureCursorVisible(); -} - -/*! - \brief Convenient method for executing a Python command, - as if the user typed it manually. - \param command python command to be executed -*/ -void PyConsole_Editor::exec( const QString& command ) -{ - if ( isReadOnly() ) { - // some interactive command is being executed in this editor... - // shedule the command to the queue - myQueue.push_back( command ); - return; - } - // remove last line - moveCursor( QTextCursor::End ); - moveCursor( QTextCursor::StartOfBlock, QTextCursor::KeepAnchor ); - textCursor().removeSelectedText(); - // set "ready" prompt - myPrompt = READY_PROMPT; - // clear command buffer - myCommandBuffer.truncate( 0 ); - // unset history browsing mode - myCmdInHistory = -1; - // print command line by line - QString cmd = command; - if ( !cmd.endsWith( "\n" ) ) cmd += "\n"; - QStringList lines = command.split( "\n" ); - for ( int i = 0; i < lines.size(); i++ ) { - if ( !lines[i].trimmed().isEmpty() ) - myHistory.push_back( lines[i] ); - addText( ( i == 0 ? READY_PROMPT : DOTS_PROMPT ) + lines[i], i != 0 ); - } - // set read-only mode - setReadOnly( true ); - // set busy cursor - setCursor( Qt::BusyCursor ); - - // post a request to execute Python command; - // editor will be informed via a custom event that execution has been completed - PyInterp_Dispatcher::Get()->Exec( createRequest( cmd ) ); -} - -/*! - \brief Create request to the python dispatcher for the command execution. - - \param command python command to be executed - */ -PyInterp_Request* PyConsole_Editor::createRequest( const QString& command ) -{ - return new ExecCommand( myInterp, command, this, isSync() ); -} - -/*! - \brief Execute command in the python interpreter - and wait until it is finished. - - \param command python command to be executed - */ -void PyConsole_Editor::execAndWait( const QString& command ) -{ - // already running ? - if( myEventLoop ) - return; - - // create new event loop - myEventLoop = new QEventLoop( this ); - // execute command - exec( command ); - // run event loop - myEventLoop->exec(); - // delete event loop after command is processed - delete myEventLoop; - myEventLoop = 0; -} - -/*! - \brief Process "Enter" key press event. - - Execute the command entered by the user. -*/ -void PyConsole_Editor::handleReturn() -{ - // get last line - QTextBlock par = document()->end().previous(); - if ( !par.isValid() ) return; - - // get command - QString cmd = par.text().remove( 0, PROMPT_SIZE ); - // extend the command buffer with the current command - myCommandBuffer.append( cmd ); - // add command to the history - if ( !cmd.trimmed().isEmpty() ) - myHistory.push_back( cmd ); - - // IPAL19397 - addText( "", true ); - - // set read-only mode - setReadOnly( true ); - // set busy cursor - setCursor( Qt::BusyCursor ); - - // post a request to execute Python command; - // editor will be informed via a custom event that execution has been completed - PyInterp_Dispatcher::Get()->Exec( createRequest( myCommandBuffer ) ); -} - -/*! - \brief Process drop event. - - Paste dragged text. - \param event drop event -*/ -void PyConsole_Editor::dropEvent( QDropEvent* event ) -{ - // get the initial drop position - QPoint pos = event->pos(); - QTextCursor cur = cursorForPosition( event->pos() ); - // if the position is not in the last line move it to the end of the command line - if ( cur.position() < document()->end().previous().position() + PROMPT_SIZE ) { - moveCursor( QTextCursor::End ); - pos = cursorRect().center(); - } - // create new drop event and use it instead of the original - QDropEvent de( pos, - event->possibleActions(), - event->mimeData(), - event->mouseButtons(), - event->keyboardModifiers(), - event->type() ); - QTextEdit::dropEvent( &de ); - // accept the original event - event->acceptProposedAction(); -} - -/*! - \brief Process mouse button release event. - - Left mouse button: copy selection to the clipboard. - Middle mouse button: paste clipboard's contents. - \param event mouse event -*/ -void PyConsole_Editor::mouseReleaseEvent( QMouseEvent* event ) -{ - if ( event->button() == Qt::LeftButton ) { - QTextEdit::mouseReleaseEvent( event ); - copy(); - } - else if ( event->button() == Qt::MidButton ) { - QString text; - if ( QApplication::clipboard()->supportsSelection() ) - text = QApplication::clipboard()->text( QClipboard::Selection ); - if ( text.isEmpty() ) - text = QApplication::clipboard()->text( QClipboard::Clipboard ); - QTextCursor cur = cursorForPosition( event->pos() ); - // if the position is not in the last line move it to the end of the command line - if ( cur.position() < document()->end().previous().position() + PROMPT_SIZE ) { - moveCursor( QTextCursor::End ); - } - else { - setTextCursor( cur ); - } - textCursor().clearSelection(); - textCursor().insertText( text ); - } - else { - QTextEdit::mouseReleaseEvent( event ); - } -} - -/*! - \brief Check if the string is command. - - Return True if the string \a str is likely to be the command - (i.e. it is started from the '>>>' or '...'). - \param str string to be checked -*/ -bool PyConsole_Editor::isCommand( const QString& str ) const -{ - return str.startsWith( READY_PROMPT ) || str.startsWith( DOTS_PROMPT ); -} - -/*! - \brief Handle keyboard event. - - Implement navigation, history browsing, copy/paste and other common - operations. - \param event keyboard event -*/ -void PyConsole_Editor::keyPressEvent( QKeyEvent* event ) -{ - // get cursor position - QTextCursor cur = textCursor(); - int curLine = cur.blockNumber(); - int curCol = cur.columnNumber(); - - // get last edited line - int endLine = document()->blockCount()-1; - - // get pressed key code - int aKey = event->key(); - - // check if is pressed - bool ctrlPressed = event->modifiers() & Qt::ControlModifier; - // check if is pressed - bool shftPressed = event->modifiers() & Qt::ShiftModifier; - - if ( aKey == Qt::Key_Escape || ctrlPressed && aKey == -1 ) { - // process + key-binding and key: clear current command - myCommandBuffer.truncate( 0 ); - myPrompt = READY_PROMPT; - addText( myPrompt, true ); - horizontalScrollBar()->setValue( horizontalScrollBar()->minimum() ); - return; - } - else if ( ctrlPressed && aKey == Qt::Key_C ) { - // process + key-binding : copy - copy(); - return; - } - else if ( ctrlPressed && aKey == Qt::Key_X ) { - // process + key-binding : cut - cut(); - return; - } - else if ( ctrlPressed && aKey == Qt::Key_V ) { - // process + key-binding : paste - paste(); - return; - } - - // check for printed key - aKey = ( aKey < Qt::Key_Space || aKey > Qt::Key_ydiaeresis ) ? aKey : 0; - - switch ( aKey ) { - case 0 : - // any printed key: just print it - { - if ( curLine < endLine || curCol < PROMPT_SIZE ) { - moveCursor( QTextCursor::End ); - } - QTextEdit::keyPressEvent( event ); - break; - } - case Qt::Key_Return: - case Qt::Key_Enter: - // key: process the current command - { - handleReturn(); - break; - } - case Qt::Key_Up: - // arrow key: process as follows: - // - without , modifiers: previous command in history - // - with modifier key pressed: move cursor one row up without selection - // - with modifier key pressed: move cursor one row up with selection - // - with + modifier keys pressed: scroll one row up - { - if ( ctrlPressed && shftPressed ) { - int value = verticalScrollBar()->value(); - int spacing = fontMetrics().lineSpacing(); - verticalScrollBar()->setValue( value > spacing ? value-spacing : 0 ); - } - else if ( shftPressed || ctrlPressed ) { - if ( curLine > 0 ) - moveCursor( QTextCursor::Up, - shftPressed ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor ); - } - else { - if ( myCmdInHistory < 0 && myHistory.count() > 0 ) { - // set history browsing mode - myCmdInHistory = myHistory.count(); - // remember current command - QTextBlock par = document()->end().previous(); - myCurrentCommand = par.text().remove( 0, PROMPT_SIZE ); - } - if ( myCmdInHistory > 0 ) { - myCmdInHistory--; - // get previous command in the history - QString previousCommand = myHistory.at( myCmdInHistory ); - // print previous command - moveCursor( QTextCursor::End ); - moveCursor( QTextCursor::StartOfBlock, QTextCursor::KeepAnchor ); - textCursor().removeSelectedText(); - addText( myPrompt + previousCommand ); - // move cursor to the end - moveCursor( QTextCursor::End ); - } - } - break; - } - case Qt::Key_Down: - // arrow key: process as follows: - // - without , modifiers: next command in history - // - with modifier key pressed: move cursor one row down without selection - // - with modifier key pressed: move cursor one row down with selection - // - with + modifier keys pressed: scroll one row down - { - if ( ctrlPressed && shftPressed ) { - int value = verticalScrollBar()->value(); - int maxval = verticalScrollBar()->maximum(); - int spacing = fontMetrics().lineSpacing(); - verticalScrollBar()->setValue( value+spacing < maxval ? value+spacing : maxval ); - } - else if ( shftPressed || ctrlPressed) { - if ( curLine < endLine ) - moveCursor( QTextCursor::Down, - shftPressed ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor ); - } - else { - if ( myCmdInHistory >= 0 ) { - // get next command in the history - myCmdInHistory++; - QString nextCommand; - if ( myCmdInHistory < myHistory.count() ) { - // next command in history - nextCommand = myHistory.at( myCmdInHistory ); - } - else { - // end of history is reached - // last printed command - nextCommand = myCurrentCommand; - // unset history browsing mode - myCmdInHistory = -1; - } - // print next or current command - moveCursor( QTextCursor::End ); - moveCursor( QTextCursor::StartOfBlock, QTextCursor::KeepAnchor ); - textCursor().removeSelectedText(); - addText( myPrompt + nextCommand ); - // move cursor to the end - moveCursor( QTextCursor::End ); - } - } - break; - } - case Qt::Key_Left: - // arrow key: process as follows: - // - without , modifiers: move one symbol left (taking into account prompt) - // - with modifier key pressed: move one word left (taking into account prompt) - // - with modifier key pressed: move one symbol left with selection - // - with + modifier keys pressed: move one word left with selection - { - QString txt = textCursor().block().text(); - if ( !shftPressed && isCommand( txt ) && curCol <= PROMPT_SIZE ) { - moveCursor( QTextCursor::Up ); - moveCursor( QTextCursor::EndOfBlock ); - } - else { - QTextEdit::keyPressEvent( event ); - } - break; - } - case Qt::Key_Right: - // arrow key: process as follows: - // - without , modifiers: move one symbol right (taking into account prompt) - // - with modifier key pressed: move one word right (taking into account prompt) - // - with modifier key pressed: move one symbol right with selection - // - with + modifier keys pressed: move one word right with selection - { - QString txt = textCursor().block().text(); - if ( !shftPressed ) { - if ( curCol < txt.length() ) { - if ( isCommand( txt ) && curCol < PROMPT_SIZE ) { - cur.setPosition( cur.block().position() + PROMPT_SIZE ); - setTextCursor( cur ); - break; - } - } - else { - if ( curLine < endLine && isCommand( textCursor().block().next().text() ) ) { - cur.setPosition( cur.position() + PROMPT_SIZE+1 ); - setTextCursor( cur ); - horizontalScrollBar()->setValue( horizontalScrollBar()->minimum() ); - break; - } - } - } - QTextEdit::keyPressEvent( event ); - break; - } - case Qt::Key_PageUp: - // key: process as follows: - // - without , modifiers: first command in history - // - with modifier key pressed: move cursor one page up without selection - // - with modifier key pressed: move cursor one page up with selection - // - with + modifier keys pressed: scroll one page up - { - if ( ctrlPressed && shftPressed ) { - verticalScrollBar()->triggerAction(QAbstractSlider::SliderPageStepSub); - } - else if ( shftPressed || ctrlPressed ) { - bool moved = false; - qreal lastY = cursorRect( cur ).top(); - qreal distance = 0; - // move using movePosition to keep the cursor's x - do { - qreal y = cursorRect( cur ).top(); - distance += qAbs( y - lastY ); - lastY = y; - moved = cur.movePosition( QTextCursor::Up, - shftPressed ? QTextCursor::KeepAnchor : - QTextCursor::MoveAnchor ); - } while ( moved && distance < viewport()->height() ); - if ( moved ) { - cur.movePosition( QTextCursor::Down, - shftPressed ? QTextCursor::KeepAnchor : - QTextCursor::MoveAnchor ); - verticalScrollBar()->triggerAction( QAbstractSlider::SliderPageStepSub ); - } - setTextCursor( cur ); - } - else { - if ( myCmdInHistory < 0 && myHistory.count() > 0 ) { - // set history browsing mode - myCmdInHistory = myHistory.count(); - // remember current command - QTextBlock par = document()->end().previous(); - myCurrentCommand = par.text().remove( 0, PROMPT_SIZE ); - } - if ( myCmdInHistory > 0 ) { - myCmdInHistory = 0; - // get very first command in the history - QString firstCommand = myHistory.at( myCmdInHistory ); - // print first command - moveCursor( QTextCursor::End ); - moveCursor( QTextCursor::StartOfBlock, QTextCursor::KeepAnchor ); - textCursor().removeSelectedText(); - addText( myPrompt + firstCommand ); - // move cursor to the end - moveCursor( QTextCursor::End ); - } - } - break; - } - case Qt::Key_PageDown: - // key: process as follows: - // - without , modifiers: last command in history - // - with modifier key pressed: move cursor one page down without selection - // - with modifier key pressed: move cursor one page down with selection - // - with + modifier keys pressed: scroll one page down - { - if ( ctrlPressed && shftPressed ) { - verticalScrollBar()->triggerAction(QAbstractSlider::SliderPageStepAdd); - } - else if ( shftPressed || ctrlPressed ) { - bool moved = false; - qreal lastY = cursorRect( cur ).top(); - qreal distance = 0; - // move using movePosition to keep the cursor's x - do { - qreal y = cursorRect( cur ).top(); - distance += qAbs( y - lastY ); - lastY = y; - moved = cur.movePosition( QTextCursor::Down, - shftPressed ? QTextCursor::KeepAnchor : - QTextCursor::MoveAnchor ); - } while ( moved && distance < viewport()->height() ); - if ( moved ) { - cur.movePosition( QTextCursor::Up, - shftPressed ? QTextCursor::KeepAnchor : - QTextCursor::MoveAnchor ); - verticalScrollBar()->triggerAction( QAbstractSlider::SliderPageStepSub ); - } - setTextCursor( cur ); - } - else { - if ( myCmdInHistory >= 0 ) { - // unset history browsing mode - myCmdInHistory = -1; - // print current command - moveCursor( QTextCursor::End ); - moveCursor( QTextCursor::StartOfBlock, QTextCursor::KeepAnchor ); - textCursor().removeSelectedText(); - addText( myPrompt + myCurrentCommand ); - // move cursor to the end - moveCursor( QTextCursor::End ); - } - } - break; - } - case Qt::Key_Home: - // key: process as follows: - // - without , modifiers: move cursor to the beginning of the current line without selection - // - with modifier key pressed: move cursor to the very first symbol without selection - // - with modifier key pressed: move cursor to the beginning of the current line with selection - // - with + modifier keys pressed: move cursor to the very first symbol with selection - { - if ( ctrlPressed ) { - moveCursor( QTextCursor::Start, - shftPressed ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor ); - } - else { - QString txt = textCursor().block().text(); - if ( isCommand( txt ) ) { - if ( shftPressed ) { - if ( curCol > PROMPT_SIZE ) { - cur.movePosition( QTextCursor::StartOfLine, QTextCursor::KeepAnchor ); - cur.movePosition( QTextCursor::Right, QTextCursor::KeepAnchor, PROMPT_SIZE ); - } - } - else { - cur.movePosition( QTextCursor::StartOfLine ); - cur.movePosition( QTextCursor::Right, QTextCursor::MoveAnchor, PROMPT_SIZE ); - } - setTextCursor( cur ); - } - else { - moveCursor( QTextCursor::StartOfBlock, - shftPressed ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor ); - } - horizontalScrollBar()->setValue( horizontalScrollBar()->minimum() ); - } - break; - } - case Qt::Key_End: - // key: process as follows: - // - without , modifiers: move cursor to the end of the current line without selection - // - with modifier key pressed: move cursor to the very last symbol without selection - // - with modifier key pressed: move cursor to the end of the current line with selection - // - with + modifier keys pressed: move cursor to the very last symbol with selection - { - moveCursor( ctrlPressed ? QTextCursor::End : QTextCursor::EndOfBlock, - shftPressed ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor ); - break; - } - case Qt::Key_Backspace : - // key: process as follows - // - without any modifiers : delete symbol before the cursor / selection (taking into account prompt) - // - with modifier key pressed: delete previous word - // - with modifier key pressed: delete text from the cursor to the line beginning - // works only for last (command) line - { - if ( cur.hasSelection() ) { - cut(); - } - else if ( cur.position() > document()->end().previous().position() + PROMPT_SIZE ) { - if ( shftPressed ) { - moveCursor( QTextCursor::PreviousWord, QTextCursor::KeepAnchor ); - textCursor().removeSelectedText(); - } - else if ( ctrlPressed ) { - cur.setPosition( document()->end().previous().position() + PROMPT_SIZE, - QTextCursor::KeepAnchor ); - setTextCursor( cur ); - textCursor().removeSelectedText(); - } - else { - QTextEdit::keyPressEvent( event ); - } - } - else { - cur.setPosition( document()->end().previous().position() + PROMPT_SIZE ); - setTextCursor( cur ); - horizontalScrollBar()->setValue( horizontalScrollBar()->minimum() ); - } - break; - } - case Qt::Key_Delete : - // key: process as follows - // - without any modifiers : delete symbol after the cursor / selection (taking into account prompt) - // - with modifier key pressed: delete next word - // - with modifier key pressed: delete text from the cursor to the end of line - // works only for last (command) line - { - if ( cur.hasSelection() ) { - cut(); - } - else if ( cur.position() > document()->end().previous().position() + PROMPT_SIZE-1 ) { - if ( shftPressed ) { - moveCursor( QTextCursor::NextWord, QTextCursor::KeepAnchor ); - textCursor().removeSelectedText(); - } - else if ( ctrlPressed ) { - moveCursor( QTextCursor::EndOfBlock, QTextCursor::KeepAnchor ); - textCursor().removeSelectedText(); - } - else { - QTextEdit::keyPressEvent( event ); - } - } - else { - cur.setPosition( document()->end().previous().position() + PROMPT_SIZE ); - setTextCursor( cur ); - horizontalScrollBar()->setValue( horizontalScrollBar()->minimum() ); - } - break; - } - case Qt::Key_Insert : - // key: process as follows - // - with modifier key pressed: copy() - // - with modifier key pressed: paste() to the command line - { - if ( ctrlPressed ) { - copy(); - } - else if ( shftPressed ) { - paste(); - } - else - QTextEdit::keyPressEvent( event ); - break; - } - } -} - -/*! - \brief Handle notification event coming from Python dispatcher. - \param event notification event -*/ -void PyConsole_Editor::customEvent( QEvent* event ) -{ - switch( event->type() ) - { - case PRINT_EVENT: - { - PrintEvent* pe=(PrintEvent*)event; - addText( pe->text() ); - return; - } - case PyInterp_Event::ES_OK: - case PyInterp_Event::ES_ERROR: - { - // clear command buffer - myCommandBuffer.truncate( 0 ); - // add caret return line if necessary - QTextBlock par = document()->end().previous(); - QString txt = par.text(); - txt.truncate( txt.length() - 1 ); - // IPAL19397 : addText moved to handleReturn() method - //if ( !txt.isEmpty() ) - // addText( "", true ); - // set "ready" prompt - myPrompt = READY_PROMPT; - addText( myPrompt ); - // unset busy cursor - unsetCursor(); - // stop event loop (if running) - if ( myEventLoop ) - myEventLoop->exit(); - break; - } - case PyInterp_Event::ES_INCOMPLETE: - { - // extend command buffer (multi-line command) - myCommandBuffer.append( "\n" ); - // add caret return line if necessary - QTextBlock par = document()->end().previous(); - QString txt = par.text(); - txt.truncate( txt.length() - 1 ); - // IPAL19397 : addText moved to handleReturn() method - //if ( !txt.isEmpty() ) - // addText( "", true ); - // set "dot" prompt - myPrompt = DOTS_PROMPT; - addText( myPrompt/*, true*/ ); // IPAL19397 - // unset busy cursor - unsetCursor(); - // stop event loop (if running) - if ( myEventLoop ) - myEventLoop->exit(); - break; - } - default: - QTextEdit::customEvent( event ); - } - - // unset read-only state - setReadOnly( false ); - // unset history browsing mode - myCmdInHistory = -1; - - if ( (int)event->type() == (int)PyInterp_Event::ES_OK && myQueue.count() > 0 ) - { - // process the next sheduled command from the queue (if there is any) - QString nextcmd = myQueue[0]; - myQueue.pop_front(); - exec( nextcmd ); - } -} - -/*! - \brief Handle Python interpreter change. - - Perform initialization actions if the interpreter is changed. - \param interp python interpreter is being set -*/ -void PyConsole_Editor::onPyInterpChanged( PyConsole_Interp* interp ) -{ - if ( myInterp != interp - // Force read-only state and wait cursor when myInterp is NULL - || !myInterp ) { - myInterp = interp; - if ( myInterp ) { - // print banner - myBanner = myInterp->getbanner().c_str(); - addText( myBanner ); - // clear command buffer - myCommandBuffer.truncate(0); - // unset read-only state - setReadOnly( false ); - // unset history browsing mode - myCmdInHistory = -1; - // add prompt - addText( myPrompt ); - // unset busy cursor - viewport()->unsetCursor(); - // stop event loop (if running) - if( myEventLoop) - myEventLoop->exit(); - } - else { - // clear contents - clear(); - // set read-only state - setReadOnly( true ); - // set busy cursor - setCursor( Qt::WaitCursor ); - } - } -} - -/*! - \brief "Copy" operation. - - Reimplemented from Qt. - Warning! In Qt4 this method is not virtual. - */ -void PyConsole_Editor::cut() -{ - QTextCursor cur = textCursor(); - if ( cur.hasSelection() ) { - QApplication::clipboard()->setText( cur.selectedText() ); - int startSelection = cur.selectionStart(); - if ( startSelection < document()->end().previous().position() + PROMPT_SIZE ) - startSelection = document()->end().previous().position() + PROMPT_SIZE; - int endSelection = cur.selectionEnd(); - if ( endSelection < document()->end().previous().position() + PROMPT_SIZE ) - endSelection = document()->end().previous().position() + PROMPT_SIZE; - cur.setPosition( startSelection ); - cur.setPosition( endSelection, QTextCursor::KeepAnchor ); - horizontalScrollBar()->setValue( horizontalScrollBar()->minimum() ); - setTextCursor( cur ); - textCursor().removeSelectedText(); - } -} - -/*! - \brief "Paste" operation. - - Reimplemented from Qt. - Warning! In Qt4 this method is not virtual. - */ -void PyConsole_Editor::paste() -{ - QTextCursor cur = textCursor(); - if ( cur.hasSelection() ) { - int startSelection = cur.selectionStart(); - if ( startSelection < document()->end().previous().position() + PROMPT_SIZE ) - startSelection = document()->end().previous().position() + PROMPT_SIZE; - int endSelection = cur.selectionEnd(); - if ( endSelection < document()->end().previous().position() + PROMPT_SIZE ) - endSelection = document()->end().previous().position() + PROMPT_SIZE; - cur.setPosition( startSelection ); - cur.setPosition( endSelection, QTextCursor::KeepAnchor ); - horizontalScrollBar()->setValue( horizontalScrollBar()->minimum() ); - setTextCursor( cur ); - textCursor().removeSelectedText(); - } - if ( textCursor().position() < document()->end().previous().position() + PROMPT_SIZE ) - moveCursor( QTextCursor::End ); - QTextEdit::paste(); -} - -/*! - \brief "Clear" operation. - - Reimplemented from Qt. - Warning! In Qt4 this method is not virtual. - */ -void PyConsole_Editor::clear() -{ - QTextEdit::clear(); - addText( myBanner ); - myPrompt = READY_PROMPT; - addText( myPrompt ); -} diff --git a/src/PyConsole/PyConsole_Editor.h b/src/PyConsole/PyConsole_Editor.h deleted file mode 100644 index 222708c6e..000000000 --- a/src/PyConsole/PyConsole_Editor.h +++ /dev/null @@ -1,83 +0,0 @@ -// SALOME SALOMEGUI : implementation of desktop and GUI kernel -// -// 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 : PyConsole_Editor.h -// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// - -#ifndef PYCONSOLE_EDITOR_H -#define PYCONSOLE_EDITOR_H - -#include "PyConsole.h" - -#include - -class PyConsole_Interp; -class PyInterp_Request; -class QEventLoop; - -class PYCONSOLE_EXPORT PyConsole_Editor : public QTextEdit -{ - Q_OBJECT; - -public: - PyConsole_Editor( PyConsole_Interp* theInterp, QWidget *theParent = 0 ); - ~PyConsole_Editor(); - - virtual void addText( const QString& str, const bool newBlock = false ); - bool isCommand( const QString& str ) const; - - virtual void exec( const QString& command ); - void execAndWait( const QString& command ); - - bool isSync() const; - void setIsSync( const bool ); - -protected: - virtual void dropEvent( QDropEvent* event ); - virtual void mouseReleaseEvent( QMouseEvent* event ); - virtual void keyPressEvent ( QKeyEvent* event); - virtual void customEvent( QEvent* event); - - virtual PyInterp_Request* createRequest( const QString& ); - -public slots: - void cut(); - void paste(); - void clear(); - void handleReturn(); - void onPyInterpChanged( PyConsole_Interp* ); - -private: - PyConsole_Interp* myInterp; //!< python interpreter - - QString myCommandBuffer; //!< python comman buffer - QString myCurrentCommand; //!< currently being printed command - QString myPrompt; //!< current command line prompt - int myCmdInHistory; //!< current history command index - QStringList myHistory; //!< commands history buffer - QEventLoop* myEventLoop; //!< internal event loop - QString myBanner; //!< current banner - QStringList myQueue; //!< python commands queue - bool myIsSync; //!< synchronous mode flag -}; - -#endif // PYCONSOLE_EDITOR_H diff --git a/src/PyConsole/PyConsole_Interp.cxx b/src/PyConsole/PyConsole_Interp.cxx deleted file mode 100644 index 003d59f39..000000000 --- a/src/PyConsole/PyConsole_Interp.cxx +++ /dev/null @@ -1,140 +0,0 @@ -// SALOME SALOMEGUI : implementation of desktop and GUI kernel -// -// 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 : PyConsole_Interp.cxx -// Author : Nicolas REJNERI -// Module : SALOME - -#include "PyConsole_Interp.h" - -/*! - \class PyConsole_Interp - \brief Python interpreter to be embedded to the SALOME study's GUI. - - Python interpreter is created one per SALOME study. - - Call initialize method defined in the base class PyInterp_Interp, - to intialize interpreter after instance creation. - - The method initialize() calls virtuals methods - - initPython() to initialize global Python interpreter - - initState() to initialize embedded interpreter state - - initContext() to initialize interpreter internal context - - initRun() to prepare interpreter for running commands - - /EDF-CCAR/ - When SALOME uses multi Python interpreter feature, - every study has its own interpreter and thread state (_tstate = Py_NewInterpreter()). - This is fine because every study has its own modules (sys.modules) stdout and stderr. - - But some Python modules must be imported only once. In multi interpreter - context Python modules (*.py) are imported several times. - For example, the PyQt module must be imported only once because - it registers classes in a C module. - - It's quite the same with omniorb modules (internals and generated with omniidl). - - This problem is handled with "shared modules" defined in salome_shared_modules.py. - These "shared modules" are imported only once and only copied in all - the other interpreters. - - But it's not the only problem. Every interpreter has its own - __builtin__ module. That's fine but if we have copied some modules - and imported others problems may arise with operations that are not allowed - in restricted execution environment. So we must impose that all interpreters - have identical __builtin__ module. -*/ - -/*! - \brief Constructor. - - Creates new python interpreter. -*/ -PyConsole_Interp::PyConsole_Interp(): PyInterp_Interp() -{ -} - -/*! - \brief Destructor. - - Does nothing for the moment. -*/ -PyConsole_Interp::~PyConsole_Interp() -{ -} - -/*! - \brief Initialize internal Python interpreter state. - \return \c true on success -*/ -bool PyConsole_Interp::initState() -{ - // The GIL is acquired and will be held on initState output - // It is the caller responsability to release the lock if needed - PyEval_AcquireLock(); - _tstate = Py_NewInterpreter(); // create an interpreter and save current state - PySys_SetArgv(PyInterp_Interp::_argc,PyInterp_Interp::_argv); // initialize sys.argv - - if(!builtinmodule) // PAL18041: deepcopy function don't work in Salome - { - //builtinmodule is static member of PyInterp class - //If it is not NULL (initialized to the builtin module of the main interpreter - //all the sub interpreters will have the same builtin - //_interp is a static member and is the main interpreter - //The first time we initialized it to the builtin of main interpreter - builtinmodule=PyDict_GetItemString(_interp->modules, "__builtin__"); - } - - //If builtinmodule has been initialized all the sub interpreters - // will have the same __builtin__ module - if(builtinmodule){ - PyObject *m = PyImport_GetModuleDict(); - PyDict_SetItemString(m, "__builtin__", builtinmodule); - _tstate->interp->builtins = PyModule_GetDict(builtinmodule); - Py_INCREF(_tstate->interp->builtins); - } - PyEval_ReleaseThread(_tstate); - return true; -} - -/*! - \brief Initialize python interpeter context. - - The GIL is assumed to be held. - It is the caller responsability caller to acquire the GIL. - It will still be held on initContext() exit. - - \return \c true on success -*/ -bool PyConsole_Interp::initContext() -{ - PyObject *m = PyImport_AddModule("__main__"); // interpreter main module (module context) - if(!m){ - PyErr_Print(); - return false; - } - _g = PyModule_GetDict(m); // get interpreter dictionnary context - - if(builtinmodule){ - PyDict_SetItemString(_g, "__builtins__", builtinmodule); // assign singleton __builtin__ module - } - return true; -} diff --git a/src/PyConsole/PyConsole_Interp.h b/src/PyConsole/PyConsole_Interp.h deleted file mode 100644 index 5e0b1f645..000000000 --- a/src/PyConsole/PyConsole_Interp.h +++ /dev/null @@ -1,44 +0,0 @@ -// SALOME SALOMEGUI : implementation of desktop and GUI kernel -// -// 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 : PyConsole_Interp.h -// Author : Nicolas REJNERI -// Module : SALOME - -#ifndef PYCONSOLE_INTERP_H -#define PYCONSOLE_INTERP_H - -#include "PyConsole.h" - -#include /// !!! WARNING !!! THIS INCLUDE MUST BE VERY FIRST !!! - -class PYCONSOLE_EXPORT PyConsole_Interp : public PyInterp_Interp -{ -public: - PyConsole_Interp(); - ~PyConsole_Interp(); - -protected: - virtual bool initState(); - virtual bool initContext(); -}; - -#endif // PYCONSOLE_INTERP_H diff --git a/src/PyConsole/resources/PyConsole_msg_en.ts b/src/PyConsole/resources/PyConsole_msg_en.ts deleted file mode 100644 index 408dd78ed..000000000 --- a/src/PyConsole/resources/PyConsole_msg_en.ts +++ /dev/null @@ -1,26 +0,0 @@ - - - - PyConsole_Console - - - EDIT_COPY_CMD - &Copy - - - - EDIT_PASTE_CMD - &Paste - - - - EDIT_CLEAR_CMD - Clea&r - - - - EDIT_SELECTALL_CMD - Select &All - - - diff --git a/src/PyInterp/Makefile.am b/src/PyInterp/Makefile.am deleted file mode 100755 index c601b310d..000000000 --- a/src/PyInterp/Makefile.am +++ /dev/null @@ -1,44 +0,0 @@ -# SALOME PyInterp : implementation of base thread-safe Python services -# -# Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms 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 -# Module : SALOME - -include $(top_srcdir)/adm_local/unix/make_common_starter.am - -lib_LTLIBRARIES = libPyInterp.la - -salomeinclude_HEADERS= \ - PyInterp.h \ - PyInterp_Interp.h \ - PyInterp_Dispatcher.h - -dist_libPyInterp_la_SOURCES= \ - PyInterp_Interp.cxx \ - PyInterp_Dispatcher.cxx - -MOC_FILES= PyInterp_Watcher_moc.cxx -nodist_libPyInterp_la_SOURCES= $(MOC_FILES) - -libPyInterp_la_CPPFLAGS= $(PYTHON_INCLUDES) $(QT_INCLUDES) \ - -I$(srcdir)/../Event -libPyInterp_la_LDFLAGS= $(PYTHON_LIBS) $(QT_MT_LIBS) ../Event/libEvent.la diff --git a/src/PyInterp/PyInterp.h b/src/PyInterp/PyInterp.h deleted file mode 100755 index eab58424e..000000000 --- a/src/PyInterp/PyInterp.h +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 : PyInterp.h -// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// - -#if !defined ( PYINTERP_H ) -#define PYINTERP_H - -// ======================================================== -// set dllexport type for Win platform -#ifdef WIN32 -# ifdef PYINTERP_EXPORTS -# define PYINTERP_EXPORT __declspec(dllexport) -# else -# define PYINTERP_EXPORT __declspec(dllimport) -# endif -#else // WIN32 -# define PYINTERP_EXPORT -#endif // WIN32 - -// ======================================================== -// little trick - if we do not have debug python libraries -#ifdef _DEBUG - #ifndef HAVE_DEBUG_PYTHON - #undef _DEBUG - #endif -#endif - -#include - -#ifdef _DEBUG - #ifndef HAVE_DEBUG_PYTHON - #define _DEBUG - #endif -#endif - -// ======================================================== -// avoid warning messages -#ifdef WIN32 -#pragma warning (disable : 4786) -#pragma warning (disable : 4251) -#endif - -#endif // PYINTERP_H diff --git a/src/PyInterp/PyInterp.pro b/src/PyInterp/PyInterp.pro deleted file mode 100644 index 4c35c06ae..000000000 --- a/src/PyInterp/PyInterp.pro +++ /dev/null @@ -1,33 +0,0 @@ -TEMPLATE = lib -TARGET = PyInterp -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -PYTHONVER=2.4 -PYTHONHOME=$$(PYTHONHOME) -PYTHONINC=$${PYTHONHOME}/include/python$${PYTHONVER} -PYTHONLIB=$${PYTHONHOME}/lib - -INCLUDEPATH += ../../include $${PYTHONINC} -unix:LIBS += -L$${PYTHONLIB} -lpython$${PYTHONVER} -win32:LIBS += /LIBPATH:$${PYTHONLIB} - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += PYINTERP_EXPORTS - -HEADERS = PyInterp.h -HEADERS += PyInterp_Dispatcher.h -HEADERS += PyInterp_Watcher.h -HEADERS += PyInterp_Interp.h - -SOURCES = PyInterp_Dispatcher.cxx -SOURCES += PyInterp_Interp.cxx - -includes.files = $$HEADERS -includes.path = ../../include - -INSTALLS += includes diff --git a/src/PyInterp/PyInterp_Dispatcher.cxx b/src/PyInterp/PyInterp_Dispatcher.cxx deleted file mode 100755 index 2fbda19ee..000000000 --- a/src/PyInterp/PyInterp_Dispatcher.cxx +++ /dev/null @@ -1,232 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 : PyInterp_Dispatcher.cxx -// Author : Sergey ANIKIN, OCC -// Module : GUI - -#include "PyInterp_Dispatcher.h" // !!! WARNING !!! THIS INCLUDE MUST BE THE VERY FIRST !!! -#include "PyInterp_Interp.h" -#include "PyInterp_Watcher.h" -#include - -#include -#include - -class PyInterp_ExecuteEvent: public SALOME_Event -{ -public: - PyInterp_Request* myRequest; - PyInterp_ExecuteEvent( PyInterp_Request* r ) - : myRequest( r ) {} - virtual void Execute() - { - myRequest->execute(); - } -}; - -using namespace std; - -PyInterp_Dispatcher* PyInterp_Dispatcher::myInstance = 0; - -void PyInterp_Request::process() -{ - safeExecute(); - - bool isSync = IsSync(); - - if ( !isSync ) - myMutex.lock(); - - if ( listener() ) - processEvent( listener() ); - - if ( !isSync ) - myMutex.unlock(); -} - -void PyInterp_Request::safeExecute() -{ - ProcessVoidEvent( new PyInterp_ExecuteEvent( this ) ); -} - -void PyInterp_Request::Destroy( PyInterp_Request* request ) -{ - // Lock and unlock the mutex to avoid errors on its deletion - request->myMutex.lock(); - request->myMutex.unlock(); - delete request; -} - -QEvent* PyInterp_Request::createEvent() const -{ - return new PyInterp_Event( PyInterp_Event::ES_NOTIFY, (PyInterp_Request*)this ); -} - -void PyInterp_Request::processEvent( QObject* o ) -{ - if ( !o ) - return; - - QEvent* e = createEvent(); - if ( !e ) - return; - - if ( !IsSync() ) - QCoreApplication::postEvent( o, e ); - else - { - QCoreApplication::sendEvent( o, e ); - delete e; - } -} - -void PyInterp_Request::setListener( QObject* o ) -{ - myMutex.lock(); - myListener = o; - myMutex.unlock(); -} - -void PyInterp_LockRequest::safeExecute() -{ - if ( getInterp() ){ - PyLockWrapper aLock = getInterp()->GetLockWrapper(); - ProcessVoidEvent( new PyInterp_ExecuteEvent( this ) ); - } -} - -PyInterp_Event::~PyInterp_Event() -{ - PyInterp_Request::Destroy( myRequest ); - myRequest = 0; -} - -PyInterp_Dispatcher* PyInterp_Dispatcher::Get() -{ - if ( !myInstance ) - myInstance = new PyInterp_Dispatcher(); - return myInstance; -} - -PyInterp_Dispatcher::PyInterp_Dispatcher() -: QThread() -{ - myWatcher = new PyInterp_Watcher(); -} - -PyInterp_Dispatcher::~PyInterp_Dispatcher() -{ - // Clear the request queue - myQueueMutex.lock(); - - QListIterator it( myQueue ); - while ( it.hasNext() ) - PyInterp_Request::Destroy( it.next() ); - myQueue.clear(); - - myQueueMutex.unlock(); - - // Wait for run() to finish - wait(); - - delete myWatcher; - myWatcher = 0; -} - -bool PyInterp_Dispatcher::IsBusy() const -{ - return isRunning(); -} - -void PyInterp_Dispatcher::Exec( PyInterp_Request* theRequest ) -{ - if ( !theRequest ) - return; - - //if ( theRequest->IsSync() && !IsBusy() ) // synchronous processing - nothing is done if dispatcher is busy! - if ( theRequest->IsSync() ) // synchronous processing - nothing is done if dispatcher is busy! - processRequest( theRequest ); - else // asynchronous processing - { - myQueueMutex.lock(); - myQueue.enqueue( theRequest ); - if ( theRequest->listener() ) - QObject::connect( theRequest->listener(), SIGNAL( destroyed( QObject* ) ), myWatcher, SLOT( onDestroyed( QObject* ) ) ); - myQueueMutex.unlock(); - - if ( !IsBusy() ) - start(); - } -} - -void PyInterp_Dispatcher::run() -{ -// MESSAGE("*** PyInterp_Dispatcher::run(): STARTED") - PyInterp_Request* aRequest; - - // prepare for queue size check - myQueueMutex.lock(); - - while( myQueue.size() ) { -// MESSAGE("*** PyInterp_Dispatcher::run(): next request taken from the queue") - aRequest = myQueue.head(); - - // let other threads append their requests to the end of the queue - myQueueMutex.unlock(); - - // processRequest() may delete a request, so this pointer must not be used - // after request is processed! - processRequest( aRequest ); - - // prepare for removal of the first request in the queue - myQueueMutex.lock(); - // IMPORTANT: the first item could have been removed by objectDestroyed() --> we have to check it - if ( myQueue.head() == aRequest ) // It's still here --> remove it - myQueue.dequeue(); - -// MESSAGE("*** PyInterp_Dispatcher::run(): request processed") - } - - myQueueMutex.unlock(); -// MESSAGE("*** PyInterp_Dispatcher::run(): FINISHED") -} - -void PyInterp_Dispatcher::processRequest( PyInterp_Request* theRequest ) -{ - theRequest->process(); -} - -void PyInterp_Dispatcher::objectDestroyed( const QObject* o ) -{ - // prepare for modification of the queue - myQueueMutex.lock(); - - QMutableListIterator it( myQueue ); - while ( it.hasNext() ) - { - RequestPtr r = it.next(); - if ( o == r->listener() ) - { - r->setListener( 0 ); // to prevent event posting - it.remove(); - } - } - - myQueueMutex.unlock(); -} diff --git a/src/PyInterp/PyInterp_Dispatcher.h b/src/PyInterp/PyInterp_Dispatcher.h deleted file mode 100755 index 5040b1032..000000000 --- a/src/PyInterp/PyInterp_Dispatcher.h +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 : PyInterp_Dispatcher.h -// Author : Sergey Anikin, OCC -// Module : SALOME - -#ifndef PYINTERP_DISPATCHER_H -#define PYINTERP_DISPATCHER_H - -#include "PyInterp.h" // !!! WARNING !!! THIS INCLUDE MUST BE THE VERY FIRST !!! - -#include -#include -#include -#include - -class QObject; - -class PyInterp_Interp; -class PyInterp_Watcher; -class PyInterp_Dispatcher; -class PyInterp_ExecuteEvent; - -class PYINTERP_EXPORT PyInterp_Request -{ - friend class PyInterp_Dispatcher; - friend class PyInterp_ExecuteEvent; - - PyInterp_Request(); - PyInterp_Request( const PyInterp_Request& ); - -protected: - virtual ~PyInterp_Request() {}; - // protected destructor - to control deletion of requests - -public: - PyInterp_Request( QObject* listener, bool sync = false ) - : myIsSync( sync ), myListener( listener ) {}; - - static void Destroy( PyInterp_Request* ); - // Deletes a request - - bool IsSync() const { return myIsSync; } - // Returns true if this request should be processed synchronously, - // without putting it to a queue - -protected: - virtual void safeExecute(); - - virtual void execute() = 0; - // Should be redefined in successors, contains actual request code - - virtual QEvent* createEvent() const; - // This method can be overridden to customize notification event creation - - virtual void processEvent( QObject* ); - - QObject* listener() const { return myListener; } - void setListener( QObject* ); - -private: - void process(); - -private: - QMutex myMutex; - bool myIsSync; - QObject* myListener; -}; - -class PYINTERP_EXPORT PyInterp_LockRequest : public PyInterp_Request -{ -public: - PyInterp_LockRequest( PyInterp_Interp* interp, QObject* listener = 0, bool sync = false ) - : PyInterp_Request( listener, sync ), myInterp( interp ) {} - -protected: - PyInterp_Interp* getInterp() const { return myInterp; } - - virtual void safeExecute(); - -private: - PyInterp_Interp* myInterp; -}; - -class PYINTERP_EXPORT PyInterp_Event : public QEvent -{ - PyInterp_Event(); - PyInterp_Event( const PyInterp_Event& ); - -public: - //Execution state - enum { ES_NOTIFY = QEvent::User + 5000, ES_OK, ES_ERROR, ES_INCOMPLETE, ES_LAST }; - - PyInterp_Event( int type, PyInterp_Request* request ) - : QEvent( (QEvent::Type)type ), myRequest( request ) {} - - virtual ~PyInterp_Event(); - - PyInterp_Request* GetRequest() const { return myRequest; } - operator PyInterp_Request*() const { return myRequest; } - -private: - PyInterp_Request* myRequest; -}; - -class PYINTERP_EXPORT PyInterp_Dispatcher : protected QThread -{ - PyInterp_Dispatcher(); // private constructor - -public: - static PyInterp_Dispatcher* Get(); - - virtual ~PyInterp_Dispatcher(); - - bool IsBusy() const; - void Exec( PyInterp_Request* ); - -private: - virtual void run(); - void processRequest( PyInterp_Request* ); - void objectDestroyed( const QObject* ); - -private: - typedef PyInterp_Request* RequestPtr; - - QQueue myQueue; - QMutex myQueueMutex; - PyInterp_Watcher* myWatcher; - - static PyInterp_Dispatcher* myInstance; - - friend class PyInterp_Watcher; -}; - -#endif // PYINTERP_DISPATCHER_H diff --git a/src/PyInterp/PyInterp_Interp.cxx b/src/PyInterp/PyInterp_Interp.cxx deleted file mode 100644 index 891d02908..000000000 --- a/src/PyInterp/PyInterp_Interp.cxx +++ /dev/null @@ -1,449 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 : PyInterp_Interp.cxx -// Author : Christian CAREMOLI, Paul RASCLE, EDF -// Module : SALOME - -#include "PyInterp_Interp.h" // !!! WARNING !!! THIS INCLUDE MUST BE THE VERY FIRST !!! - -#include -#include - -#include -#include -#include - -#define TOP_HISTORY_PY "--- top of history ---" -#define BEGIN_HISTORY_PY "--- begin of history ---" - -/*! - \class PyLockWrapper - \brief Python GIL wrapper. -*/ - -/*! - \brief Constructor. Automatically acquires GIL. - \param theThreadState python thread state -*/ -PyLockWrapper::PyLockWrapper(PyThreadState* theThreadState): - myThreadState(theThreadState), - mySaveThreadState(0) -{ - if (myThreadState->interp == PyInterp_Interp::_interp) - _savestate = PyGILState_Ensure(); - else - PyEval_AcquireThread(myThreadState); -} - -/*! - \brief Desstructor. Automatically releases GIL. -*/ -PyLockWrapper::~PyLockWrapper() -{ - if (myThreadState->interp == PyInterp_Interp::_interp) - PyGILState_Release(_savestate); - else - PyEval_ReleaseThread(myThreadState); -} - -/*! - \brief Get Python GIL wrapper. - \return GIL lock wrapper (GIL is automatically acquired here) -*/ -PyLockWrapper PyInterp_Interp::GetLockWrapper() -{ - return _tstate; -} - -/* - The following functions are used to hook the Python - interpreter output. -*/ - -static void -PyStdOut_dealloc(PyStdOut *self) -{ - PyObject_Del(self); -} - -static PyObject* -PyStdOut_write(PyStdOut *self, PyObject *args) -{ - char *c; - int l; - if (!PyArg_ParseTuple(args, "t#:write",&c, &l)) - return NULL; - if(self->_cb==NULL) { - if ( self->_iscerr ) - std::cerr << c ; - else - std::cout << c ; - } - else { - self->_cb(self->_data,c); - } - Py_INCREF(Py_None); - return Py_None; -} - -static PyMethodDef PyStdOut_methods[] = { - {"write", (PyCFunction)PyStdOut_write, METH_VARARGS, - PyDoc_STR("write(string) -> None")}, - {NULL, NULL} /* sentinel */ -}; - -static PyMemberDef PyStdOut_memberlist[] = { - {"softspace", T_INT, offsetof(PyStdOut, softspace), 0, - "flag indicating that a space needs to be printed; used by print"}, - {NULL} /* Sentinel */ -}; - -static PyTypeObject PyStdOut_Type = { - /* The ob_type field must be initialized in the module init function - * to be portable to Windows without using C++. */ - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ - "PyOut", /*tp_name*/ - sizeof(PyStdOut), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)PyStdOut_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - PyObject_GenericGetAttr, /*tp_getattro*/ - /* softspace is writable: we must supply tp_setattro */ - PyObject_GenericSetAttr, /* tp_setattro */ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT, /*tp_flags*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - PyStdOut_methods, /*tp_methods*/ - PyStdOut_memberlist, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - 0, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ -}; - -#define PyStdOut_Check(v) ((v)->ob_type == &PyStdOut_Type) - -static PyStdOut* newPyStdOut( bool iscerr ) -{ - PyStdOut *self; - self = PyObject_New(PyStdOut, &PyStdOut_Type); - if (self == NULL) - return NULL; - self->softspace = 0; - self->_cb = NULL; - self->_iscerr = iscerr; - return self; -} - -/*! - \class PyInterp_Interp - \brief Generic embedded Python interpreter. -*/ - -int PyInterp_Interp::_argc = 1; -char* PyInterp_Interp::_argv[] = {""}; -PyObject* PyInterp_Interp::builtinmodule = NULL; -PyThreadState* PyInterp_Interp::_gtstate = NULL; -PyInterpreterState* PyInterp_Interp::_interp = NULL; - -/*! - \brief Basic constructor. - - After construction the interpreter instance successor classes - must call virtual method initalize(). -*/ -PyInterp_Interp::PyInterp_Interp(): - _tstate(0), _vout(0), _verr(0), _g(0) -{ -} - -/*! - \brief Destructor. -*/ -PyInterp_Interp::~PyInterp_Interp() -{ -} - -/*! - \brief Initialize embedded interpreter. - - This method shoud be called after construction of the interpreter. - The method initialize() calls virtuals methods - - initPython() to initialize global Python interpreter - - initState() to initialize embedded interpreter state - - initContext() to initialize interpreter internal context - - initRun() to prepare interpreter for running commands - which should be implemented in the successor classes, according to the - embedded Python interpreter policy (mono or multi interpreter, etc). -*/ -void PyInterp_Interp::initialize() -{ - _history.clear(); // start a new list of user's commands - _ith = _history.begin(); - - initPython(); - // Here the global lock is released - - initState(); - - PyLockWrapper aLock = GetLockWrapper(); - - initContext(); - - // used to interpret & compile commands - PyObjWrapper m(PyImport_ImportModule("codeop")); - if(!m) { - PyErr_Print(); - return; - } - - // Create python objects to capture stdout and stderr - _vout=(PyObject*)newPyStdOut( false ); // stdout - _verr=(PyObject*)newPyStdOut( true ); // stderr - - // All the initRun outputs are redirected to the standard output (console) - initRun(); -} - -/*! - \brief Initialize Python interpreter. - - Set program name, initialize interpreter, set program arguments, - initiaize threads. - */ -void PyInterp_Interp::initPython() -{ - if (Py_IsInitialized()) - return; - - // Python is not initialized - Py_SetProgramName(_argv[0]); - Py_Initialize(); // Initialize the interpreter - PySys_SetArgv(_argc, _argv); - PyEval_InitThreads(); // Create (and acquire) the interpreter lock - _interp = PyThreadState_Get()->interp; - if (PyType_Ready(&PyStdOut_Type) < 0) { - PyErr_Print(); - } - _gtstate = PyEval_SaveThread(); // Release global thread state -} - -/*! - \brief Get embedded Python interpreter banner. - \return banner string - */ -std::string PyInterp_Interp::getbanner() -{ - // Should we take the lock ? - // PyEval_RestoreThread(_tstate); - std::string aBanner("Python "); - aBanner = aBanner + Py_GetVersion() + " on " + Py_GetPlatform() ; - aBanner = aBanner + "\ntype help to get general information on environment\n"; - //PyEval_SaveThread(); - return aBanner; -} - -/*! - \brief Initialize run command. - - This method is used to prepare interpreter for running - Python commands. - - \return \c true on success and \c false on error -*/ -bool PyInterp_Interp::initRun() -{ - // - // probably all below code isn't required - // - /* - PySys_SetObject("stderr",_verr); - PySys_SetObject("stdout",_vout); - - //PyObject *m = PyImport_GetModuleDict(); - - PySys_SetObject("stdout",PySys_GetObject("__stdout__")); - PySys_SetObject("stderr",PySys_GetObject("__stderr__")); - */ - return true; -} - -/*! - \brief Compile Python command and evaluate it in the - python dictionary context if possible. - \internal - \param command Python command string - \param context Python context (dictionary) - \return -1 on fatal error, 1 if command is incomplete and 0 - if command is executed successfully - */ -static int compile_command(const char *command,PyObject *context) -{ - PyObject *m = PyImport_AddModule("codeop"); - if(!m) { // Fatal error. No way to go on. - PyErr_Print(); - return -1; - } - PyObjWrapper v(PyObject_CallMethod(m,"compile_command","s",command)); - if(!v) { - // Error encountered. It should be SyntaxError, - //so we don't write out traceback - PyObjWrapper exception, value, tb; - PyErr_Fetch(&exception, &value, &tb); - PyErr_NormalizeException(&exception, &value, &tb); - PyErr_Display(exception, value, NULL); - return -1; - } - else if (v == Py_None) { - // Incomplete text we return 1 : we need a complete text to execute - return 1; - } - else { - // Complete and correct text. We evaluate it. - //#if PY_VERSION_HEX < 0x02040000 // python version earlier than 2.4.0 - // PyObjWrapper r(PyEval_EvalCode(v,context,context)); - //#else - PyObjWrapper r(PyEval_EvalCode((PyCodeObject *)(void *)v,context,context)); - //#endif - if(!r) { - // Execution error. We return -1 - PyErr_Print(); - return -1; - } - // The command has been successfully executed. Return 0 - return 0; - } -} - -/*! - \brief Run Python command. - \param command Python command - \return command status -*/ -int PyInterp_Interp::run(const char *command) -{ - beforeRun(); - return simpleRun(command); -} - -/*! - \brief Run Python command (used internally). - \param command Python command - \param addToHistory if \c true (default), the command is added to the commands history - \return command status -*/ -int PyInterp_Interp::simpleRun(const char *command, const bool addToHistory) -{ - if( addToHistory && strcmp(command,"") != 0 ) { - _history.push_back(command); - _ith = _history.end(); - } - - // We come from C++ to enter Python world - // We need to acquire the Python global lock - //PyLockWrapper aLock(_tstate); // san - lock is centralized now - - // Reset redirected outputs before treatment - PySys_SetObject("stderr",_verr); - PySys_SetObject("stdout",_vout); - - int ier = compile_command(command,_g); - - // Outputs are redirected on standards outputs (console) - PySys_SetObject("stdout",PySys_GetObject("__stdout__")); - PySys_SetObject("stderr",PySys_GetObject("__stderr__")); - - return ier; -} - -/*! - \brief Get previous command in the commands history. - \return previous command -*/ -const char * PyInterp_Interp::getPrevious() -{ - if(_ith != _history.begin()){ - _ith--; - return (*_ith).c_str(); - } - else - return BEGIN_HISTORY_PY; -} - -/*! - \brief Get next command in the commands history. - \return next command -*/ -const char * PyInterp_Interp::getNext() -{ - if(_ith != _history.end()){ - _ith++; - } - if (_ith == _history.end()) - return TOP_HISTORY_PY; - else - return (*_ith).c_str(); -} - -/*! - \brief Set Python standard output device hook. - \param cb callback function - \param data callback function parameters -*/ -void PyInterp_Interp::setvoutcb(PyOutChanged* cb, void* data) -{ - ((PyStdOut*)_vout)->_cb=cb; - ((PyStdOut*)_vout)->_data=data; -} - -/*! - \brief Set Python standard error device hook. - \param cb callback function - \param data callback function parameters -*/ -void PyInterp_Interp::setverrcb(PyOutChanged* cb, void* data) -{ - ((PyStdOut*)_verr)->_cb=cb; - ((PyStdOut*)_verr)->_data=data; -} diff --git a/src/PyInterp/PyInterp_Interp.h b/src/PyInterp/PyInterp_Interp.h deleted file mode 100644 index 397a79167..000000000 --- a/src/PyInterp/PyInterp_Interp.h +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 : PyInterp_Interp.h -// Author : Christian CAREMOLI, Paul RASCLE, EDF -// Module : SALOME - -#ifndef PYINTERP_INTERP_H -#define PYINTERP_INTERP_H - -#include "PyInterp.h" // !!! WARNING !!! THIS INCLUDE MUST BE THE VERY FIRST !!! - -#include -#include - -class PYINTERP_EXPORT PyLockWrapper -{ - PyThreadState* myThreadState; - PyThreadState* mySaveThreadState; - PyGILState_STATE _savestate; -public: - PyLockWrapper(PyThreadState* theThreadState); - ~PyLockWrapper(); -}; - -typedef void PyOutChanged(void* data,char * c); - -class PYINTERP_EXPORT PyInterp_Interp -{ -public: - static int _argc; - static char* _argv[]; - static PyObject *builtinmodule; - static PyThreadState *_gtstate; - static PyInterpreterState *_interp; - - PyInterp_Interp(); - virtual ~PyInterp_Interp(); - - void initialize(); - - virtual int run(const char *command); - - PyLockWrapper GetLockWrapper(); - - std::string getbanner(); - void setverrcb(PyOutChanged*,void*); - void setvoutcb(PyOutChanged*,void*); - - const char * getPrevious(); - const char * getNext(); - -protected: - PyThreadState * _tstate; - PyObject * _vout; - PyObject * _verr; - PyObject * _g; - PyObject * _codeop; - std::list _history; - std::list::iterator _ith; - - virtual int beforeRun() { return 0; } - int simpleRun(const char* command, const bool addToHistory = true); - - virtual bool initRun(); - virtual void initPython(); - virtual bool initState() = 0; - virtual bool initContext() = 0; -}; - -class PYINTERP_EXPORT PyObjWrapper -{ - PyObject* myObject; -public: - PyObjWrapper(PyObject* theObject) : myObject(theObject) {} - PyObjWrapper() : myObject(0) {} - virtual ~PyObjWrapper() { Py_XDECREF(myObject); } - - operator PyObject*() { return myObject; } - PyObject* operator->() { return myObject; } - PyObject* get() { return myObject; } - bool operator!() { return !myObject; } - bool operator==(PyObject* theObject) { return myObject == theObject; } - PyObject** operator&() { return &myObject; } - PyObjWrapper& operator=(PyObjWrapper* theObjWrapper) - { - Py_XDECREF(myObject); - myObject = theObjWrapper->myObject; - return *this; - } -}; - -typedef struct { - PyObject_HEAD - int softspace; - PyOutChanged* _cb; - void* _data; - bool _iscerr; -} PyStdOut; - -#endif // PYINTERP_INTERP_H diff --git a/src/PyInterp/PyInterp_Watcher.h b/src/PyInterp/PyInterp_Watcher.h deleted file mode 100755 index 1d50f5bf8..000000000 --- a/src/PyInterp/PyInterp_Watcher.h +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 : PyInterp_Watcher.h -// Author : Sergey Anikin, OCC -// Module : SALOME - -#ifndef PYINTERP_WATCHER_H -#define PYINTERP_WATCHER_H - -#include "PyInterp.h" // !!! WARNING !!! THIS INCLUDE MUST BE THE VERY FIRST !!! - -#include "PyInterp_Dispatcher.h" - -#include - -// Private class that keeps track of destructions of request listeners -class PYINTERP_EXPORT PyInterp_Watcher : public QObject -{ - Q_OBJECT - -public: - PyInterp_Watcher() : QObject( 0 ) {} - virtual ~PyInterp_Watcher() {} - -public slots: - void onDestroyed( QObject* o ) { PyInterp_Dispatcher::Get()->objectDestroyed( o ); } -}; - -#endif // PYINTERP_WATCHER_H diff --git a/src/QxGraph/Makefile.am b/src/QxGraph/Makefile.am deleted file mode 100755 index 292084f65..000000000 --- a/src/QxGraph/Makefile.am +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms 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 $(top_srcdir)/adm_local/unix/make_common_starter.am - -lib_LTLIBRARIES = libQxGraph.la - -salomeinclude_HEADERS= \ - QxGraph_ActiveItem.h \ - QxGraph_Prs.h \ - QxGraph_Canvas.h \ - QxGraph_CanvasView.h \ - QxGraph_ViewWindow.h \ - QxGraph_ViewManager.h \ - QxGraph_ViewModel.h \ - QxGraph_Def.h \ - QxGraph.h - -dist_libQxGraph_la_SOURCES= \ - QxGraph_Prs.cxx \ - QxGraph_Canvas.cxx \ - QxGraph_CanvasView.cxx \ - QxGraph_ViewWindow.cxx \ - QxGraph_ViewManager.cxx \ - QxGraph_ViewModel.cxx - -MOC_FILES= \ - QxGraph_Canvas_moc.cxx \ - QxGraph_CanvasView_moc.cxx \ - QxGraph_ViewWindow_moc.cxx \ - QxGraph_ViewManager_moc.cxx \ - QxGraph_ViewModel_moc.cxx - -nodist_libQxGraph_la_SOURCES= $(MOC_FILES) - -dist_salomeres_DATA= \ - resources/qx_view_fitall.png \ - resources/qx_view_fitarea.png \ - resources/qx_view_glpan.png \ - resources/qx_view_pan.png \ - resources/qx_view_reset.png \ - resources/qx_view_zoom.png - -nodist_salomeres_DATA= \ - QxGraph_images.qm \ - QxGraph_msg_en.qm - -libQxGraph_la_CPPFLAGS=$(QT_INCLUDES) $(CAS_CPPFLAGS) $(PYTHON_INCLUDES) $(BOOST_CPPFLAGS) \ - -I$(srcdir)/../Qtx -I$(srcdir)/../SUIT -libQxGraph_la_LDFLAGS=$(QT_MT_LIBS) ../SUIT/libsuit.la diff --git a/src/QxGraph/QxGraph.h b/src/QxGraph/QxGraph.h deleted file mode 100644 index e11d0f0af..000000000 --- a/src/QxGraph/QxGraph.h +++ /dev/null @@ -1,35 +0,0 @@ -// SALOME QxGraph : build Supervisor viewer into desktop -// -// 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 -// - -#ifdef WNT -#ifdef QXGRAPH_EXPORTS -#define QXGRAPH_EXPORT __declspec(dllexport) -#else -#define QXGRAPH_EXPORT __declspec(dllimport) -#endif -#else -#define QXGRAPH_EXPORT -#endif - -#ifdef WNT -#pragma warning ( disable:4251 ) -#endif diff --git a/src/QxGraph/QxGraph.pro b/src/QxGraph/QxGraph.pro deleted file mode 100644 index 947290fd4..000000000 --- a/src/QxGraph/QxGraph.pro +++ /dev/null @@ -1,56 +0,0 @@ -TEMPLATE = lib -TARGET = QxGraph -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -QT_INCLUDES = $$(QTDIR)/include $$(QTDIR)/include/QtCore $$(QTDIR)/include/QtGui $$(QTDIR)/include/QtOpenGL $$(QTDIR)/include/QtXml - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -PYTHON_INCLUDES = $$(PYTHONHOME)/include/python2.4 - -BOOST_CPPFLAGS = $$(BOOSTDIR)/include - -QT_MT_LIBS = -L$$(QTDIR)/lib -lQtCore -lQtXml -lQtGui -lQtOpenGL - -INCLUDEPATH += $${QT_INCLUDES} $${CAS_CPPFLAGS} $${PYTHON_INCLUDES} $${BOOST_CPPFLAGS} ../Qtx ../SUIT - -LIBS += $${QT_MT_LIBS} -L../../lib -lsuit - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += QXGRAPH_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS - -HEADERS = QxGraph_ActiveItem.h -HEADERS += QxGraph_Prs.h -HEADERS += QxGraph_Canvas.h -HEADERS += QxGraph_CanvasView.h -HEADERS += QxGraph_ViewWindow.h -HEADERS += QxGraph_ViewManager.h -HEADERS += QxGraph_ViewModel.h -HEADERS += QxGraph_Def.h -HEADERS += QxGraph.h - -SOURCES = QxGraph_Prs.cxx -SOURCES += QxGraph_Canvas.cxx -SOURCES += QxGraph_CanvasView.cxx -SOURCES += QxGraph_ViewWindow.cxx -SOURCES += QxGraph_ViewManager.cxx -SOURCES += QxGraph_ViewModel.cxx - -TRANSLATIONS = resources/QxGraph_images.ts \ - resources/QxGraph_msg_en.ts - -ICONS = resources/*.png - -includes.files = $$HEADERS -includes.path = ../../include - -resources.files = $$ICONS resources/*.qm -resources.path = ../../resources - -INSTALLS += includes resources diff --git a/src/QxGraph/QxGraph_ActiveItem.h b/src/QxGraph/QxGraph_ActiveItem.h deleted file mode 100644 index fc9f008e7..000000000 --- a/src/QxGraph/QxGraph_ActiveItem.h +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 QXGRAPH_ACTIVEITEM_H -#define QXGRAPH_ACTIVEITEM_H - -#include "QxGraph.h" - -#include -#include -#include - -class QXGRAPH_EXPORT QxGraph_ActiveItem -{ - public: - QxGraph_ActiveItem() {} - ~QxGraph_ActiveItem() {} - - virtual bool isMoveable() = 0; - virtual void beforeMoving() = 0; - virtual void afterMoving() = 0; - - virtual bool isResizable(QPoint thePoint, int& theCursorType) { return false; } - virtual bool isResizing() { return false; } - virtual void beforeResizing(int theCursorType) {} - virtual void resize(QPoint thePoint) {} - virtual void afterResizing() {} - - virtual void hilight(const QPoint& theMousePos, const bool toHilight = true) = 0; - virtual void select(const QPoint& theMousePos, const bool toSelect = true) = 0; - virtual void showPopup(QWidget* theParent, QMouseEvent* theEvent, const QPoint& theMousePos = QPoint()) = 0; - - virtual QString getToolTipText(const QPoint& theMousePos, QRect& theRect) const = 0; - - virtual bool arePartsOfOtherItem(QxGraph_ActiveItem* theSecondItem) { return false; } - - void setTMatrix(QWMatrix theMatrix) { myTMatrix = theMatrix; } - QWMatrix getTMatrix() const { return myTMatrix; } - - private: - QWMatrix myTMatrix; // canvas view's current transformation matrix -}; - -#endif diff --git a/src/QxGraph/QxGraph_Canvas.cxx b/src/QxGraph/QxGraph_Canvas.cxx deleted file mode 100644 index f39c5f6b4..000000000 --- a/src/QxGraph/QxGraph_Canvas.cxx +++ /dev/null @@ -1,109 +0,0 @@ -// SALOME QxGraph : build Supervisor viewer into desktop -// -// 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 "QxGraph_Canvas.h" -#include "QxGraph_Def.h" -#include "QxGraph_Prs.h" - -#include - -#include -#include - -/*! - Constructor -*/ -QxGraph_Canvas::QxGraph_Canvas(SUIT_ResourceMgr* theMgr) : - QCanvas() -{ - printf("Construct QxGraph_Canvas\n"); - - resize(GRAPH_WIDTH, GRAPH_HEIGHT); - setDoubleBuffering(true); - - QColor aColor = theMgr->colorValue( "QxGraph", "Background", DEF_BACK_COLOR ); - setBackgroundColor(aColor); -} - -/*! - Destructor -*/ -QxGraph_Canvas::~QxGraph_Canvas() -{ - /*QObjectList* aNodeList = queryList("QObject"); - QObjectListIt aIt(*aNodeList); - QObject* anObj; - while ( (anObj = aIt.current()) != 0 ) { - ++aIt; - aNodeList->removeRef(anObj); - delete anObj; - } - delete aNodeList;*/ - - myPrsList.setAutoDelete(true); - myPrsList.clear(); -} - -/*! - Add view -*/ -void QxGraph_Canvas::addView(QCanvasView* theView) -{ - myViews.append( theView ); - QCanvas::addView(theView); - theView->setPaletteBackgroundColor(backgroundColor().light(120)); -} - -/*! - Remove view -*/ -void QxGraph_Canvas::removeView( QCanvasView* theView ) -{ - myViews.remove( theView ); -} - -/*! - Remove item -*/ -void QxGraph_Canvas::removeItem( QCanvasItem* theItem ) -{ - QValueList< QCanvasView* >::iterator anIter; - for ( anIter = myViews.begin(); anIter != myViews.end(); ++anIter ) - { - QxGraph_CanvasView* aView = dynamic_cast( *anIter ); - if ( aView ) - aView->itemRemoved( theItem ); - } - - QCanvas::removeItem( theItem ); -} - -/*! - Get Prs object with index theIndex -*/ -QxGraph_Prs* QxGraph_Canvas::getPrs(int theIndex) -{ - QxGraph_Prs* aRetPrs = 0; - if ( theIndex >= 0 && theIndex < myPrsList.count() ) - aRetPrs = myPrsList.at(theIndex); - return aRetPrs; -} diff --git a/src/QxGraph/QxGraph_Canvas.h b/src/QxGraph/QxGraph_Canvas.h deleted file mode 100644 index 9dd6e2c10..000000000 --- a/src/QxGraph/QxGraph_Canvas.h +++ /dev/null @@ -1,57 +0,0 @@ -// SALOME QxGraph : build Supervisor viewer into desktop -// -// 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 QXGRAPH_CANVAS_H -#define QXGRAPH_CANVAS_H - -#include "QxGraph.h" - -#include -#include - -class SUIT_ResourceMgr; -class QxGraph_Prs; - -class QXGRAPH_EXPORT QxGraph_Canvas : public QCanvas { - Q_OBJECT - - public: - QxGraph_Canvas(SUIT_ResourceMgr*); - virtual ~QxGraph_Canvas(); - - virtual void addView(QCanvasView* theView); - virtual void removeView(QCanvasView*); - - QPtrList getPrsList() const { return myPrsList; } - QxGraph_Prs* getPrs(int theIndex = 0); - void addPrs(QxGraph_Prs* thePrs) { myPrsList.append(thePrs); } - - virtual void removeItem( QCanvasItem* ); - -private: - - QValueList< QCanvasView* > myViews; - QPtrList myPrsList; - -}; - -#endif diff --git a/src/QxGraph/QxGraph_CanvasView.cxx b/src/QxGraph/QxGraph_CanvasView.cxx deleted file mode 100644 index e7f726b13..000000000 --- a/src/QxGraph/QxGraph_CanvasView.cxx +++ /dev/null @@ -1,761 +0,0 @@ -// SALOME QxGraph : build Supervisor viewer into desktop -// -// 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 "QxGraph_CanvasView.h" -#include "QxGraph_Canvas.h" -#include "QxGraph_ViewWindow.h" -#include "QxGraph_ActiveItem.h" -#include "QxGraph_Def.h" - -#include -#include - -const char* imageZoomCursor[] = { -"32 32 3 1", -". c None", -"a c #000000", -"# c #ffffff", -"................................", -"................................", -".#######........................", -"..aaaaaaa.......................", -"................................", -".............#####..............", -"...........##.aaaa##............", -"..........#.aa.....a#...........", -".........#.a.........#..........", -".........#a..........#a.........", -"........#.a...........#.........", -"........#a............#a........", -"........#a............#a........", -"........#a............#a........", -"........#a............#a........", -".........#...........#.a........", -".........#a..........#a.........", -".........##.........#.a.........", -"........#####.....##.a..........", -".......###aaa#####.aa...........", -"......###aa...aaaaa.......#.....", -".....###aa................#a....", -"....###aa.................#a....", -"...###aa...............#######..", -"....#aa.................aa#aaaa.", -".....a....................#a....", -"..........................#a....", -"...........................a....", -"................................", -"................................", -"................................", -"................................"}; - -const char* imageCrossCursor[] = { - "32 32 3 1", - ". c None", - "a c #000000", - "# c #ffffff", - "................................", - "................................", - "................................", - "................................", - "................................", - "................................", - "................................", - "...............#................", - "...............#a...............", - "...............#a...............", - "...............#a...............", - "...............#a...............", - "...............#a...............", - "...............#a...............", - "...............#a...............", - ".......#################........", - "........aaaaaaa#aaaaaaaaa.......", - "...............#a...............", - "...............#a...............", - "...............#a...............", - "...............#a...............", - "...............#a...............", - "...............#a...............", - "...............#a...............", - "................a...............", - "................................", - "................................", - "................................", - "................................", - "................................", - "................................", - "................................"}; - -/*! - Constructor -*/ -QxGraph_CanvasView::QxGraph_CanvasView(QxGraph_Canvas* theCanvas, QxGraph_ViewWindow* theViewWindow) : - QCanvasView(theCanvas, theViewWindow, 0, Qt::WRepaintNoErase), - myCurrentItem(0), - myHilightedItem(0), - mySelectedItem(0), - myMovingDone(false), - myCenter(0,0) -{ - printf("Construct QxGraph_CanvasView\n"); - setName("QxGraph_CanvasView"); - - myOperation = NOTHING; - myCursor = cursor(); - mySelectedRect = 0; - - myTimer = new QTimer(this); - connect(myTimer, SIGNAL(timeout()), this, SLOT(onTimeout())); - - viewport()->setMouseTracking(true); -} - -/*! - Destructor -*/ -QxGraph_CanvasView::~QxGraph_CanvasView() -{ -} - -void QxGraph_CanvasView::contentsMousePressEvent(QMouseEvent* theEvent) -{ - myPoint = inverseWorldMatrix().map(theEvent->pos()); - myGlobalPoint = theEvent->globalPos(); - myCurrentItem = 0; - - if ( theEvent->button() == Qt::MidButton && theEvent->state() == Qt::ControlButton - || - myOperation == PANVIEW ) - { // Panning - if ( myOperation != PANVIEW ) { - myOperation = PANVIEW; - myCursor = cursor(); // save old cursor - QCursor panCursor (Qt::SizeAllCursor); - setCursor(panCursor); - } - return; - } - - if ( myOperation == PANGLOBAL ) - { // Global panning - return; - } - - if ( myOperation == WINDOWFIT ) - { // Fit area - return; - } - - if ( theEvent->button() == Qt::LeftButton && theEvent->state() == Qt::ControlButton - || - myOperation == ZOOMVIEW ) - { // Zoom - if ( myOperation != ZOOMVIEW ) { - myOperation = ZOOMVIEW; - myCursor = cursor(); // save old cursor - QPixmap zoomPixmap (imageZoomCursor); - QCursor zoomCursor (zoomPixmap); - setCursor(zoomCursor); - - // the center of the view before zooming - int aXVCenter = viewport()->width()/2; - int aYVCenter = viewport()->height()/2; - myCenter = viewportToContents(QPoint(aXVCenter,aYVCenter)); - } - return; - } - - if ( theEvent->button() == Qt::LeftButton ) - { - QCanvasItemList aList = canvas()->collisions(myPoint); - // to move items on canvas view - for (QCanvasItemList::Iterator it = aList.begin(); it != aList.end(); ++it) { - QxGraph_ActiveItem* anActItem = dynamic_cast( *it ); - int aCursorType; - if ( anActItem && anActItem->isResizable(myPoint,aCursorType) ) - { // resize itself only active items if it is resizable - anActItem->beforeResizing(aCursorType); - myCurrentItem = *it; - return; - } - else if ( anActItem && anActItem->isMoveable() ) - { // move itself only active items if it is moveable - anActItem->beforeMoving(); - myCurrentItem = *it; - return; - } - } - } -} - -void QxGraph_CanvasView::contentsMouseMoveEvent(QMouseEvent* theEvent) -{ - QPoint aPoint = inverseWorldMatrix().map(theEvent->pos()); - QPoint aGlobalPoint = theEvent->globalPos(); - - if (myTimer->isActive()) myTimer->stop(); - - if ( myOperation == PANVIEW ) - { // Panning - scrollBy(myGlobalPoint.x() - aGlobalPoint.x(), - myGlobalPoint.y() - aGlobalPoint.y()); - myGlobalPoint = aGlobalPoint; - myMovingDone = true; - return; - } - - if ( myOperation == WINDOWFIT ) - { // Fit within rectangle - int aLX, aTY; //left x and top y - if (myPoint.x() < aPoint.x()) aLX = myPoint.x(); - else aLX = aPoint.x(); - if (myPoint.y() < aPoint.y()) aTY = myPoint.y(); - else aTY = aPoint.y(); - QRect aRect(aLX, aTY, abs(myPoint.x()-aPoint.x()), abs(myPoint.y()-aPoint.y())); - QCanvasRectangle* aRect1 = new QCanvasRectangle(aRect, canvas()); - - //hide old selected rectangle - if (mySelectedRect) - mySelectedRect->hide(); - //draw new selected rectangle - QPen pen(Qt::black,1,Qt::SolidLine); - aRect1->setPen(pen); - aRect1->setZ(1E+6); - aRect1->show(); - - mySelectedRect = aRect1; - canvas()->update(); - - return; - } - - if ( myOperation == ZOOMVIEW ) - { // Zoom - QCanvasItemList aList = canvas()->allItems(); - for (QCanvasItemList::Iterator it = aList.begin(); it != aList.end(); ++it) - (*it)->hide(); - - int aXContCenter = myCenter.x(); - int aYContCenter = myCenter.y(); - - QWMatrix m = worldMatrix(); - - double dx = aGlobalPoint.x() - myGlobalPoint.x(); - double s = 1. + fabs(dx)*( (m.m11() < 1) ? m.m11() : 1. )/70.; - if (dx < 0) s = 1./s; - - int aXContCenterScaled = aXContCenter*s; - int aYContCenterScaled = aYContCenter*s; - - m.scale(s, s); - setWorldMatrix(m); - - center(aXContCenterScaled,aYContCenterScaled); - - myCenter.setX(aXContCenterScaled); - myCenter.setY(aYContCenterScaled); - - // remember the canvas view's current transformation matrix in all canvas items - aList = canvas()->allItems(); - for (QCanvasItemList::Iterator it = aList.begin(); it != aList.end(); ++it) { - QxGraph_ActiveItem* anActItem = dynamic_cast( *it ); - if ( anActItem ) anActItem->setTMatrix(m); - (*it)->show(); - } - - myGlobalPoint = aGlobalPoint; - myMovingDone = true; - - return; - } - - if ( myCurrentItem ) - { - QxGraph_ActiveItem* anActItem = dynamic_cast( myCurrentItem ); - if ( anActItem && anActItem->isResizing() ) - { // to resize items on canvas view - anActItem->resize(aPoint); - myMovingDone = true; - return; - } - - // to move items on canvas view - if ( myCurrentItem->x() && myCurrentItem->y() ) { - double cx = myCurrentItem->x() - myPoint.x(); - double cy = myCurrentItem->y() - myPoint.y(); - - if (aPoint.x()+cx < 0) aPoint.setX(-(int)cx); - if (aPoint.y()+cy < 0) aPoint.setY(-(int)cy); - } - myCurrentItem->moveBy(aPoint.x() - myPoint.x(), - aPoint.y() - myPoint.y()); - myMovingDone = true; - myPoint = aPoint; - canvas()->update(); - - // scroll contents if mouse is outside - QRect r(contentsX(), contentsY(), visibleWidth(), visibleHeight()); - if (!r.contains(theEvent->pos())) { - int dx = 0, dy = 0; - if (theEvent->pos().x() < r.left()) dx = theEvent->pos().x() - r.left(); - if (theEvent->pos().x() > r.right()) dx = theEvent->pos().x() - r.right(); - if (theEvent->pos().y() < r.top()) dy = theEvent->pos().y() - r.top(); - if (theEvent->pos().y() > r.bottom()) dy = theEvent->pos().y() - r.bottom(); - scrollBy(dx, dy); - // start timer to scroll in silent mode - myDX = dx; myDY = dy; - myTimer->start(100); - } - - return; - } - else - { - QCanvasItemList aList = canvas()->collisions(aPoint); - // perform actions for active items - bool isHilightPerformed = false; - - for (QCanvasItemList::Iterator it = aList.begin(); it != aList.end(); ++it) { - QxGraph_ActiveItem* anActItem = dynamic_cast( *it ); - - if (!isHilightPerformed && anActItem) { - // hilight - anActItem->hilight(aPoint); - if (anActItem != myHilightedItem) { - if (myHilightedItem) - myHilightedItem->hilight(aPoint, false); - myHilightedItem = anActItem; - } - isHilightPerformed = true; - - // show tooltip - QxGraph_ToolTip* aToolTip = new QxGraph_ToolTip(this); - aToolTip->maybeTip(aPoint); - } - - int aCursorType; - if ( anActItem && anActItem->isResizable(aPoint,aCursorType) ) { - // set resize cursor - QCursor resizeCursor; - switch (aCursorType) - { - case 1: //left - case 3: //right - resizeCursor = QCursor(Qt::SizeHorCursor); - break; - case 2: //top - case 4: //bottom - resizeCursor = QCursor(Qt::SizeVerCursor); - break; - case 5: //left-top - case 7: //right-bottom - resizeCursor = QCursor(Qt::SizeFDiagCursor); - break; - case 6: //right-top - case 8: //left-bottom - resizeCursor = QCursor(Qt::SizeBDiagCursor); - break; - default : - resizeCursor = QCursor(Qt::ArrowCursor); - break; - } - setCursor(resizeCursor); - return; - } - else { - // reset old cursor - setCursor(QCursor(Qt::ArrowCursor)); - return; - } - } - - if (!isHilightPerformed && myHilightedItem) { - myHilightedItem->hilight(aPoint, false); - myHilightedItem = 0; - QToolTip::hide(); //@ temporary solution - } - - if ( cursor().shape() == Qt::SizeVerCursor || cursor().shape() == Qt::SizeHorCursor - || cursor().shape() == Qt::SizeBDiagCursor || cursor().shape() == Qt::SizeFDiagCursor) - setCursor(QCursor(Qt::ArrowCursor)); - } -} - -/*! - This method is called by QxGraph_Canvas when item is removed. - QxGraph_CanvasView updates its own data accordingly -*/ -void QxGraph_CanvasView::itemRemoved( QCanvasItem* theItem ) -{ - if ( myCurrentItem == theItem ) - myCurrentItem = 0; - - QxGraph_ActiveItem* anActiveItem = dynamic_cast( theItem ); - if ( anActiveItem ) - { - if ( myHilightedItem == anActiveItem ) - myHilightedItem = 0; - if ( mySelectedItem == anActiveItem ) - mySelectedItem = 0; - } -} - -void QxGraph_CanvasView::setSelectedItem( QxGraph_ActiveItem* theItem ) -{ - mySelectedItem = theItem; -} - -QxGraph_ActiveItem* QxGraph_CanvasView::getSelectedItem() const -{ - return mySelectedItem; -} - -void QxGraph_CanvasView::contentsMouseReleaseEvent(QMouseEvent* theEvent) -{ - QPoint aPoint = inverseWorldMatrix().map(theEvent->pos()); - - if (myTimer->isActive()) myTimer->stop(); - - if (myCurrentItem) - { // to move items on canvas view - QxGraph_ActiveItem* anActItem = dynamic_cast( myCurrentItem ); - if ( anActItem && anActItem->isResizing() ) - { - anActItem->afterResizing(); - // reset old cursor - setCursor(QCursor(Qt::ArrowCursor)); - } - else if ( anActItem && anActItem->isMoveable() ) - anActItem->afterMoving(); - } - myCurrentItem = 0; - - if ( myOperation == PANVIEW ) - { // Panning - myOperation = NOTHING; - viewport()->setMouseTracking(true); - setCursor(myCursor); - - emit viewOperationDone(); - } - - if ( myOperation == PANGLOBAL ) - { // Global panning - myOperation = NOTHING; - center( theEvent->x(), theEvent->y() ); - setCursor(myCursor); - - emit viewOperationDone(); - } - - if ( myOperation == WINDOWFIT ) - { // Fit within rectangle - myOperation = NOTHING; - - if (mySelectedRect) { - mySelectedRect->hide(); - mySelectedRect = 0; - //canvas()->update(); - } - - //myPoint is the start point for selecting rectangle now - int aLX, aTY; //left x and top y - if (myPoint.x() < aPoint.x()) aLX = myPoint.x(); - else aLX = aPoint.x(); - if (myPoint.y() < aPoint.y()) aTY = myPoint.y(); - else aTY = aPoint.y(); - - //calculate width and height for new view and new zoom factor - double aXzoom = ((double)visibleWidth())/((double)(abs(myPoint.x()-aPoint.x()))); - double aYzoom = ((double)visibleHeight())/((double)(abs(myPoint.y()-aPoint.y()))); - if (aXzoom > aYzoom) aXzoom = aYzoom; - - QWMatrix m; - m.scale(aXzoom, aXzoom); - setWorldMatrix(m); - - // remember the canvas view's current transformation matrix in all canvas items - QCanvasItemList aList = canvas()->allItems(); - for (QCanvasItemList::Iterator it = aList.begin(); it != aList.end(); ++it) { - QxGraph_ActiveItem* anActItem = dynamic_cast( *it ); - if ( anActItem ) anActItem->setTMatrix(m); - } - - setContentsPos((int)(aLX*aXzoom), (int)(aTY*aYzoom)); - - canvas()->update(); - - viewport()->setMouseTracking(true); - setCursor(myCursor); - - emit viewOperationDone(); - } - - if ( myOperation == ZOOMVIEW ) - { // Zoom - myOperation = NOTHING; - viewport()->setMouseTracking(true); - setCursor(myCursor); - - emit viewOperationDone(); - } - - if ( theEvent->button() == RightButton ) - { - // Selection mechanism - QCanvasItemList aList = canvas()->collisions(aPoint); - bool isSelectionPerformed = false; - - for (QCanvasItemList::Iterator it = aList.begin(); it != aList.end(); ++it) { - QxGraph_ActiveItem* anActItem = dynamic_cast( *it ); - if (!isSelectionPerformed && anActItem) - { - anActItem->select(aPoint); - if (anActItem != mySelectedItem) - { - if (mySelectedItem && isSelectedItemInCanvas() && - !mySelectedItem->arePartsOfOtherItem(anActItem)) mySelectedItem->select(aPoint, false); - mySelectedItem = anActItem; - - // unhilight hilighted item if selection was performed - if (myHilightedItem) { - myHilightedItem->hilight(aPoint, false); - myHilightedItem = 0; - } - } - isSelectionPerformed = true; - } - } - - if (!isSelectionPerformed) - { - if ( mySelectedItem ) - { - if ( isSelectedItemInCanvas() ) mySelectedItem->select(aPoint, false); - mySelectedItem = 0; - } - - // Background popup - printf("Background popup\n"); - QContextMenuEvent aEvent( QContextMenuEvent::Mouse, - theEvent->pos(), theEvent->globalPos(), - theEvent->state() ); - if ( getViewWindow() ) - getViewWindow()->contextPopupEvent(&aEvent); // => emit contextMenuRequested( &aEvent ); - } - else - { // show context popup for the selected item - mySelectedItem->showPopup(viewport(), theEvent, aPoint); - } - } - - if ( theEvent->button() == LeftButton && !myMovingDone ) - { - // Selection mechanism - QCanvasItemList aList = canvas()->collisions(aPoint); - - if ( aList.empty() && mySelectedItem ) - { - if ( isSelectedItemInCanvas() ) mySelectedItem->select(aPoint, false); - mySelectedItem = 0; - } - else - { - for (QCanvasItemList::Iterator it = aList.begin(); it != aList.end(); ++it) { - QxGraph_ActiveItem* anActItem = dynamic_cast( *it ); - if (anActItem) - { - anActItem->select(aPoint); - if (anActItem != mySelectedItem) - { - if (mySelectedItem && isSelectedItemInCanvas() && - !mySelectedItem->arePartsOfOtherItem(anActItem)) mySelectedItem->select(aPoint, false); - mySelectedItem = anActItem; - } - break; - } - } - } - } - - myMovingDone = false; -} - -void QxGraph_CanvasView::contentsMouseDoubleClickEvent(QMouseEvent* theEvent) -{ - -} - -bool QxGraph_CanvasView::isSelectedItemInCanvas() -{ - // check if mySelectedItem is included into the canvas: - // if yes => unselect it - // if no => do nothing - bool anIsInCanvas = false; - QCanvasItemList aListC = canvas()->allItems(); - for (QCanvasItemList::Iterator itC = aListC.begin(); itC != aListC.end(); ++itC) { - QxGraph_ActiveItem* anActItemC = dynamic_cast( *itC ); - if ( anActItemC && anActItemC == mySelectedItem ) { - anIsInCanvas = true; - break; - } - } - return anIsInCanvas; -} - -void QxGraph_CanvasView::activateFitAll() -{ - //myOperation = FITALL; - int w = 0, h = 0; - QCanvasItemList l = canvas()->allItems(); - for (QCanvasItemList::Iterator it = l.begin(); it != l.end(); ++it) { - QRect r = (*it)->boundingRect(); - if (w < r.right()) w = r.right(); - if (h < r.bottom()) h = r.bottom(); - } - w += GRAPH_MARGIN; h += GRAPH_MARGIN; - double s = ((double)visibleWidth())/((double)w); - double s1 = ((double)visibleHeight())/((double)h); - if (s > s1) s = s1; - - setContentsPos(0,0); - QWMatrix m; - m.scale(s, s); - setWorldMatrix(m); - - // remember the canvas view's current transformation matrix in all canvas items - QCanvasItemList aList = canvas()->allItems(); - for (QCanvasItemList::Iterator it = aList.begin(); it != aList.end(); ++it) { - QxGraph_ActiveItem* anActItem = dynamic_cast( *it ); - if ( anActItem ) anActItem->setTMatrix(m); - } - - canvas()->update(); - //myOperation = NOTHING; - - emit viewOperationDone(); -} - -void QxGraph_CanvasView::activateFitRect() -{ - myOperation = WINDOWFIT; - viewport()->setMouseTracking(false); - myCursor = cursor(); // save old cursor - QCursor handCursor (Qt::PointingHandCursor); - setCursor(handCursor); -} - -void QxGraph_CanvasView::activateZoom() -{ - myOperation = ZOOMVIEW; - viewport()->setMouseTracking(false); - myCursor = cursor(); // save old cursor - QPixmap zoomPixmap (imageZoomCursor); - QCursor zoomCursor (zoomPixmap); - setCursor(zoomCursor); -} - -void QxGraph_CanvasView::activatePanning() -{ - myOperation = PANVIEW; - viewport()->setMouseTracking(false); - myCursor = cursor(); // save old cursor - QCursor panCursor (Qt::SizeAllCursor); - setCursor(panCursor); -} - -void QxGraph_CanvasView::activateGlobalPanning() -{ - myOperation = PANGLOBAL; - myCursor = cursor(); // save old cursor - QPixmap globalPanPixmap (imageCrossCursor); - QCursor glPanCursor (globalPanPixmap); - setCursor(glPanCursor); -} - -void QxGraph_CanvasView::activateReset() -{ - //myOperation = RESETVIEW; - setContentsPos(0,0); - QWMatrix m; - setWorldMatrix(m); - - // remember the canvas view's current transformation matrix in all canvas items - QCanvasItemList aList = canvas()->allItems(); - for (QCanvasItemList::Iterator it = aList.begin(); it != aList.end(); ++it) { - QxGraph_ActiveItem* anActItem = dynamic_cast( *it ); - if ( anActItem ) anActItem->setTMatrix(m); - } - - //myOperation = NOTHING; - - emit viewOperationDone(); -} - -void QxGraph_CanvasView::onTimeout() -{ - if (myCurrentItem) { - scrollBy(myDX, myDY); - - double cx, cy; - inverseWorldMatrix().map((double)myDX, (double)myDY, &cx, &cy); - if (myCurrentItem->x()+cx < 0) cx = -myCurrentItem->x(); - if (myCurrentItem->y()+cy < 0) cy = -myCurrentItem->y(); - myCurrentItem->moveBy(cx, cy); - myPoint.setX(myPoint.x()+(int)cx); - myPoint.setY(myPoint.y()+(int)cy); - canvas()->update(); - } -} - -QxGraph_ViewWindow* QxGraph_CanvasView::getViewWindow() const -{ - return dynamic_cast( parent() ); -} - -/*! - Shows tooltip if necessary -*/ -void QxGraph_ToolTip::maybeTip(const QPoint& theMousePos) { - QCanvasItemList aList = ((QCanvasView*)parentWidget())->canvas()->collisions(theMousePos); - - for (QCanvasItemList::Iterator it = aList.begin(); it != aList.end(); ++it) { - QxGraph_ActiveItem* anActItem = dynamic_cast( *it ); - if (anActItem) - { - QRect aRect; - QString aText = anActItem->getToolTipText(theMousePos, aRect); - int avX, avY; - QWMatrix aWM = ((QCanvasView*)parentWidget())->worldMatrix(); - ((QCanvasView*)parentWidget())->contentsToViewport((int)(aRect.left()*aWM.m11()), - (int)(aRect.top()*aWM.m22()), - avX, avY); - QRect aTipRect(avX, avY, (int)(aRect.width()*aWM.m11()), (int)(aRect.height()*aWM.m22())); - if (!aText.isEmpty()) - tip(aTipRect, aText); - return; - } - } -} - - - diff --git a/src/QxGraph/QxGraph_CanvasView.h b/src/QxGraph/QxGraph_CanvasView.h deleted file mode 100644 index 6aa5c3b79..000000000 --- a/src/QxGraph/QxGraph_CanvasView.h +++ /dev/null @@ -1,112 +0,0 @@ -// SALOME QxGraph : build Supervisor viewer into desktop -// -// 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 QXGRAPH_CANVASVIEW_H -#define QXGRAPH_CANVASVIEW_H - -#include "QxGraph.h" - -#include -#include -#include -#include - -class QxGraph_Canvas; -class QxGraph_ViewWindow; -class QxGraph_ActiveItem; - -class QXGRAPH_EXPORT QxGraph_CanvasView : public QCanvasView { - Q_OBJECT - - public: - enum OperationType{ NOTHING, PANVIEW, ZOOMVIEW, PANGLOBAL, - WINDOWFIT, FITALLVIEW, RESETVIEW }; - - QxGraph_CanvasView(QxGraph_Canvas* theCanvas, QxGraph_ViewWindow* theViewWindow); - virtual ~QxGraph_CanvasView(); - - QxGraph_ViewWindow* getViewWindow() const; - - void activateFitAll(); - void activateFitRect(); - void activateZoom(); - void activatePanning(); - void activateGlobalPanning(); - void activateReset(); - - void itemRemoved( QCanvasItem* ); - - void setSelectedItem( QxGraph_ActiveItem* theItem ); - QxGraph_ActiveItem* getSelectedItem() const; - - signals: - void viewOperationDone(); - - public slots: - void onTimeout(); - //void changeBackground(); - - protected: - void contentsMousePressEvent(QMouseEvent* theEvent); - void contentsMouseMoveEvent(QMouseEvent* theEvent); - void contentsMouseReleaseEvent(QMouseEvent* theEvent); - void contentsMouseDoubleClickEvent(QMouseEvent* theEvent); - - bool isSelectedItemInCanvas(); - - private: - // for moving items - QCanvasItem* myCurrentItem; - QPoint myPoint; - QPoint myGlobalPoint; - bool myMovingDone; - QPoint myCenter; - - // for control toolbar actions - OperationType myOperation; - QCursor myCursor; - QCanvasRectangle* mySelectedRect; - - // for automatic content scrolling if mouse is outside - QTimer* myTimer; - int myDX; - int myDY; - - // for hilight - QxGraph_ActiveItem* myHilightedItem; - - // for selection - QxGraph_ActiveItem* mySelectedItem; -}; - - -class QxGraph_ToolTip: public QToolTip { - - public: - QxGraph_ToolTip(QWidget* theWidget, QToolTipGroup* theGroup = 0): - QToolTip(theWidget, theGroup) {} - ~QxGraph_ToolTip() { remove(parentWidget()); } - - virtual void maybeTip(const QPoint& theMousePos); -}; - -#endif diff --git a/src/QxGraph/QxGraph_Def.h b/src/QxGraph/QxGraph_Def.h deleted file mode 100644 index 88937e325..000000000 --- a/src/QxGraph/QxGraph_Def.h +++ /dev/null @@ -1,34 +0,0 @@ -// SALOME QxGraph : build Supervisor viewer into desktop -// -// 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 QXGRAPH_DEF_H -#define QXGRAPH_DEF_H - -#define DEF_BACK_COLOR QColor(144, 208, 211) -#define RECTANGLE_BODY QColor(255,249,147) - -#define GRAPH_WIDTH 1250 -#define GRAPH_HEIGHT 950 - -#define GRAPH_MARGIN 50 - -#endif diff --git a/src/QxGraph/QxGraph_Prs.cxx b/src/QxGraph/QxGraph_Prs.cxx deleted file mode 100644 index c9c6b219d..000000000 --- a/src/QxGraph/QxGraph_Prs.cxx +++ /dev/null @@ -1,251 +0,0 @@ -// SALOME QxGraph : build Supervisor viewer into desktop -// -// 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 "QxGraph_Prs.h" - -#include "QxGraph_Canvas.h" -#include "QxGraph_Def.h" // for debug only - -#include "SUIT_Session.h" // for debug only - -/*! - Constructor -*/ -QxGraph_Prs::QxGraph_Prs(QxGraph_Canvas* theCanvas): - myCanvas(theCanvas), - myDMode(0), - needUpdate(true) -{ - myCanvas->addPrs(this); -} - -/*! - Destructor -*/ -QxGraph_Prs::~QxGraph_Prs() -{ - for ( DMode2ItemList::iterator it1 = myDisplayMap.begin(); - it1 != myDisplayMap.end(); - it1++ ) - { - for ( std::list::iterator it2 = (*it1).second.begin(); - it2 != (*it1).second.end(); - it2++ ) - { - QCanvasItem* anItem = *it2; - if ( anItem ) delete anItem; - } - } - - myDisplayMap.clear(); -} - -/*! - Add item to display in the view with index theDMode -*/ -void QxGraph_Prs::addItem(QCanvasItem* theItem, int theDMode) -{ - if ( theDMode == -1 ) // add item for the current display mode - myDisplayMap[myDMode].push_back(theItem); - else - myDisplayMap[theDMode].push_back(theItem); -} - -/*! - Remove item from the view with index theDMode -*/ -void QxGraph_Prs::removeItem(QCanvasItem* theItem, int theDMode) -{ - if ( theDMode == -1 ) // remove item from the current display mode - myDisplayMap[myDMode].remove(theItem); - else - myDisplayMap[theDMode].remove(theItem); -} - -/*! Adds all the items of this presentation for the current display mode - * to the canvas. - */ -void QxGraph_Prs::show() -{ - if ( isToUpdate() ) - update(); - - for ( std::list::iterator it = myDisplayMap[myDMode].begin(); - it != myDisplayMap[myDMode].end(); - it++ ) - { - QCanvasItem* anItem = *it; - if ( anItem ) - { - anItem->setCanvas( myCanvas ); - anItem->show(); - } - } -} - -/*! Removes all the items belonging to this presentation from the canvas. - */ -void QxGraph_Prs::hide() -{ - for ( DMode2ItemList::iterator it1 = myDisplayMap.begin(); - it1 != myDisplayMap.end(); - it1++ ) - { - for ( std::list::iterator it2 = (*it1).second.begin(); - it2 != (*it1).second.end(); - it2++ ) - { - QCanvasItem* anItem = *it2; - if ( anItem ) - { - anItem->setCanvas( 0 ); - } - } - } -} - -/*! Prepare for full recomputation of the presentation - */ -void QxGraph_Prs::setToUpdate( const bool theFlag ) -{ - needUpdate = theFlag; -} - -/*! Re-fills the presentation with items. - * Base implementation just resets flag. - * It should be called at the end by re-implementations. - */ -void QxGraph_Prs::update() -{ - setToUpdate( false ); -} - -/*! - Add a QCanvasRectangle item for display mode DMode -*/ -QCanvasItem* QxGraph_Prs::addRectangleItem(QRect theRect, int theDMode) -{ - QCanvasRectangle* aRectItem; - if ( myCanvas ) - { - QCanvasRectangle* aRectItem = new QCanvasRectangle(theRect, myCanvas); - aRectItem->setZ(0); - aRectItem->show(); - myCanvas->update(); - - // test drawing features: brush, pen ... - QBrush aBr(SUIT_Session::session()->resourceMgr()->colorValue( "QxGraph", "NodeBody", RECTANGLE_BODY )); - aRectItem->setBrush(aBr); - } - addItem(aRectItem); - return aRectItem; -} - -/*! - Add a QCanvasPolygon item for display mode DMode -*/ -QCanvasItem* QxGraph_Prs::addPolygonItem(QPointArray thePA, int theDMode) -{ - QCanvasPolygon* aPolyItem; - if ( myCanvas ) - { - aPolyItem = new QCanvasPolygon(myCanvas); - aPolyItem->setZ(0); - aPolyItem->setPoints(thePA); - aPolyItem->show(); - myCanvas->update(); - - // test drawing features: brush, pen ... - QBrush aBr(SUIT_Session::session()->resourceMgr()->colorValue( "QxGraph", "NodeBody", RECTANGLE_BODY )); - aPolyItem->setBrush(aBr); - QPen aPen(Qt::black,2); - aPolyItem->setPen(aPen); - } - addItem(aPolyItem); - return aPolyItem; -} - -/*! - Add a QCanvasLine item for display mode DMode -*/ -QCanvasItem* QxGraph_Prs::addLineItem(QPoint theStart, QPoint theEnd, int theDMode) -{ - QCanvasLine* aLineItem; - if ( myCanvas ) - { - aLineItem = new QCanvasLine(myCanvas); - aLineItem->setZ(0); - aLineItem->setPoints(theStart.x(), theStart.y(), theEnd.x(), theEnd.y()); - aLineItem->show(); - myCanvas->update(); - - // test drawing features: brush, pen ... - QPen aPen(Qt::black,2); - aLineItem->setPen(aPen); - } - addItem(aLineItem); - return aLineItem; -} - -/*! - Add a QCanvasEllipse item for display mode DMode -*/ -QCanvasItem* QxGraph_Prs::addEllipseItem(int theW, int theH, int theStartAngle, int theAngle, int theDMode) -{ - QCanvasEllipse* aEllipseItem; - if ( myCanvas ) - { - aEllipseItem = new QCanvasEllipse(theW, theH, theStartAngle, theAngle, myCanvas); - aEllipseItem->setZ(0); - aEllipseItem->show(); - myCanvas->update(); - - // test drawing features: brush, pen ... - QBrush aBr(SUIT_Session::session()->resourceMgr()->colorValue( "QxGraph", "NodeBody", RECTANGLE_BODY )); - aEllipseItem->setBrush(aBr); - QPen aPen(Qt::black,2); - aEllipseItem->setPen(aPen); - } - addItem(aEllipseItem); - return aEllipseItem; -} - -/*! - Add a QCanvasText item for display mode DMode -*/ -QCanvasItem* QxGraph_Prs::addTextItem(QString theText, int theDMode) -{ - QCanvasText* aTextItem; - if ( myCanvas ) - { - aTextItem = new QCanvasText(theText, myCanvas); - aTextItem->setZ(0); - aTextItem->show(); - myCanvas->update(); - - // test drawing features: font, color, text flags ... - aTextItem->setColor(Qt::darkBlue); - //aTextItem->setFont(QFont("Times"/*"Helvetica"*/, 14, QFont::Normal, true)); - } - addItem(aTextItem); - return aTextItem; -} diff --git a/src/QxGraph/QxGraph_Prs.h b/src/QxGraph/QxGraph_Prs.h deleted file mode 100644 index 161610314..000000000 --- a/src/QxGraph/QxGraph_Prs.h +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 QXGRAPH_PRS_H -#define QXGRAPH_PRS_H - -#include - -#include -#include -#include - -class QxGraph_Canvas; - -class QXGRAPH_EXPORT QxGraph_Prs -{ - public: - QxGraph_Prs(QxGraph_Canvas*); - virtual ~QxGraph_Prs(); - - QxGraph_Canvas* getCanvas() const { return myCanvas; } - - void addItem(QCanvasItem* theItem, int theDMode = -1); - void removeItem(QCanvasItem* theItem, int theDMode = -1); - - /* add items for display mode theDMode - if theDMode is equal to -1 add item for the current (active) display mode */ - QCanvasItem* addRectangleItem(QRect theRect, int theDMode = -1); - QCanvasItem* addPolygonItem(QPointArray thePA, int theDMode = -1); - QCanvasItem* addLineItem(QPoint theStart, QPoint theEnd, int theDMode = -1); - QCanvasItem* addEllipseItem(int theW, int theH, int theStartAngle, int theAngle, int theDMode = -1); - QCanvasItem* addTextItem(QString theText, int theDMode = -1); - - typedef std::map< int, std::list > DMode2ItemList; - - const DMode2ItemList& getDisplayMap() const { return myDisplayMap; } - const std::list& getItems(int theDMode) { return myDisplayMap[theDMode]; } - - void setDMode(int theDMode) { myDMode = theDMode; } - int getDMode() const { return myDMode; } - - virtual void show(); - virtual void hide(); - virtual void setToUpdate( const bool ); - bool isToUpdate() { return needUpdate; } - -protected: - virtual void update(); - -private: - QxGraph_Canvas* myCanvas; - DMode2ItemList myDisplayMap; - - int myDMode; - bool needUpdate; -}; - -#endif diff --git a/src/QxGraph/QxGraph_ViewManager.cxx b/src/QxGraph/QxGraph_ViewManager.cxx deleted file mode 100644 index 3709afc7e..000000000 --- a/src/QxGraph/QxGraph_ViewManager.cxx +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 "QxGraph_ViewManager.h" - -/*! - Constructor -*/ -QxGraph_ViewManager::QxGraph_ViewManager( SUIT_Study* theStudy, - SUIT_Desktop* theDesktop, - SUIT_ViewModel* theViewModel ) - : SUIT_ViewManager( theStudy, theDesktop, theViewModel ) -{ -} - -/*! - Destructor -*/ -QxGraph_ViewManager::~QxGraph_ViewManager() -{ -} - -/*! - Sets view name - \param theView - view to assign name -*/ -void QxGraph_ViewManager::setViewName(SUIT_ViewWindow* theView) -{ - int aPos = myViews.find(theView); - theView->setCaption( QString( "QxGraph scene:%1 - viewer:%2" ).arg( myId ).arg(aPos+1)); -} - -/*! - Fills popup menu with custom actions - \param popup - popup menu to be filled with -*/ -void QxGraph_ViewManager::contextMenuPopup( QPopupMenu* thePopup) -{ - SUIT_ViewManager::contextMenuPopup( thePopup ); - // to be implemented -} diff --git a/src/QxGraph/QxGraph_ViewManager.h b/src/QxGraph/QxGraph_ViewManager.h deleted file mode 100644 index 2e45cc3a6..000000000 --- a/src/QxGraph/QxGraph_ViewManager.h +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 QXGRAPH_VIEWMANAGER_H -#define QXGRAPH_VIEWMANAGER_H - -#include "QxGraph.h" - -#include "QxGraph_ViewModel.h" -#include "SUIT_ViewManager.h" - -class SUIT_Desktop; - -class QXGRAPH_EXPORT QxGraph_ViewManager : public SUIT_ViewManager -{ - Q_OBJECT - -public: - QxGraph_ViewManager( SUIT_Study* theStudy, SUIT_Desktop* theDesktop, SUIT_ViewModel* theViewModel = 0 ); - ~QxGraph_ViewManager(); - - virtual void contextMenuPopup( QPopupMenu* thePopup ); - -protected: - void setViewName(SUIT_ViewWindow* theView); - -}; - -#endif diff --git a/src/QxGraph/QxGraph_ViewModel.cxx b/src/QxGraph/QxGraph_ViewModel.cxx deleted file mode 100644 index df49f0829..000000000 --- a/src/QxGraph/QxGraph_ViewModel.cxx +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 "QxGraph_ViewModel.h" -#include "QxGraph_ViewWindow.h" -#include "QxGraph_Canvas.h" -#include "QxGraph_CanvasView.h" -#include "QxGraph_Def.h" -#include "QxGraph_Prs.h" - -#include "SUIT_Desktop.h" -#include "SUIT_ViewWindow.h" -#include "SUIT_Session.h" - -#include -#include -#include // for addRectangleItem(...) method (can be removed in the future) - -/*! - Constructor -*/ -QxGraph_Viewer::QxGraph_Viewer() - :SUIT_ViewModel(), - myCanvas(0), - myCurrentView(0) -{ - printf("Construct QxGraph_Viewer\n"); - //myCanvases.setAutoDelete(true); - //myCanvasViews.setAutoDelete(true); -} - -/*! - Destructor -*/ -QxGraph_Viewer::~QxGraph_Viewer() -{ - if ( myCanvas ) delete myCanvas; - //if ( !myCanvases.isEmpty() ) myCanvases.clear(); - if ( !myCanvasViews.isEmpty() ) myCanvasViews.clear(); - myCurrentView = 0; -} - -/*! - Start initialization of view window - \param view - view window to be initialized -*/ -void QxGraph_Viewer::initView( QxGraph_ViewWindow* view ) -{ - if ( view ) - { - view->initLayout(); - - /* - // test add items into the current canvas view - QRect aRect(100,200,200,100); - QCanvasItem* aRectItem = aPrs->addRectangleItem(aRect); - //delete aRectItem; - - QPointArray aPA(6); - aPA.putPoints(0, 6, 400,100, 500,70, 600,100, 600,200, 500,230, 400,200); - QCanvasItem* aPolyItem = aPrs->addPolygonItem(aPA); - //delete aPolyItem; - - QPoint aStart(500,300), aEnd(700,250); - QCanvasItem* aLineItem = aPrs->addLineItem(aStart, aEnd); - //delete aLineItem; - - QCanvasItem* aEllipseItem = aPrs->addEllipseItem(200, 100, 30*16, 120*16); - aEllipseItem->setX(400); - aEllipseItem->setY(400); - //delete aEllipseItem; - - QCanvasItem* aTextItem = aPrs->addTextItem("This is a QCanvasText item"); - aTextItem->setX(100); - aTextItem->setY(500); - //delete aTextItem; - */ - } -} - -/*! - Creates new view window - \param theDesktop - main window of application -*/ -SUIT_ViewWindow* QxGraph_Viewer::createView(SUIT_Desktop* theDesktop) -{ - QxGraph_ViewWindow* aRes = new QxGraph_ViewWindow( theDesktop, this ); - initView( aRes ); - return aRes; -} - -/*! - Set view with index theIndex from myCanvasViews as current view - \param theIndex - the index of the view in the list -*/ -void QxGraph_Viewer::setCurrentView(int theIndex) -{ - if ( theIndex >= 0 && theIndex < myCanvasViews.count() ) - { - myCurrentView = myCanvasViews.at(theIndex); - myViewManager->getActiveView()->setCentralWidget(myCurrentView); - } -} - -/*! - Builds popup for QxGraph viewer -*/ -void QxGraph_Viewer::contextMenuPopup(QPopupMenu* thePopup) -{ - printf("QxGraph_Viewer::contextMenuPopup\n"); - thePopup->insertItem( tr( "MEN_CHANGE_BACKGROUND" ), this, SLOT( onChangeBgColor() ) ); - - thePopup->insertSeparator(); - - QxGraph_ViewWindow* aView = (QxGraph_ViewWindow*)(myViewManager->getActiveView()); - if ( aView && !aView->getToolBar()->isVisible() ) - thePopup->insertItem( tr( "MEN_SHOW_TOOLBAR" ), this, SLOT( onShowToolbar() ) ); -} - -/*! - SLOT: called if background color is to be changed changed, passes new color to current canvas view -*/ -void QxGraph_Viewer::onChangeBgColor() -{ - QxGraph_ViewWindow* aView = (QxGraph_ViewWindow*)(myViewManager->getActiveView()); - if( !aView ) - return; - QColor aColorActive = aView->backgroundColor(); - - QColor selColor = QColorDialog::getColor( aColorActive, aView); - if ( selColor.isValid() ) - aView->setBackgroundColor(selColor); -} - -/*! - SLOT: called when popup item "Show toolbar" is activated, shows toolbar of active view window -*/ -void QxGraph_Viewer::onShowToolbar() { - QxGraph_ViewWindow* aView = (QxGraph_ViewWindow*)(myViewManager->getActiveView()); - if ( aView ) - aView->getToolBar()->show(); -} diff --git a/src/QxGraph/QxGraph_ViewModel.h b/src/QxGraph/QxGraph_ViewModel.h deleted file mode 100644 index e04fcb35e..000000000 --- a/src/QxGraph/QxGraph_ViewModel.h +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 QXGRAPH_VIEWMODEL_H -#define QXGRAPH_VIEWMODEL_H - -#include "QxGraph.h" - -#include "SUIT_ViewModel.h" - -class QCanvasItem; // for addRectangleItem(...) method (can be removed in the future) - -class QxGraph_Canvas; -class QxGraph_CanvasView; -class QxGraph_ViewWindow; -class QxGraph_Prs; - -class QXGRAPH_EXPORT QxGraph_Viewer: public SUIT_ViewModel -{ - Q_OBJECT - - public: - static QString Type() { return "QxGraphViewer"; } - - QxGraph_Viewer(); - virtual ~QxGraph_Viewer(); - - virtual SUIT_ViewWindow* createView(SUIT_Desktop* theDesktop); - virtual QString getType() const { return Type(); } - - virtual void contextMenuPopup(QPopupMenu*); - - QxGraph_Canvas* getCanvas() const { return myCanvas; } - void setCanvas(QxGraph_Canvas* theCanvas) { myCanvas = theCanvas; } - //QPtrList getCanvases() { return myCanvases; } - //void setCanvases(QPtrList theCanvases) { myCanvases = theCanvases; } - - //void addCanvas(QxGraph_Canvas* theCanvas) { myCanvases.append(theCanvas); } - //void removeCanvas(QxGraph_Canvas* theCanvas) { myCanvases.remove(theCanvas); } - - QPtrList getCanvasViews() { return myCanvasViews; } - void setCanvasViews(QPtrList theViews) { myCanvasViews = theViews; } - - void addView(QxGraph_CanvasView* theView) { myCanvasViews.append(theView); } - void removeView(QxGraph_CanvasView* theView) { myCanvasViews.remove(theView); } - - QxGraph_CanvasView* getCurrentView() const { return myCurrentView; } - void setCurrentView(QxGraph_CanvasView* theView) { myCurrentView = theView; } - void setCurrentView(int theIndex); - - protected: - void initView(QxGraph_ViewWindow* view); - - protected slots: - void onShowToolbar(); - void onChangeBgColor(); - - private: - QxGraph_Canvas* myCanvas; - //QPtrList myCanvases; - QPtrList myCanvasViews; - - QxGraph_CanvasView* myCurrentView; - -}; - -#endif diff --git a/src/QxGraph/QxGraph_ViewWindow.cxx b/src/QxGraph/QxGraph_ViewWindow.cxx deleted file mode 100644 index 1e64a8b06..000000000 --- a/src/QxGraph/QxGraph_ViewWindow.cxx +++ /dev/null @@ -1,288 +0,0 @@ -// SALOME QxGraph : build Supervisor viewer into desktop -// -// 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 "QxGraph_ViewWindow.h" -#include "QxGraph_Def.h" -#include "QxGraph_Canvas.h" -#include "QxGraph_CanvasView.h" - -#include -#include -#include - -//QT Include -#include -#include -//#include - -using namespace std; - -/*! - Constructor -*/ -QxGraph_ViewWindow::QxGraph_ViewWindow( SUIT_Desktop* theDesktop, QxGraph_Viewer* theModel) - : SUIT_ViewWindow( theDesktop ) -{ - printf("Construct QxGraph_ViewWindow\n"); - myViewModel = theModel; -} - -/*! - Initialization -*/ -void QxGraph_ViewWindow::initLayout() -{ - initCanvas(); - initCanvasViews(); - - myToolBar = new QToolBar(this); - myToolBar->setCloseMode(QDockWindow::Undocked); - myToolBar->setLabel(tr("LBL_TOOLBAR_LABEL")); - createActions(); - createToolBar(); -} - -/*! - Canvas initialization -*/ -void QxGraph_ViewWindow::initCanvas() -{ - if ( myViewModel ) - myViewModel->setCanvas( new QxGraph_Canvas(resMgr()) ); - //myViewModel->addCanvas( new QxGraph_Canvas(resMgr()) ); -} - -/*! - Canvas views initialization -*/ -void QxGraph_ViewWindow::initCanvasViews() -{ - if ( myViewModel ) - { - for (int i = 0; i < 2; i++) - { - //QxGraph_Canvas* aCanvas = new QxGraph_Canvas(resMgr()); - //myViewModel->addCanvas( aCanvas ); - - QxGraph_CanvasView* aCanvasView = new QxGraph_CanvasView( myViewModel->getCanvas(), this ); - //QxGraph_CanvasView* aCanvasView = new QxGraph_CanvasView( aCanvas, this ); - myViewModel->addView(aCanvasView); - - aCanvasView->hide(); - } - - // the first view is shown and is the current - myViewModel->getCanvasViews().first()->show(); - myViewModel->setCurrentView( myViewModel->getCanvasViews().first() ); - - /* test for 1 view --> - QxGraph_CanvasView* aCanvasView = new QxGraph_CanvasView( myViewModel->getCanvas(), this ); - myViewModel->addView(aCanvasView); - myViewModel->setCurrentView(aCanvasView); - test for 1 view <-- */ - - setCentralWidget( myViewModel->getCurrentView() ); - - /*if ( inherits( "QMainWindow" ) ) { - printf("== > 1\n"); - ( ( QMainWindow* )this )->setCentralWidget( myViewModel->getCurrentView() ); - } - else { - printf("== > 2\n"); - QBoxLayout* layout = new QVBoxLayout( this ); - layout->addWidget( myViewModel->getCurrentView() ); - }*/ - } -} - -/*! - Creates actions of QxGraph view window -*/ -void QxGraph_ViewWindow::createActions() -{ - if (!myActionsMap.isEmpty()) return; - SUIT_ResourceMgr* aResMgr = resMgr(); - QtxAction* aAction; - - // FitAll - aAction = new QtxAction(tr("MNU_FITALL"), aResMgr->loadPixmap( "QxGraph", tr( "ICON_QXGRAPH_FITALL" ) ), - tr( "MNU_FITALL" ), 0, this); - aAction->setStatusTip(tr("DSC_FITALL")); - connect(aAction, SIGNAL(activated()), this, SLOT(onViewFitAll())); - myActionsMap[ FitAllId ] = aAction; - - // FitRect - aAction = new QtxAction(tr("MNU_FITRECT"), aResMgr->loadPixmap( "QxGraph", tr( "ICON_QXGRAPH_FITAREA" ) ), - tr( "MNU_FITRECT" ), 0, this); - aAction->setStatusTip(tr("DSC_FITRECT")); - connect(aAction, SIGNAL(activated()), this, SLOT(onViewFitArea())); - myActionsMap[ FitRectId ] = aAction; - - // Zoom - aAction = new QtxAction(tr("MNU_ZOOM_VIEW"), aResMgr->loadPixmap( "QxGraph", tr( "ICON_QXGRAPH_ZOOM" ) ), - tr( "MNU_ZOOM_VIEW" ), 0, this); - aAction->setStatusTip(tr("DSC_ZOOM_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onViewZoom())); - myActionsMap[ ZoomId ] = aAction; - - // Panning - aAction = new QtxAction(tr("MNU_PAN_VIEW"), aResMgr->loadPixmap( "QxGraph", tr( "ICON_QXGRAPH_PAN" ) ), - tr( "MNU_PAN_VIEW" ), 0, this); - aAction->setStatusTip(tr("DSC_PAN_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onViewPan())); - myActionsMap[ PanId ] = aAction; - - // Global Panning - aAction = new QtxAction(tr("MNU_GLOBALPAN_VIEW"), aResMgr->loadPixmap( "QxGraph", tr( "ICON_QXGRAPH_GLOBALPAN" ) ), - tr( "MNU_GLOBALPAN_VIEW" ), 0, this); - aAction->setStatusTip(tr("DSC_GLOBALPAN_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onViewGlobalPan())); - myActionsMap[ GlobalPanId ] = aAction; - - // Reset - aAction = new QtxAction(tr("MNU_RESET_VIEW"), aResMgr->loadPixmap( "QxGraph", tr( "ICON_QXGRAPH_RESET" ) ), - tr( "MNU_RESET_VIEW" ), 0, this); - aAction->setStatusTip(tr("DSC_RESET_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onViewReset())); - myActionsMap[ ResetId ] = aAction; -} - -/*! - Creates toolbar of QxGraph view window -*/ -void QxGraph_ViewWindow::createToolBar() -{ - SUIT_ToolButton* aScaleBtn = new SUIT_ToolButton(myToolBar, "scale"); - aScaleBtn->AddAction(myActionsMap[FitAllId]); - aScaleBtn->AddAction(myActionsMap[FitRectId]); - aScaleBtn->AddAction(myActionsMap[ZoomId]); - - SUIT_ToolButton* aPanningBtn = new SUIT_ToolButton(myToolBar, "pan"); - aPanningBtn->AddAction(myActionsMap[PanId]); - aPanningBtn->AddAction(myActionsMap[GlobalPanId]); - - myActionsMap[ResetId]->addTo(myToolBar); -} - -/*! - Destructor -*/ -QxGraph_ViewWindow::~QxGraph_ViewWindow() {} - -/*! - Reset the active view -*/ -void QxGraph_ViewWindow::onViewReset() -{ - printf( "QxGraph_ViewWindow::onViewReset\n" ); - if ( myViewModel && myViewModel->getCurrentView() ) - myViewModel->getCurrentView()->activateReset(); -} - -/*! - Sets a new center of the active view -*/ -void QxGraph_ViewWindow::onViewGlobalPan() -{ - printf( "QxGraph_ViewWindow::onViewGlobalPan\n" ); - if ( myViewModel && myViewModel->getCurrentView() ) - myViewModel->getCurrentView()->activateGlobalPanning(); -} - -/*! - Zooms the active view -*/ -void QxGraph_ViewWindow::onViewZoom() -{ - printf( "QxGraph_ViewWindow::onViewZoom\n" ); - if ( myViewModel && myViewModel->getCurrentView() ) - myViewModel->getCurrentView()->activateZoom(); -} - -/*! - Moves the active view -*/ -void QxGraph_ViewWindow::onViewPan() -{ - printf( "QxGraph_ViewWindow::onViewPan\n" ); - if ( myViewModel && myViewModel->getCurrentView() ) - myViewModel->getCurrentView()->activatePanning(); -} - -/*! - Fits all obejcts within a rectangular area of the active view -*/ -void QxGraph_ViewWindow::onViewFitArea() -{ - printf( "QxGraph_ViewWindow::onViewFitArea\n" ); - if ( myViewModel && myViewModel->getCurrentView() ) - myViewModel->getCurrentView()->activateFitRect(); -} - -/*! - Fits all objects in the active view -*/ -void QxGraph_ViewWindow::onViewFitAll() -{ - printf( "QxGraph_ViewWindow::onViewFitAll\n" ); - if ( myViewModel && myViewModel->getCurrentView() ) - myViewModel->getCurrentView()->activateFitAll(); -} - -/*! - Set background of the viewport -*/ -void QxGraph_ViewWindow::setBackgroundColor( const QColor& color ) -{ - if ( myViewModel && myViewModel->getCurrentView()) { - myViewModel->getCurrentView()->canvas()->setBackgroundColor(color); - myViewModel->getCurrentView()->setPaletteBackgroundColor(color.light(120)); - } -} - -/*! - Returns background of the viewport -*/ -QColor QxGraph_ViewWindow::backgroundColor() const -{ - if ( myViewModel && myViewModel->getCurrentView()) - return myViewModel->getCurrentView()->canvas()->backgroundColor(); - return QColor(); -} - -/*! - Custom resize event handler -*/ -void QxGraph_ViewWindow::resizeEvent( QResizeEvent* theEvent ) -{ - // QMainWindow::resizeEvent( theEvent ); - //if ( myView ) myView->resizeView( theEvent ); -} - -/*! - Get resource manager -*/ -SUIT_ResourceMgr* QxGraph_ViewWindow::resMgr() const -{ - return SUIT_Session::session()->resourceMgr(); -} - diff --git a/src/QxGraph/QxGraph_ViewWindow.h b/src/QxGraph/QxGraph_ViewWindow.h deleted file mode 100644 index 88fe11bed..000000000 --- a/src/QxGraph/QxGraph_ViewWindow.h +++ /dev/null @@ -1,95 +0,0 @@ -// SALOME QxGraph : build Supervisor viewer into desktop -// -// 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 QXGRAPH_VIEWWINDOW_H -#define QXGRAPH_VIEWWINDOW_H - -#include "QxGraph.h" -#include "QxGraph_ViewModel.h" - -#include "SUIT_ViewWindow.h" - -#include "QtxAction.h" - -#include - -#ifdef WIN32 -#pragma warning ( disable:4251 ) -#endif - -class SUIT_ResourceMgr; - -class QXGRAPH_EXPORT QxGraph_ViewWindow : public SUIT_ViewWindow { - Q_OBJECT - - public: - QxGraph_ViewWindow(SUIT_Desktop* theDesktop, QxGraph_Viewer* theModel); - virtual ~QxGraph_ViewWindow(); - - void setBackgroundColor( const QColor& ); - QColor backgroundColor() const; - - QToolBar* getToolBar() { return myToolBar; } - - SUIT_ResourceMgr* resMgr() const; - - QxGraph_Viewer* getViewModel() const { return myViewModel; } - void setViewModel(QxGraph_Viewer* theViewModel) { myViewModel = theViewModel; } - - virtual void initLayout(); - - void contextPopupEvent(QContextMenuEvent* theEvent) { emit contextMenuRequested( theEvent); } - - public slots: - void onViewFitAll(); - void onViewFitArea(); - void onViewZoom(); - void onViewPan(); - void onViewGlobalPan(); - void onViewReset(); - - protected: - void resizeEvent( QResizeEvent* theEvent ); - - virtual void initCanvas(); - virtual void initCanvasViews(); - - private: - void createActions(); - void createToolBar(); - - //! Actions ID - enum { FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, ResetId }; - typedef QMap ActionsMap; - - ActionsMap myActionsMap; - QToolBar* myToolBar; - - QxGraph_Viewer* myViewModel; - -}; - -#ifdef WIN32 -#pragma warning ( default:4251 ) -#endif - -#endif diff --git a/src/QxGraph/resources/QxGraph_images.po b/src/QxGraph/resources/QxGraph_images.po deleted file mode 100644 index 3b59f6125..000000000 --- a/src/QxGraph/resources/QxGraph_images.po +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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: QxGraph_images.po -// Created: 03/02/2007 -// Author: Margarita Karpunina -// Copyright (C) CEA 2007 - - -msgid "ICON_QXGRAPH_FITALL" -msgstr "view_fitall.png" - -msgid "ICON_QXGRAPH_FITAREA" -msgstr "view_fitarea.png" - -msgid "ICON_QXGRAPH_ZOOM" -msgstr "view_zoom.png" - -msgid "ICON_QXGRAPH_PAN" -msgstr "view_pan.png" - -msgid "ICON_QXGRAPH_GLOBALPAN" -msgstr "view_glpan.png" - -msgid "ICON_QXGRAPH_RESET" -msgstr "view_reset.png" - diff --git a/src/QxGraph/resources/QxGraph_images.ts b/src/QxGraph/resources/QxGraph_images.ts deleted file mode 100644 index 4ccbe37ae..000000000 --- a/src/QxGraph/resources/QxGraph_images.ts +++ /dev/null @@ -1,29 +0,0 @@ - - - @default - - ICON_QXGRAPH_RESET - qx_view_reset.png - - - ICON_QXGRAPH_ZOOM - qx_view_zoom.png - - - ICON_QXGRAPH_GLOBALPAN - qx_view_glpan.png - - - ICON_QXGRAPH_PAN - qx_view_pan.png - - - ICON_QXGRAPH_FITALL - qx_view_fitall.png - - - ICON_QXGRAPH_FITAREA - qx_view_fitarea.png - - - diff --git a/src/QxGraph/resources/QxGraph_msg_en.po b/src/QxGraph/resources/QxGraph_msg_en.po deleted file mode 100644 index 670735b24..000000000 --- a/src/QxGraph/resources/QxGraph_msg_en.po +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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: QxGraph_msg_en.po -// Created: 03/02/2007 -// Author: Margarita Karpunina -// Copyright (C) CEA 2007 - -msgid "LBL_TOOLBAR_LABEL" -msgstr "View Operations" - -msgid "DSC_RESET_VIEW" -msgstr "Reset View Point" - -msgid "MNU_RESET_VIEW" -msgstr "Reset" - -msgid "DSC_PAN_VIEW" -msgstr "Panning the view" - -msgid "MNU_PAN_VIEW" -msgstr "Panning" - -msgid "MEN_CHANGE_BACKGROUND" -msgstr "Change background..." diff --git a/src/QxGraph/resources/QxGraph_msg_en.ts b/src/QxGraph/resources/QxGraph_msg_en.ts deleted file mode 100644 index 1e20c9642..000000000 --- a/src/QxGraph/resources/QxGraph_msg_en.ts +++ /dev/null @@ -1,29 +0,0 @@ - - - @default - - MEN_CHANGE_BACKGROUND - Change background... - - - MNU_PAN_VIEW - Panning - - - DSC_PAN_VIEW - Panning the view - - - MNU_RESET_VIEW - Reset - - - DSC_RESET_VIEW - Reset View Point - - - LBL_TOOLBAR_LABEL - View Operations - - - diff --git a/src/QxGraph/resources/qx_view_fitall.png b/src/QxGraph/resources/qx_view_fitall.png deleted file mode 100755 index 87e001dd80b2755858d4599857106a0c9c0b3500..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 816 zcmV-01JC@4P)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ;rb$FWRCwBA{Qv(y12q9a0I`6G?+lD6rgAd;XCy{5 zHhlmA#Dc^@mIHB63}s|w3&>x^7VEp$V z!_S{T8NPo0%wTSB4^{^=10aA{2t*_sGYc!&H9+&gF8uxbH^cX@Ux5bxVEFUvH&_hp zNhkmaASMC^p1OMBJi~90i+=rL`10u!!-sco89u&$$ME^%M~1IozA)UpbP22urU4*; z81W@+U>Ndq^YVU}wt5|dps+B*k8j@@e*E~(@bkwHhQELQGJN^`k)bg^7i72+(46}q zJpciO*M(YIT7fc>k_-*mnGENS9|s!*!oPv8y?^^ALw|iO$gn1uVITkyKn&QD3J3!Y zt1#5l`yc4!^j}9?`#%#C(;-P2+5cJwhW{mHWkKFL1H{Sb`Tzn5YousvYge$bu(Yd+ zi!(g^@BtL?iGTn8T>uOM_2*9>%K?=<1!}&AO)o$IVT2*juu`C5U1~tXo&y8^?Uyf= zSFc{}AhvJ-2p}dj!}3{~naMT`1ONgE>_SkfVWO=i2{i0E$eXW$2^NUUfQEGwYY@l` zP;LPTAh-*gnwp;TadI-eff!amiebp56hHvMT?i_^fL=}k3i1H)bfAI1NHGa!20#G8 u4Wv>5%K#8S$g%vNP}zvfo5&o100RIgKz|e1YHVKs0000aa diff --git a/src/QxGraph/resources/qx_view_fitarea.png b/src/QxGraph/resources/qx_view_fitarea.png deleted file mode 100755 index 450dc56c6ce722c040b4e5b77459207e8256cd58..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 912 zcmV;B18@9^P)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ<21!IgRCwBA`2YVu0|yT@j4)mLY4&S1Wi z-OcbHM57sG48)m^9-he_0f7usvT_X1pFT0(yLC(8&W#(k0Oh^{@n4u?fB<44!Y5g^ z-MvYH5s?faC;S8YMon9X!N%2{!P42~V^d*1!@s|O;pPAY5EB8zLY%$4ll;RYzy^Ww zzyAz>|Nmq7`|lrvqn8hZdq5CKT`^1pKmZXkFx1h@8)yK~5THSSfQEqa-+v50fBt0n z`uQ`1xxGC|T`bJU00BhE%bd(CtYFsw%>%pe_wU~f-@kqZ8u)|Z&#&KLF(43ts^eU0F)F)_Iu>vs%)X>*Rt^|Sq00D$yAS*L-7tFAGPoM68`t<2NpzvEDJ`2PkgPEZQ zf?W3=>e4ST{Qv>Pgyb@bC5sj@fV}w<7@K#WJlO{{>@HC171XfPKztRHl%RYNeIJNF z01K4gATvM(3qSzDi!W_$?G#}ip4rTdj11l(AtV=F=_OOZ1q?s{!3|_&WMorRR4o7X z>z4u0Wlx|ky9mWEfcQ5q!$2+r83v*O0tneaP`Ky0YCsD8wiRZ mF(6igmT$M9kwFpw2rvMsC6+#;$I7?>0000P)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZc>jKeOv$OzL15I`)*h9FA-UC3*1Z~uwm?OTSQ4<0bQ ze(?e}13&j7BtjOg8oBY{u_wj195)S?b{&f6+rwNh(Uq* zK0ZGF9!TB4fBzVey$%pSph#d!NlE$3!NI}s_3KxL7r?*=#V#=XRDg2aKr9Qy%0Mg# zwcu`6R@RnZzkY$$K7Ra|;oiM_44*%L1}7(g00Oy$^}~k`3@Z!_7=WS-7i47_^npo& z_1d*NKskL-Yy$BYAm#zl;o;#2riOWv!1Q5tTw%b52J!EBN z_zMj9Ye2(a0MpVAL405VabQDXA%mWt-g{_beh*a#GW3?PurN#?D4ah51P}|7@?T7UooaWF76FUtY(e=N8Ih<%~* zEa-Xx0ti>}^$+SLM<6zX=4AnBQUWFN&ro@cDgYqB0GrW?VpB4t`v3p{07*qoM6N<$ Eg6tg6&Hw-a diff --git a/src/QxGraph/resources/qx_view_pan.png b/src/QxGraph/resources/qx_view_pan.png deleted file mode 100755 index ec56cacc779342a978f183ecf747860c8b6dafb4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 982 zcmV;{11bE8P)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZb!otG-18H_3W&!c>DFz52f`;Yh z=KlYG@Zf(vJw1@2;y}!e&rpB>!e<*(Vq)UoNnv3OZ?0TnIIE=v5_imOsnQ(>_Q@}D9Q|HpzmfY=u#@9*!A5&HlE#0WDiKR^HPSD@Ek zzkbaCa@oa;7a4y4{_O{p(+6UCAm#(&Px|`$DQaqJ3~X#{4Da5(V|e)RA;Yz6*FdiR z0t!=r00NsF6BF}yLQoI`!>?Zq4Bx&nFns>Zz!(z)vWNqS-$A_va>-9lVB{=URRycP zpsdWG&(6-kdhOZ^SVRE?5Q~nE&fmqMp$spM9AUWs@+E@^Q1mI#KqwFe;@8la1=_~I z2J*$jJ9ilVe*DOA?ZXF#7k~dU%-7RnNW63j9QyzP#B$}z6$wUv{}&HSOBrrFdBPyW z&(HAr=TDe{d{D#gLnA=o6)=Lf|NhPJ2I#_XKyN<>8oU@7aj@722p~`x$^o%15O2W} zQ4K(R5QwirT?%sXD=g|(05K?CodF0SP#A)o^9gFhL?B)Zjj^{zMn(Vgg6j zxpU_jK79D#4wN$jVr3vsfvN|&{yoSXfB<5F#?CWnLd}P!GmwE_`1tr3R)vHxJUVoU z;RMiI;U7Ty82F(McnHLu(3}E_l-nS400M{wntfhCo&E)yX#avZ-#{@A45MF<9x;Hz z4lSY{BV~fOP)EH02p|@y4KPE$Kyv_tjEu~^`}glN965WI;l_&>3~!m4VFpeGVn3)0 zVaeeeEFA&_5G?D#4E+fW52hzio+tt7dm^Ah;l~e#JMZ4X4D5u`pP`QU2lWw%{s$01 zxUwNTH0uR`vRkc+3M|{L0pd2OxFS>?3IGToW*i2Bk`pV``xg$qd*=yF8X#vr0J$9M zy07T20tg^xJOwPwRUpGpK{Y>y#^wX4;lH73-~b@N0A_|Q{Wj4Xb^rhX07*qoM6N<$ Ef)-GsSpWb4 diff --git a/src/QxGraph/resources/qx_view_reset.png b/src/QxGraph/resources/qx_view_reset.png deleted file mode 100755 index 66f81e60471b7b587c37166a4e206b45f74e7fc2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 918 zcmV;H18Mw;P)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ<3`s;mRCwBA`2YVu0}KO!sHi9>h~bSaP6`GHAOZXQ009Iu ztVK?a_y6WCKL3CH$@>5IfA;^Iw`2aBnTdlW&7exTp@zi+u{AD30Ro7Lk&#hUNQk5Q z?D;STpjR1~nHj+nii&(-KGfwPzyqZXfLH~Ij{*P!hzW=@vvYJAfQEtvwrzdL@b~Y3 zhTx#>3=Q?CrT~SeL)CtP(l4O+3pN7*0*D2Ojg5^(!JOKflMHLu++jF%N|j;rru$QX z!I2B}0Zi>zGy}h4GY}wvKrZ|XauEp3n0^K5WhREsj&mSx69e%89{T_R1ajfcn>Rmz zIq%;60AXz)^A6B;zi?=K-}sfC-?tzTH62r z+1dZM`}+RpVPyp=a)o&VAb=Q=3jlDg;ox}n@#jy5zyJSR0p*SZ#Xz=e0L9NFXlO8m zC@V8qN=Sg!-~8}_;lk_J40EqvXW0Gtu^UimH$VWPmo_{g8)rH={0C|R3ET$aE+9^W z#_sAO0|T(@KsZfX8>D6hvI_wMh!MSr0=mcm=$i9OU0oSe`1u*u-@C_f=i^5PHYO$p zdueHgKqVyxW?=4l`t>V=_OfLRAAkK40Gja;rXL`H7_pRjAVWa`o#`Ya<56K`#Na9` ziz0vj(z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ;lSxEDRCwBA{Qv(y12q9a05LI882|(j3yAp6z=+{Y zPKN)C$b3dd#y}ty1;mO#{0NBG0DZR%T^~RIu^?$iH}pTm97baxo$2V|nd}h|$RH&v z$MF2=6XU&Gw*&&^{D5-Pfd(IhX#xl!22dE{!$2^nw!8QLxyR4`p9SL6kDmTN`QXX_ zWA`8bZ*#;G5q}bli};<&kW}F_F#1|4FCbe zLcl;aW)@bkYk=l~UHJR=Z-(z*zXA>X!SLtTZ?G6R8lV6mfC#zp)YS{;8GeIY^y?SH zmrtJL&@bUdShR+{AGJO5=h2iF{4FCbeh%aFS!;qhwm-oZ8)$14pg@qY@ zeEZJuHQCMa{8~Mt^J>giRqA}jO>3c z1H=E4va%p=odM!xbbSB;gf&vMwY4kQSXkOs#l;z(e)s?i_{6_||1JOqf%@|&kL7?$ zo&q&r!=@J?fH1-kXjm!Gur4*AVb6g9|Mtt5%Bxqec3{&C%ChKL6d-_@&RKiH#D= b009O7QZ{F9XF19?00000NkvXXu0mjfwM|pG diff --git a/src/ResExporter/Makefile.am b/src/ResExporter/Makefile.am deleted file mode 100755 index 8021b5aab..000000000 --- a/src/ResExporter/Makefile.am +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms 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 $(top_srcdir)/adm_local/unix/make_common_starter.am - -bin_PROGRAMS= ResourceExporter - -dist_ResourceExporter_SOURCES=ResourceExporter.cxx - -ResourceExporter_CPPFLAGS= $(QT_INCLUDES) -I$(srcdir)/../Qtx -I$(srcdir)/../SUIT - -ResourceExporter_LDFLAGS= $(QT_MT_LIBS) -ResourceExporter_LDADD= ../SUIT/libsuit.la ../Qtx/libqtx.la diff --git a/src/ResExporter/ResExporter.pro b/src/ResExporter/ResExporter.pro deleted file mode 100644 index 1f96eae8a..000000000 --- a/src/ResExporter/ResExporter.pro +++ /dev/null @@ -1,17 +0,0 @@ -TEMPLATE = -TARGET = ResourceExporter -DESTDIR = ../../bin -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -INCLUDEPATH += ../../include ../Qtx ../SUIT -LIBS += -L../../lib -lqtx -lsuit - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += - -SOURCES = ResourceExporter.cxx - diff --git a/src/ResExporter/ResourceExporter.cxx b/src/ResExporter/ResourceExporter.cxx deleted file mode 100644 index bdb5a157a..000000000 --- a/src/ResExporter/ResourceExporter.cxx +++ /dev/null @@ -1,171 +0,0 @@ -// Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 : ResourceExporter.cxx -// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// - -/* - This tool provides command-line interface allowing to modify user preferences. - The tool can be used by the compilation procedures in order to set default preferences for the module. - - Usage: - ResourceExporter - Parameters have the following format: - '

:=' - to set for the user - preference from the
section; - '
:+=[|]' - the is appended to the current value - of the preference from the
section; - separator is used to concatenate old and new values, - by default comma (',') symbol is used - '-
:' - to remove user preference from the
- section. Note that only use preference file is - influenced, you may need to use '
:=""' - option - The number of parameters is limeted only by maximum possible length of the command line. -*/ - -#include "SUIT_ResourceMgr.h" -#include -#include -#include -#include -#include - -/*! - \return the SALOME version number -*/ -static QString salomeVersion() -{ - QString path( ::getenv( "GUI_ROOT_DIR" ) ); - if ( !path.isEmpty() ) - path += QDir::separator(); - path += QString( "bin/salome/VERSION" ); - - QFile vf( path ); - if ( !vf.open( QIODevice::ReadOnly ) ) - return QString(); - - QString line( vf.readLine( 1024 ) ); - vf.close(); - - if ( line.isEmpty() ) - return QString(); - - while ( !line.isEmpty() && line.at( line.length() - 1 ) == QChar( '\n' ) ) - line.remove( line.length() - 1, 1 ); - - QString ver; - int idx = line.lastIndexOf( ":" ); - if ( idx != -1 ) - ver = line.mid( idx + 1 ).trimmed(); - - return ver; -} - -/*! - print the help information -*/ -static void help() -{ - std::cout << "" << std::endl; - std::cout << "ResourceExporter: provides command-line interface to modify user preferences." << std::endl; - std::cout << "" << std::endl; - std::cout << "Usage:" << std::endl; - std::cout << " ResourceExporter " << std::endl; - std::cout << "Parameters have the following format:" << std::endl; - std::cout << " '
:=' - to set for the user " << std::endl; - std::cout << " preference from the
section;" << std::endl; - std::cout << " '
:+=[|]' - the is appended to the current value " << std::endl; - std::cout << " of the preference from the
section;" << std::endl; - std::cout << " separator is used to concatenate old and new values," << std::endl; - std::cout << " by default comma (',') symbol is used" << std::endl; - std::cout << " '-
:' - to remove user preference from the
" << std::endl; - std::cout << " section. Note that only use preference file is " << std::endl; - std::cout << " influenced, you may need to use '
:=""'" << std::endl; - std::cout << " option" << std::endl; - std::cout << "The number of parameters is limeted only by maximum possible length of the command line." << std::endl; - std::cout << "" << std::endl; -} - -/*! - application main() function -*/ -int main( int argc, char** argv ) -{ - QApplication app( argc, argv ); - if ( argc > 1 ) { - SUIT_ResourceMgr* resMgr = new SUIT_ResourceMgr( QString( "SalomeApp" ), QString( "%1Config" ) ); - resMgr->setVersion( salomeVersion() ); - resMgr->setCurrentFormat( QString( "xml" ) ); - resMgr->loadLanguage(); - for ( int i = 1; i < argc; i ++ ) { - QString anArg = QString( argv[i] ).trimmed(); - if ( anArg.startsWith( "-" ) ) { - anArg.remove( 0, 1 ); - if ( anArg.contains( ":" ) ) { - QStringList vals = anArg.split( ":", QString::SkipEmptyParts ); - QString section = vals[ 0 ].trimmed(); - QString param = vals[ 1 ].trimmed(); - if ( section.isEmpty() || param.isEmpty() ) continue; - resMgr->remove( section, param ); - } - } - else if ( anArg.contains( "+=" ) ) { - QStringList vals = anArg.split( "+=", QString::SkipEmptyParts ); - if ( vals[ 0 ].contains( ":" ) ) { - QStringList vals1 = vals[ 0 ].split( ":", QString::SkipEmptyParts ); - QString section = vals1[ 0 ].trimmed(); - QString param = vals1[ 1 ].trimmed(); - QString newValue = vals [ 1 ].trimmed(); - QString separ = ","; // default separator - if ( newValue.contains( "|" ) ) { - QStringList vals2 = newValue.split( "|", QString::SkipEmptyParts ); - newValue = vals2[ 0 ].trimmed(); - separ = vals2[ 1 ].trimmed(); - } - if ( section.isEmpty() || param.isEmpty() || newValue.isEmpty() || separ.isEmpty() ) continue; - QString value = resMgr->stringValue( section, param ); - QStringList valsOld = value.split( separ, QString::SkipEmptyParts ); - QStringList valsNew = newValue.split( separ, QString::SkipEmptyParts ); - for ( int i = 0; i < (int)valsNew.count(); i++ ) - if ( !valsOld.contains( valsNew[i] ) ) - valsOld.append( valsNew[i] ); - resMgr->setValue( section, param, valsOld.join( separ ) ); - } - } - else if ( anArg.contains( "=" ) ) { - QStringList vals = anArg.split( "=", QString::SkipEmptyParts ); - if ( vals[ 0 ].contains( ":" ) ) { - QStringList vals1 = vals[ 0 ].split( ":", QString::SkipEmptyParts ); - QString section = vals1[ 0 ].trimmed(); - QString param = vals1[ 1 ].trimmed(); - QString value = vals [ 1 ].trimmed(); - if ( section.isEmpty() || param.isEmpty() ) continue; - resMgr->setValue( section, param, value ); - } - } - } - resMgr->save(); - delete resMgr; - } - else { - help(); - } - return 0; -} diff --git a/src/SALOME_PY/Makefile.am b/src/SALOME_PY/Makefile.am deleted file mode 100755 index 6d94b90d4..000000000 --- a/src/SALOME_PY/Makefile.am +++ /dev/null @@ -1,44 +0,0 @@ -# SALOME SALOME_PY : binding of VTK graphics and Python -# -# 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.in -# Author : Paul RASCLE, EDF -# Module : SALOME -# $Header$ - -include $(top_srcdir)/adm_local/unix/make_common_starter.am - -lib_LTLIBRARIES= libSalomePy.la -dist_libSalomePy_la_SOURCES= SalomePy.cxx - -libSalomePy_la_CPPFLAGS=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(VTK_INCLUDES) \ - $(OGL_INCLUDES) $(CAS_CXXFLAGS) $(BOOST_CPPFLAGS) @KERNEL_CXXFLAGS@ \ - -DHAVE_CONFIG_H -I$(srcdir)/../SalomeApp -I$(srcdir)/../LightApp \ - -I$(srcdir)/../Event -I$(srcdir)/../Session -I$(srcdir)/../SVTK \ - -I$(srcdir)/../Qtx -I$(srcdir)/../SUIT -I$(srcdir)/../CAM \ - -I$(srcdir)/../STD -I$(srcdir)/../VTKViewer -I$(srcdir)/../OBJECT \ - @CAS_CPPFLAGS@ \ - -I$(top_builddir)/salome_adm/unix @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ -libSalomePy_la_LDFLAGS=$(PYTHON_LIBS) $(QT_MT_LIBS) $(VTK_LIBS) $(OGL_LIBS) \ - ../SalomeApp/libSalomeApp.la \ - -lvtkCommonPythonD -lvtkGraphicsPythonD -lvtkImagingPythonD diff --git a/src/SALOME_PY/SalomePy.cxx b/src/SALOME_PY/SalomePy.cxx deleted file mode 100755 index 31fe31868..000000000 --- a/src/SALOME_PY/SalomePy.cxx +++ /dev/null @@ -1,494 +0,0 @@ -// SALOME SALOME_PY : binding of VTK graphics and Python -// -// 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 : SalomePy.cxx -// Author : Paul RASCLE, EDF - -#include -#include - -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include -#include - -/*! - \brief Python wrappings for VTK viewer of the SALOME desktop. - - All methods are implemented using Event mechanism. The module - provides the following functions: - - getRenderer() - - getRenderWindow() - - getRenderWindowInteractor() - - showTrihedron() - - fitAll() - - setView() - - resetView() - - Usage in Python: - \code - import SalomePy - renderer = SalomePy.getRenderer() # get VTK renderer - window = SalomePy.getRenderWindow() # get render window - \endcode - - The methods getRenderer(), getRenderWindow() and getRenderWindowInteractor() - open new VTK viewer if there is no one opened. - In case of any error these methods return None object to the Python. -*/ - -#define PUBLISH_ENUM(i) \ -{ \ - PyObject *w; \ - int rc; \ - if ( ( w = PyInt_FromLong( i ) ) == NULL ) return; \ - rc = PyDict_SetItemString( aModuleDict, #i, w ); \ - Py_DECREF( w ); \ - if ( rc < 0 ) return; \ -} - -//! View operation type -enum { - ViewFront, //!< front view - ViewBack, //!< back view - ViewTop, //!< top view - ViewBottom, //!< bottom view - ViewRight, //!< right view - ViewLeft //!< left view -}; - -/*! - \brief Get Python class object by name - \internal - \param theClassName Python class name - \return Python class object or None object if class is not found -*/ -static PyObject* GetPyClass( const char* theClassName ) -{ - static PyObject* aVTKModule = 0; - PyObject* aPyClass = 0; - if( !aVTKModule ) { - if ( VTK_MAJOR_VERSION > 3 ) - aVTKModule = PyImport_ImportModule( "libvtkRenderingPython" ); - else - aVTKModule = PyImport_ImportModule( "libVTKGraphicsPython" ); - if( PyErr_Occurred() ) { - PyErr_Print(); - } - } - if ( aVTKModule ) { - PyObject* aVTKDict = PyModule_GetDict( aVTKModule ); - aPyClass = PyDict_GetItemString(aVTKDict, const_cast( theClassName ) ); - } - return aPyClass; -} - -/*! - \brief VTK window find/create mode - \internal -*/ -enum { - __Find, // try to find VTK window; if not found, do nothing - __FindOrCreate, // try to find VTK window; if not found, create new one - __Create }; // create new VTK window - -/*! - \brief Find or create VTK window. - \internal - \param toCreate window find/create mode - \return VTK window pointer or 0 if it could not be found/created -*/ -static SVTK_ViewWindow* GetVTKViewWindow( int toCreate = __FindOrCreate ) { - SVTK_ViewWindow* aVW = 0; - if ( SUIT_Session::session() ) { - // get application - SalomeApp_Application* anApp = dynamic_cast( SUIT_Session::session()->activeApplication() ); - if ( anApp ) { - // get active study - SalomeApp_Study* aStudy = dynamic_cast( anApp->activeStudy() ); - if ( aStudy ) { - // find or create VTK view manager - if ( toCreate == __Create ) { - SVTK_ViewManager* aVM = dynamic_cast( anApp->createViewManager( "VTKViewer" ) ); - if ( aVM ) { - aVW = dynamic_cast( aVM->getActiveView() ); - if ( !aVW ) - aVW = dynamic_cast( aVM->createViewWindow() ); - // VSR : When new view window is created it can be not active yet at this moment, - // so the following is a some workaround - if ( !aVW && !aVM->getViews().isEmpty() ) - aVW = dynamic_cast( aVM->getViews()[0] ); - } - } - else { - SVTK_ViewManager* aVM = dynamic_cast( anApp->getViewManager( "VTKViewer", toCreate == __FindOrCreate ) ); - if ( aVM ) { - aVW = dynamic_cast( aVM->getActiveView() ); - // VSR : When new view window is created it can be not active yet at this moment, - // so the following is a some workaround - if ( !aVW && !aVM->getViews().isEmpty() ) - aVW = dynamic_cast( aVM->getViews()[0] ); - } - } - } - } - } - return aVW; -} - -/*! - \fn PyObject* getRenderer( int toCreate = 0 ); - \brief Get VTK renderer (vtkRenderer). - - If \a toCreate parameter is 0 (by default) the function tries to find - and reuse existing VTK window; if it is not found, the new VTK window - is opened. - - If \a toCreate parameter is non-zero, the function always creates - new VTK window. - - If VTK window could not be found and or created, the None Python object - is returned. - - \param toCreate window creation mode - \return VTK window renderer object -*/ - -class TGetRendererEvent: public SALOME_Event -{ -public: - typedef PyObject* TResult; - TResult myResult; - int myCreate; - TGetRendererEvent( bool toCreate ) - : myResult( Py_None ), myCreate( toCreate ) {} - virtual void Execute() - { - PyObject* aPyClass = ::GetPyClass( "vtkRenderer" ); - SVTK_ViewWindow* aVTKViewWindow = - ::GetVTKViewWindow( myCreate ? __Create : __FindOrCreate ); - if( aVTKViewWindow && aPyClass ) { - vtkRenderer* aVTKObject = aVTKViewWindow->getRenderer(); - myResult = PyVTKObject_New( aPyClass, aVTKObject ); - } - } -}; - -extern "C" PyObject* libSalomePy_getRenderer( PyObject* self, PyObject* args ) -{ - PyObject* aResult = Py_None; - int toCreate = 0; - if ( !PyArg_ParseTuple( args, "|i:getRenderer", &toCreate ) ) - PyErr_Print(); - else - aResult = ProcessEvent( new TGetRendererEvent( toCreate ) ); - return aResult; -} - -/*! - \fn PyObject* getRenderWindow( int toCreate = 0 ); - \brief Get VTK render window (vtkRenderWindow). - - If \a toCreate parameter is 0 (by default) the function tries to find - and reuse existing VTK window; if it is not found, the new VTK window - is opened. - - If \a toCreate parameter is non-zero, the function always creates - new VTK window. - - If VTK window could not be found and or created, the None Python object - is returned. - - \param toCreate window creation mode - \return VTK window render window object -*/ - -class TGetRenderWindowEvent: public SALOME_Event -{ -public: - typedef PyObject* TResult; - TResult myResult; - int myCreate; - TGetRenderWindowEvent( bool toCreate ) - : myResult( Py_None ), myCreate( toCreate ) {} - virtual void Execute() - { - PyObject* aPyClass = ::GetPyClass( "vtkRenderWindow" ); - SVTK_ViewWindow* aVTKViewWindow = - ::GetVTKViewWindow( myCreate ? __Create : __FindOrCreate ); - if( aVTKViewWindow && aPyClass ) { - vtkRenderWindow* aVTKObject = aVTKViewWindow->getRenderWindow(); - myResult = PyVTKObject_New( aPyClass, aVTKObject ); - } - } -}; - -extern "C" PyObject* libSalomePy_getRenderWindow( PyObject* self, PyObject* args ) -{ - PyObject* aResult = Py_None; - int toCreate = 0; - if ( !PyArg_ParseTuple( args, "|i:getRenderWindow", &toCreate ) ) - PyErr_Print(); - else - aResult = ProcessEvent( new TGetRenderWindowEvent( toCreate ) ); - return aResult; -} - -/*! - \fn PyObject* getRenderWindowInteractor( int toCreate = 0 ); - \brief Get VTK render window interactor (getRenderWindowInteractor). - - If \a toCreate parameter is 0 (by default) the function tries to find - and reuse existing VTK window; if it is not found, the new VTK window - is opened. - - If \a toCreate parameter is non-zero, the function always creates - new VTK window. - - If VTK window could not be found and or created, the None Python object - is returned. - - \param toCreate window creation mode - \return VTK window render window interactor object -*/ - -class TGetRenderWindowInteractorEvent: public SALOME_Event -{ -public: - typedef PyObject* TResult; - TResult myResult; - int myCreate; - TGetRenderWindowInteractorEvent( bool toCreate ) - : myResult( Py_None ), myCreate( toCreate ) {} - virtual void Execute() - { - PyObject* aPyClass = ::GetPyClass( "vtkRenderWindowInteractor" ); - SVTK_ViewWindow* aVTKViewWindow = - ::GetVTKViewWindow( myCreate ? __Create : __FindOrCreate ); - if( aVTKViewWindow && aPyClass ) { - vtkRenderWindowInteractor* aVTKObject = aVTKViewWindow->getInteractor(); - myResult = PyVTKObject_New( aPyClass, aVTKObject ); - } - } -}; - -extern "C" PyObject* libSalomePy_getRenderWindowInteractor( PyObject* self, PyObject* args ) -{ - PyObject* aResult = Py_None; - int toCreate = 0; - if ( !PyArg_ParseTuple( args, "|i:getRenderWindowInteractor", &toCreate ) ) - PyErr_Print(); - else - aResult = ProcessEvent( new TGetRenderWindowInteractorEvent( toCreate ) ); - return aResult; -} - -/*! - \fn PyObject* showTrihedron( int show ); - \brief Show/hide trihedron in the current VTK viewer. - - If there is no active VTK viewer, nothing happens. - - \param show new trihedron visibility state - \return nothing (Py_None) -*/ - -extern "C" PyObject* libSalomePy_showTrihedron( PyObject* self, PyObject* args ) -{ - class TEvent: public SALOME_Event - { - public: - int myShow; - TEvent( int bShow ) - : myShow( bShow ) {} - virtual void Execute() - { - if( SVTK_ViewWindow* aVTKViewWindow = GetVTKViewWindow( __Find ) ) { - if ( aVTKViewWindow->isTrihedronDisplayed() != myShow ) - aVTKViewWindow->onViewTrihedron(); - } - } - }; - - PyObject* aResult = Py_None; - int bShow = 0; - if ( !PyArg_ParseTuple( args, "i:showTrihedron", &bShow ) ) - PyErr_Print(); - else - ProcessVoidEvent( new TEvent( bShow ) ); - return aResult; -} - -/*! - \fn PyObject* fitAll(); - \brief Fit all the contents in the current VTK viewer. - - If there is no active VTK viewer, nothing happens. - - \return nothing (Py_None) -*/ - -extern "C" PyObject* libSalomePy_fitAll( PyObject* self, PyObject* args ) -{ - class TEvent: public SALOME_Event - { - public: - TEvent() {} - virtual void Execute() - { - if( SVTK_ViewWindow* aVTKViewWindow = GetVTKViewWindow( __Find ) ) { - aVTKViewWindow->onFitAll(); - } - } - }; - - ProcessVoidEvent( new TEvent() ); - return Py_None; -} - -/*! - \fn PyObject* setView( int type ); - \brief Set view type for the current VTK viewer. - - If there is no active VTK viewer, nothing happens. - - \param type view type - \return nothing (Py_None) -*/ - -extern "C" PyObject* libSalomePy_setView( PyObject* self, PyObject* args ) -{ - class TEvent: public SALOME_Event - { - public: - long myType; - TEvent( long type ) : myType( type) {} - virtual void Execute() - { - if( SVTK_ViewWindow* aVTKViewWindow = GetVTKViewWindow( __Find ) ) { - switch( myType ) { - case ViewFront: - aVTKViewWindow->onFrontView(); break; - case ViewBack: - aVTKViewWindow->onBackView(); break; - case ViewTop: - aVTKViewWindow->onTopView(); break; - case ViewBottom: - aVTKViewWindow->onBottomView(); break; - case ViewRight: - aVTKViewWindow->onRightView(); break; - case ViewLeft: - aVTKViewWindow->onLeftView(); break; - default: - PyErr_Format(PyExc_ValueError,"setView%: wrong parameter value; must be between %d and %d", ViewFront, ViewLeft ); - break; - } - } - } - }; - - long type = -1; - if ( !PyArg_ParseTuple( args, "l:setView", &type ) ) - PyErr_Print(); - else { - ProcessVoidEvent( new TEvent( type ) ); - if( PyErr_Occurred() ) - PyErr_Print(); - } - return Py_None; -} - -/*! - \fn PyObject* resetView(); - \brief Reset contents of the current VTK viewer. - - If there is no active VTK viewer, nothing happens. - - \return nothing (Py_None) -*/ - -extern "C" PyObject* libSalomePy_resetView( PyObject* self, PyObject* args ) -{ - class TEvent: public SALOME_Event - { - public: - TEvent() {} - virtual void Execute() - { - if( SVTK_ViewWindow* aVTKViewWindow = GetVTKViewWindow( __Find ) ) { - aVTKViewWindow->onResetView(); - } - } - }; - - ProcessVoidEvent( new TEvent() ); - return Py_None; -} - -static PyMethodDef Module_Methods[] = -{ - { "getRenderer", libSalomePy_getRenderer, METH_VARARGS }, - { "getRenderWindow", libSalomePy_getRenderWindow, METH_VARARGS }, - { "getRenderWindowInteractor", libSalomePy_getRenderWindowInteractor, METH_VARARGS }, - { "showTrihedron", libSalomePy_showTrihedron, METH_VARARGS }, - { "fitAll", libSalomePy_fitAll, METH_NOARGS }, - { "setView", libSalomePy_setView, METH_VARARGS }, - { "resetView", libSalomePy_resetView, METH_NOARGS }, - { NULL, NULL } -}; - -/*! - \brief Python module initialization. - \internal -*/ -extern "C" void initlibSalomePy() -{ - static char* modulename = "libSalomePy"; - - // init module - PyObject* aModule = Py_InitModule( modulename, Module_Methods ); - if( PyErr_Occurred() ) { - PyErr_Print(); - return; - } - - // get module's dictionary - PyObject *aModuleDict = PyModule_GetDict( aModule ); - if ( aModuleDict == NULL ) - return; - - // export View type enumeration - PUBLISH_ENUM( ViewFront ); - PUBLISH_ENUM( ViewBack ); - PUBLISH_ENUM( ViewTop ); - PUBLISH_ENUM( ViewBottom ); - PUBLISH_ENUM( ViewRight ); - PUBLISH_ENUM( ViewLeft ); -} diff --git a/src/SALOME_PYQT/Makefile.am b/src/SALOME_PYQT/Makefile.am deleted file mode 100755 index a96896abb..000000000 --- a/src/SALOME_PYQT/Makefile.am +++ /dev/null @@ -1,29 +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 -# -# -# -# File : Makefile.in -# Author : Patrick GOLDBRONN (CEA) -# Module : SALOME -# $Header$ - -include $(top_srcdir)/adm_local/unix/make_common_starter.am - -SUBDIRS = SALOME_PYQT_GUI SalomePyQt diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/Makefile.am b/src/SALOME_PYQT/SALOME_PYQT_GUI/Makefile.am deleted file mode 100644 index 9dbaea88d..000000000 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/Makefile.am +++ /dev/null @@ -1,74 +0,0 @@ -# Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms 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 : Nicolas REJNERI -# Module : SALOME - -include $(top_srcdir)/adm_local/unix/make_common_starter.am - -###################### - -# Library target -lib_LTLIBRARIES= libSalomePyQtGUI.la - -SIP_SRC = sipSalomePyQtGUIcmodule.cc -SIP_FILES = SALOME_PYQT_GUI.sip - -EXTRA_DIST += $(SIP_FILES) - -salomeinclude_HEADERS = \ - SALOME_PYQT_GUI.h \ - SALOME_PYQT_PyInterp.h \ - SALOME_PYQT_Module.h - -dist_libSalomePyQtGUI_la_SOURCES= \ - SALOME_PYQT_PyInterp.cxx \ - SALOME_PYQT_Module.cxx - -dist_libSalomePyQtGUI_la_SOURCES: $(SIP_SRC) - -# moc pre-processing -MOC_FILES= SALOME_PYQT_Module_moc.cxx -nodist_libSalomePyQtGUI_la_SOURCES= $(MOC_FILES) $(SIP_SRC) - -libSalomePyQtGUI_la_CPPFLAGS= $(QT_INCLUDES) $(SIP_INCLUDES) $(PYTHON_INCLUDES) \ - $(CAS_CPPFLAGS) $(VTK_INCLUDES) $(OGL_INCLUDES) $(BOOST_CPPFLAGS) \ - -DHAVE_CONFIG_H @KERNEL_CXXFLAGS@ -DCALL_OLD_METHODS \ - -I$(srcdir)/../../PyInterp -I$(srcdir)/../../SalomeApp \ - -I$(srcdir)/../../SUIT -I$(srcdir)/../../Qtx -I$(srcdir)/../../LightApp \ - -I$(srcdir)/../../Plot2d -I$(srcdir)/../../OCCViewer \ - -I$(srcdir)/../../SalomeApp -I$(srcdir)/../../CAM -I$(srcdir)/../../STD \ - -I$(top_builddir)/salome_adm/unix @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ -libSalomePyQtGUI_la_LIBADD= $(PYTHON_LIBS) $(SIP_LIBS) $(PYQT_LIBS) $(VTK_LIBS) \ - $(OGL_LIBS) ../../PyInterp/libPyInterp.la ../../SalomeApp/libSalomeApp.la \ - ../../OCCViewer/libOCCViewer.la ../../Plot2d/libPlot2d.la - -################################## - -# Custom build step: generate C++ wrapping according to $(SIP_FILES) - -$(SIP_SRC): $(SIP_FILES) - $(SIP) $(PYQT_SIPFLAGS) $< - -$(dist_libSalomePyQtGUI_la_SOURCES): $(SIP_SRC) - -################################### - -mostlyclean-local: - rm -f sip* diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_GUI.h b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_GUI.h deleted file mode 100644 index 38fffc899..000000000 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_GUI.h +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 : SALOME_PYQT_GUI.h -// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// - -#if !defined ( SALOME_PYQT_GUI_H ) -#define SALOME_PYQT_GUI_H - -// ======================================================== -// set dllexport type for Win platform -#ifdef WIN32 -# ifdef SALOME_PYQT_EXPORTS -# define SALOME_PYQT_EXPORT __declspec(dllexport) -# else -# define SALOME_PYQT_EXPORT __declspec(dllimport) -# endif -#else // WIN32 -# define SALOME_PYQT_EXPORT -#endif // WIN32 - -// ======================================================== -// avoid warning messages -#ifdef WIN32 -#pragma warning (disable : 4786) -#pragma warning (disable : 4251) -#endif - -#endif // SALOME_PYQT_GUI_H diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_GUI.sip b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_GUI.sip deleted file mode 100644 index 3731b4c54..000000000 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_GUI.sip +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 : SALOME_PYQT_GUI.sip -// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// - -%Module SalomePyQtGUI - -%Import QtGuimod.sip -%Import QtXmlmod.sip - diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx deleted file mode 100644 index b9867a0fe..000000000 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx +++ /dev/null @@ -1,2326 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 : SALOME_PYQT_Module.cxx -// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// - -#include "SALOME_PYQT_Module.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "sipAPISalomePyQtGUI.h" - -#include -#if SIP_VERSION < 0x040700 -#include "sipQtGuiQWidget.h" -#include "sipQtGuiQMenu.h" -#endif - -/*! - \brief Default name of the module, replaced at the moment - of module creation. - \internal -*/ -const char* DEFAULT_NAME = "SALOME_PYQT_Module"; - -/*! - \brief Default menu group number. - \internal -*/ -const int DEFAULT_GROUP = 40; - -/*! - \var IsCallOldMethods - \brief Allow calling obsolete callback methods. - \internal - - If the macro CALL_OLD_METHODS is not defined, the invoking - of obsolete Python module's methods like setSetting(), definePopup(), - etc. is blocked. - - CALL_OLD_METHODS macro can be defined for example by adding - -DCALL_OLD_METHODS compilation option to the Makefile. -*/ -#ifdef CALL_OLD_METHODS -const bool IsCallOldMethods = true; -#else -const bool IsCallOldMethods = false; -#endif - -// -// NB: Python requests. -// General rule for Python requests created by SALOME_PYQT_Module: -// all requests should be executed SYNCHRONOUSLY within the main GUI thread. -// However, it is obligatory that ANY Python call is wrapped with a request object, -// so that ALL Python API calls are serialized with PyInterp_Dispatcher. -// - -/*! - \class SALOME_PYQT_Module::XmlHandler - \brief XML resource files parser. - \internal - - This class is used to provide backward compatibility with - existing Python modules in which obsolete menu definition system - (via XML files) is used. -*/ - -class SALOME_PYQT_Module::XmlHandler -{ -public: - XmlHandler( SALOME_PYQT_Module* module, const QString& fileName ); - void createActions(); - void createPopup ( QMenu* menu, - const QString& context, - const QString& parent, - const QString& object ); - void activateMenus( bool ); - -protected: - void createToolBar ( QDomNode& parentNode ); - void createMenu ( QDomNode& parentNode, - const int parentMenuId = -1, - QMenu* parentPopup = 0 ); - - void insertPopupItems( QDomNode& parentNode, - QMenu* menu ); - -private: - SALOME_PYQT_Module* myModule; - QDomDocument myDoc; - QList myMenuItems; -}; - -// -// NB: Library initialization -// Since the SalomePyQtGUI library is not imported in Python it's initialization function -// should be called manually (and only once) in order to initialize global sip data -// and to get C API from sip : sipBuildResult for example -// -#define INIT_FUNCTION initSalomePyQtGUI -#if defined(SIP_STATIC_MODULE) -extern "C" void INIT_FUNCTION(); -#else -PyMODINIT_FUNC INIT_FUNCTION(); -#endif - -/*! - \fn CAM_Module* createModule() - \brief Module factory function. - \internal - - Creates an instance of SALOME_PYQT_Module object by request - of an application when the module is loaded and initialized. - - \return new module object -*/ - -extern "C" { - SALOME_PYQT_EXPORT CAM_Module* createModule() { - static bool alreadyInitialized = false; - if ( !alreadyInitialized ) { - // call only once (see comment above) ! - PyEval_RestoreThread( KERNEL_PYTHON::_gtstate ); - INIT_FUNCTION(); - PyEval_ReleaseThread( KERNEL_PYTHON::_gtstate ); - alreadyInitialized = !alreadyInitialized; - } - return new SALOME_PYQT_Module(); - } -} - -/*! - \class FuncMsg - \brief Function call in/out tracer. - \internal -*/ - -class FuncMsg -{ -public: - FuncMsg( const QString& funcName ) - { - myName = funcName; - MESSAGE( myName.toLatin1().constData() << " [ begin ]" ); - } - ~FuncMsg() - { - MESSAGE( myName.toLatin1().constData() << " [ end ]" ); - } - void message( const QString& msg ) - { - MESSAGE( myName.toLatin1().constData() << " : " << msg.toLatin1().constData() ); - } -private: - QString myName; -}; - -/*! - \class SALOME_PYQT_Module - \brief This class implements module API for all the Python-based - SALOME modules. -*/ - -// -// Static variables definition -// -SALOME_PYQT_Module::InterpMap SALOME_PYQT_Module::myInterpMap; -SALOME_PYQT_Module* SALOME_PYQT_Module::myInitModule = 0; - -/*! - \brief Get the module being initialized. - - This is a little trick :) needed to provide an access from Python - (SalomePyQt) to the module being currently activated. The problem - that during the process of module initialization (initialize() - function) it is not yet available via application->activeModule() - call. - - This method returns valid pointer only if called in scope of - initialize() function. - - \return the module being currently initialized -*/ -SALOME_PYQT_Module* SALOME_PYQT_Module::getInitModule() -{ - return myInitModule; -} - -/*! - \brief Constructor -*/ -SALOME_PYQT_Module::SALOME_PYQT_Module() -: SalomeApp_Module( DEFAULT_NAME ), - myInterp( 0 ), - myModule( 0 ), - myXmlHandler ( 0 ), - myLastActivateStatus( true ) -{ -} - -/*! - \brief Destructor -*/ -SALOME_PYQT_Module::~SALOME_PYQT_Module() -{ - if ( myXmlHandler ) - delete myXmlHandler; -} - -/*! - \brief Initialization of the module. - - This method can be used for creation of the menus, toolbars and - other such staff. - - There are two ways to do this: - - for obsolete modules this method first tries to read - _.xml resource file which contains a menu, - toolbars and popup menus description; - - new modules can create menus by direct calling of the - corresponding methods of SalomePyQt Python API in the Python - module's initialize() method which is called from here. - - NOTE: SALOME supports two modes of modules loading: - - immediate (all the modules are created and initialized - immediately when the application object is created; - - postponed modules loading (used currently); in this mode - the module is loaded only be request. - If postponed modules loading is not used, the active - study might be not yet defined at this stage, so initialize() - method should not perform any study-based initialization. - - \param app parent application object -*/ -void SALOME_PYQT_Module::initialize( CAM_Application* app ) -{ - FuncMsg fmsg( "SALOME_PYQT_Module::initialize()" ); - - // call base implementation - SalomeApp_Module::initialize( app ); - - // try to get XML resource file name - SUIT_ResourceMgr* aResMgr = getApp()->resourceMgr(); - if ( !myXmlHandler && aResMgr ) { - // get current language - QString aLang = aResMgr->stringValue( "language", "language", QString() ); - if ( aLang.isEmpty() ) - aLang = "en"; - // define resource file name - QString aFileName = name() + "_" + aLang + ".xml"; - aFileName = aResMgr->path( "resources", name(), aFileName ); - // create XML handler instance - if ( !aFileName.isEmpty() && QFile::exists( aFileName ) ) - myXmlHandler = new SALOME_PYQT_Module::XmlHandler( this, aFileName ); - // create menus & toolbars from XML file if required - if ( myXmlHandler ) - myXmlHandler->createActions(); - } - - // perform internal initialization and call module's initialize() funtion - // InitializeReq: request class for internal init() operation - class InitializeReq : public PyInterp_Request - { - public: - InitializeReq( CAM_Application* _app, - SALOME_PYQT_Module* _obj ) - : PyInterp_Request( 0, true ), // this request should be processed synchronously (sync == true) - myApp( _app ), - myObj( _obj ) {} - - protected: - virtual void execute() - { - myObj->init( myApp ); - } - - private: - CAM_Application* myApp; - SALOME_PYQT_Module* myObj; - }; - - // post request - PyInterp_Dispatcher::Get()->Exec( new InitializeReq( app, this ) ); -} - -/*! - \brief Activation of the module. - - This function is usually used in order to show the module's - specific menus and toolbars, update actions state and perform - other such actions required when the module is activated. - - Note, that returning \c false in this function prevents the - module activation. - - \param theStudy parent study - \return \c true if activation is successful and \c false otherwise -*/ -bool SALOME_PYQT_Module::activateModule( SUIT_Study* theStudy ) -{ - FuncMsg fmsg( "SALOME_PYQT_Module::activateModule()" ); - - // call base implementation - bool res = SalomeApp_Module::activateModule( theStudy ); - - if ( !res ) - return res; - - // reset the activation status to the default value - myLastActivateStatus = true; - - // perform internal activation - // ActivateReq: request class for internal activate() operation - class ActivateReq : public PyInterp_Request - { - public: - ActivateReq( SUIT_Study* _study, - SALOME_PYQT_Module* _obj ) - : PyInterp_Request( 0, true ), // this request should be processed synchronously (sync == true) - myStudy ( _study ), - myObj ( _obj ) {} - - protected: - virtual void execute() - { - myObj->activate( myStudy ); - } - - private: - SUIT_Study* myStudy; - SALOME_PYQT_Module* myObj; - }; - - // post request - PyInterp_Dispatcher::Get()->Exec( new ActivateReq( theStudy, this ) ); - - // check activation status (set by activate()) - if ( !lastActivationStatus() ) - return false; - - // activate menus, toolbars, etc - if ( myXmlHandler ) myXmlHandler->activateMenus( true ); - setMenuShown( true ); - setToolShown( true ); - - // connect preferences changing signal - connect( getApp(), SIGNAL( preferenceChanged( const QString&, const QString&, const QString& ) ), - this, SLOT( preferenceChanged( const QString&, const QString&, const QString& ) ) ); - - // perform custom activation actions - // CustomizeReq: request class for internal customize() operation - class CustomizeReq : public PyInterp_Request - { - public: - CustomizeReq( SUIT_Study* _study, - SALOME_PYQT_Module* _obj ) - : PyInterp_Request( 0, true ), // this request should be processed synchronously (sync == true) - myStudy ( _study ), - myObj ( _obj ) {} - - protected: - virtual void execute() - { - myObj->customize( myStudy ); - } - - private: - SUIT_Study* myStudy; - SALOME_PYQT_Module* myObj; - }; - - // post request - PyInterp_Dispatcher::Get()->Exec( new CustomizeReq( theStudy, this ) ); - - return true; -} - -/*! - \brief Deactivation of the module. - - This function is usually used in order to hide the module's - specific menus and toolbars and perform other such actions - required when the module is deactivated. - - \param theStudy parent study - \return \c true if deactivation is successful and \c false otherwise -*/ -bool SALOME_PYQT_Module::deactivateModule( SUIT_Study* theStudy ) -{ - FuncMsg fmsg( "SALOME_PYQT_Module::deactivateModule()" ); - - // disconnect preferences changing signal - disconnect( getApp(), SIGNAL( preferenceChanged( const QString&, const QString&, const QString& ) ), - this, SLOT( preferenceChanged( const QString&, const QString&, const QString& ) ) ); - - // perform internal deactivation - // DeactivateReq: request class for internal deactivate() operation - class DeactivateReq : public PyInterp_LockRequest - { - public: - DeactivateReq( PyInterp_Interp* _py_interp, - SUIT_Study* _study, - SALOME_PYQT_Module* _obj ) - : PyInterp_LockRequest( _py_interp, 0, true ), // this request should be processed synchronously (sync == true) - myStudy ( _study ), - myObj ( _obj ) {} - - protected: - virtual void execute() - { - myObj->deactivate( myStudy ); - } - - private: - SUIT_Study* myStudy; - SALOME_PYQT_Module* myObj; - }; - - // post request - PyInterp_Dispatcher::Get()->Exec( new DeactivateReq( myInterp, theStudy, this ) ); - - // deactivate menus, toolbars, etc - if ( myXmlHandler ) myXmlHandler->activateMenus( false ); - setMenuShown( false ); - setToolShown( false ); - - // call base implementation - return SalomeApp_Module::deactivateModule( theStudy ); -} - -/*! - \brief Get last activation status. - \return status of last module activation operation - \sa activateModule() -*/ -bool SALOME_PYQT_Module::lastActivationStatus() const -{ - return myLastActivateStatus; -} - -/*! - \breif Process application preferences changing. - - Called when any application setting is changed. - - \param module preference module - \param section preference resource file section - \param setting preference resource name -*/ -void SALOME_PYQT_Module::preferenceChanged( const QString& module, - const QString& section, - const QString& setting ) -{ - FuncMsg fmsg( "SALOME_PYQT_Module::preferenceChanged()" ); - - // perform synchronous request to Python event dispatcher - class Event : public PyInterp_LockRequest - { - public: - Event( PyInterp_Interp* _py_interp, - SALOME_PYQT_Module* _obj, - const QString& _section, - const QString& _setting ) - : PyInterp_LockRequest( _py_interp, 0, true ), // this request should be processed synchronously (sync == true) - myObj ( _obj ), - mySection( _section ), - mySetting( _setting ) {} - - protected: - virtual void execute() - { - myObj->prefChanged( mySection, mySetting ); - } - - private: - SALOME_PYQT_Module* myObj; - QString mySection, mySetting; - }; - - if ( module != moduleName() ) { - // module's own preferences are processed by preferencesChanged() method - // ... - // post the request only if dispatcher is not busy! - // execute request synchronously - if ( !PyInterp_Dispatcher::Get()->IsBusy() ) - PyInterp_Dispatcher::Get()->Exec( new Event( myInterp, this, section, setting ) ); - } -} - -/*! - \brief Process study activation. - - Called when study desktop is activated. Used for notifying the Python - module about changing of the active study. -*/ -void SALOME_PYQT_Module::studyActivated() -{ - FuncMsg fmsg( "SALOME_PYQT_Module::studyActivated()" ); - - // StudyChangedReq: request class for internal studyChanged() operation - class StudyChangedReq : public PyInterp_Request - { - public: - StudyChangedReq( SUIT_Study* _study, - SALOME_PYQT_Module* _obj ) - : PyInterp_Request( 0, true ), // this request should be processed synchronously (sync == true) - myStudy ( _study ), - myObj ( _obj ) {} - - protected: - virtual void execute() - { - myObj->studyChanged( myStudy ); - } - - private: - SUIT_Study* myStudy; - SALOME_PYQT_Module* myObj; - }; - - // post request - PyInterp_Dispatcher::Get()->Exec( new StudyChangedReq( application()->activeStudy(), this ) ); -} - -/*! - \brief Process GUI action (from main menu, toolbar or - context popup menu action). -*/ -void SALOME_PYQT_Module::onGUIEvent() -{ - FuncMsg fmsg( "SALOME_PYQT_Module::onGUIEvent()" ); - - // get sender action - QAction* action = qobject_cast( sender() ); - if ( !action ) - return; - - // get action ID - int id = actionId( action ); - fmsg.message( QString( "action id = %1" ).arg( id ) ); - - // perform synchronous request to Python event dispatcher - class GUIEvent : public PyInterp_LockRequest - { - public: - GUIEvent( PyInterp_Interp* _py_interp, - SALOME_PYQT_Module* _obj, - int _id ) - : PyInterp_LockRequest( _py_interp, 0, true ), // this request should be processed synchronously (sync == true) - myId ( _id ), - myObj ( _obj ) {} - - protected: - virtual void execute() - { - myObj->guiEvent( myId ); - } - - private: - int myId; - SALOME_PYQT_Module* myObj; - }; - - // post request - PyInterp_Dispatcher::Get()->Exec( new GUIEvent( myInterp, this, id ) ); -} - -/*! - \brief Process context popup menu request. - - Called when user activates popup menu in some window - (view, object browser, etc). - - \param theContext popup menu context (e.g. "ObjectBrowser") - \param thePopupMenu popup menu - \param title popup menu title (not used) -*/ -void SALOME_PYQT_Module::contextMenuPopup( const QString& theContext, - QMenu* thePopupMenu, - QString& /*title*/ ) -{ - FuncMsg fmsg( "SALOME_PYQT_Module::contextMenuPopup()" ); - fmsg.message( QString( "context: %1" ).arg( theContext ) ); - - // perform synchronous request to Python event dispatcher - class PopupMenuEvent : public PyInterp_LockRequest - { - public: - PopupMenuEvent( PyInterp_Interp* _py_interp, - SALOME_PYQT_Module* _obj, - const QString& _context, - QMenu* _popup ) - : PyInterp_LockRequest( _py_interp, 0, true ), // this request should be processed synchronously (sync == true) - myContext( _context ), - myPopup ( _popup ), - myObj ( _obj ) {} - - protected: - virtual void execute() - { - myObj->contextMenu( myContext, myPopup ); - } - - private: - SALOME_PYQT_Module* myObj; - QString myContext; - QMenu* myPopup; - }; - - // post request only if dispatcher is not busy! - // execute request synchronously - if ( !PyInterp_Dispatcher::Get()->IsBusy() ) - PyInterp_Dispatcher::Get()->Exec( new PopupMenuEvent( myInterp, this, theContext, thePopupMenu ) ); -} - -/*! - \brief Export preferences for the Python module. - - Called only once when the first instance of the module is created. -*/ -void SALOME_PYQT_Module::createPreferences() -{ - FuncMsg fmsg( "SALOME_PYQT_Module::createPreferences()" ); - - // perform synchronous request to Python event dispatcher - class Event : public PyInterp_LockRequest - { - public: - Event( PyInterp_Interp* _py_interp, - SALOME_PYQT_Module* _obj ) - : PyInterp_LockRequest( _py_interp, 0, true ), // this request should be processed synchronously (sync == true) - myObj ( _obj ) {} - - protected: - virtual void execute() - { - myObj->initPreferences(); - } - - private: - SALOME_PYQT_Module* myObj; - }; - - // post request only if dispatcher is not busy! - // execute request synchronously - if ( !PyInterp_Dispatcher::Get()->IsBusy() ) - PyInterp_Dispatcher::Get()->Exec( new Event( myInterp, this ) ); -} - -/*! - \brief Define the dockable windows associated with the module. - - To fill the list of windows the correspondind Python module's windows() - method is called from SALOME_PYQT_Module::init() method. - - By default, ObjectBrowser, PythonConsole and LogWindow windows are - associated to the module. - - Allowed dockable windows: - - SalomeApp_Application::WT_ObjectBrowser : object browser - - SalomeApp_Application::WT_PyConsole : python console - - SalomeApp_Application::WT_LogWindow : log messages output window - - Dock area is defined by Qt::DockWidgetArea enumeration: - - Qt::TopDockWidgetArea : top dock area - - Qt::BottomDockWidgetArea : bottom dock area - - Qt::LeftDockWidgetArea : left dock area - - Qt::RightDockWidgetArea : right dock area - - \param mappa map of dockable windows: { : } -*/ -void SALOME_PYQT_Module::windows( QMap& mappa ) const -{ - FuncMsg fmsg( "SALOME_PYQT_Module::windows()" ); - - mappa = myWindowsMap; -} - -/*! - \brief Define the compatible view windows associated with the module. - - The associated view windows are opened automatically when the module - is activated. - - To fill the list of views the correspondind Python module's views() - method is called from SALOME_PYQT_Module::init() method. - By default, the list is empty. - - \param listik list of view windows types -*/ -void SALOME_PYQT_Module::viewManagers( QStringList& lst ) const -{ - FuncMsg fmsg( "SALOME_PYQT_Module::viewManagers()" ); - - lst = myViewMgrList; -} - -/*! - \brief Process module's preferences changing. - - Called when the module's preferences are changed. - - \param section setting section - \param setting setting name -*/ -void SALOME_PYQT_Module::preferencesChanged( const QString& section, const QString& setting ) -{ - FuncMsg fmsg( "SALOME_PYQT_Module::preferencesChanged()" ); - - // perform synchronous request to Python event dispatcher - class Event : public PyInterp_LockRequest - { - public: - Event( PyInterp_Interp* _py_interp, - SALOME_PYQT_Module* _obj, - const QString& _section, - const QString& _setting ) - : PyInterp_LockRequest( _py_interp, 0, true ), // this request should be processed synchronously (sync == true) - myObj ( _obj ), - mySection( _section ), - mySetting( _setting ) {} - - protected: - virtual void execute() - { - myObj->prefChanged( mySection, mySetting ); - } - - private: - SALOME_PYQT_Module* myObj; - QString mySection, mySetting; - }; - - // post request only if dispatcher is not busy! - // execut request synchronously - if ( !PyInterp_Dispatcher::Get()->IsBusy() ) - PyInterp_Dispatcher::Get()->Exec( new Event( myInterp, this, section, setting ) ); -} - -/*! - \brief Internal module initialization: - - Performs the following actions: - - initialize or get the Python interpreter (one per study) - - import the Python module - - pass the workspace widget to the Python module - - call Python module's initialize() method - - call Python module's windows() method - - call Python module's views() method - - \param app parent application object -*/ -void SALOME_PYQT_Module::init( CAM_Application* app ) -{ - FuncMsg fmsg( "SALOME_PYQT_Module::init()" ); - - // reset interpreter to NULL - myInterp = NULL; - - // get study Id - SalomeApp_Application* anApp = dynamic_cast( app ); - if ( !anApp ) - return; - SalomeApp_Study* aStudy = dynamic_cast( app->activeStudy() ); - if ( !aStudy ) - return; - int aStudyId = aStudy ? aStudy->studyDS()->StudyId() : 0; - - // initialize Python subinterpreter (on per study) and put it in variable - initInterp( aStudyId ); - if ( !myInterp ) - return; // Error - - // import Python GUI module - importModule(); - if ( !myModule ) - return; // Error - - // this module is being activated now! - myInitModule = this; - - // then call Python module's initialize() method - // ... first get python lock - PyLockWrapper aLock = myInterp->GetLockWrapper(); - // ... (the Python module is already imported) - // ... finally call Python module's initialize() method - if ( PyObject_HasAttrString( myModule , "initialize" ) ) { - PyObjWrapper res( PyObject_CallMethod( myModule, "initialize", "" ) ); - if ( !res ) { - PyErr_Print(); - } - } - - // get required dockable windows list from the Python module - // by calling windows() method - // ... first put default values - myWindowsMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea ); - myWindowsMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea ); - myWindowsMap.insert( SalomeApp_Application::WT_LogWindow, Qt::BottomDockWidgetArea ); - - if ( PyObject_HasAttrString( myModule , "windows" ) ) { - PyObjWrapper res1( PyObject_CallMethod( myModule, "windows", "" ) ); - if ( !res1 ) { - PyErr_Print(); - } - else { - myWindowsMap.clear(); - if ( PyDict_Check( res1 ) ) { - PyObject* key; - PyObject* value; - int pos = 0; - while ( PyDict_Next( res1, &pos, &key, &value ) ) { - // parse the return value - // it should be a map: {integer:integer} - int aKey, aValue; - if( key && PyInt_Check( key ) && value && PyInt_Check( value ) ) { - aKey = PyInt_AsLong( key ); - aValue = PyInt_AsLong( value ); - myWindowsMap[ aKey ] = aValue; - } - } - } - } - } - - // get compatible view windows types from the Python module - // by calling views() method - if ( PyObject_HasAttrString( myModule , "views" ) ) { - PyObjWrapper res2( PyObject_CallMethod( myModule, "views", "" ) ); - if ( !res2 ) { - PyErr_Print(); - } - else { - // parse the return value - // result can be one string... - if ( PyString_Check( res2 ) ) { - myViewMgrList.append( PyString_AsString( res2 ) ); - } - // ... or list of strings - else if ( PyList_Check( res2 ) ) { - int size = PyList_Size( res2 ); - for ( int i = 0; i < size; i++ ) { - PyObject* value = PyList_GetItem( res2, i ); - if( value && PyString_Check( value ) ) { - myViewMgrList.append( PyString_AsString( value ) ); - } - } - } - } - } - // module is already activated! - myInitModule = 0; -} - -/*! - \brief Internal activation: - - Performs the following actions: - - initialize or get the Python interpreter (one per study) - - import the Python GUI module - - call Python module's activate() method - - \param theStudy parent study object -*/ -void SALOME_PYQT_Module::activate( SUIT_Study* theStudy ) -{ - FuncMsg fmsg( "SALOME_PYQT_Module::activate()" ); - - // get study Id - SalomeApp_Study* aStudy = dynamic_cast( theStudy ); - int aStudyId = aStudy ? aStudy->studyDS()->StudyId() : 0; - - // initialize Python subinterpreter (on per study) and put it in variable - initInterp( aStudyId ); - if ( !myInterp ) - return; // Error - - // import Python GUI module - importModule(); - if ( !myModule ) - return; // Error - - // get python lock - PyLockWrapper aLock = myInterp->GetLockWrapper(); - - // call Python module's activate() method (for the new modules) - if ( PyObject_HasAttrString( myModule , "activate" ) ) { - PyObject* res1 = PyObject_CallMethod( myModule, "activate", "" ); - if ( !res1 || !PyBool_Check( res1 ) ) { - PyErr_Print(); - // always true for old modules (no return value) - myLastActivateStatus = true; - } - else { - // detect return status - myLastActivateStatus = PyObject_IsTrue( res1 ); - } - } - - // Connect the SUIT_Desktop signal windowActivated() to this->onActiveViewChanged() - SUIT_Desktop* aDesk = theStudy->application()->desktop(); - if ( aDesk ) - { - connect( aDesk, SIGNAL( windowActivated( SUIT_ViewWindow* ) ), - this, SLOT( onActiveViewChanged( SUIT_ViewWindow* ) ) ); - // If a active window exists send activeViewChanged - // If a getActiveView() in SalomePyQt available we no longer need this - SUIT_ViewWindow* aView = aDesk->activeWindow(); - if ( aView ) - activeViewChanged( aView ); - - // get all view currently opened in the study and connect their signals to - // the corresponding slots of the class. - QList wndList = aDesk->windows(); - SUIT_ViewWindow* wnd; - foreach ( wnd, wndList ) - connectView( wnd ); - } -} - -/*! - \brief Additional customization after module is activated: - - Performs the following actions: - - get the Python interpreter (one per study) - - import the Python GUI module - - call Python module's setSettings() method (obsolete function, - used for compatibility with old code) - - \param theStudy parent study object -*/ -void SALOME_PYQT_Module::customize( SUIT_Study* theStudy ) -{ - FuncMsg fmsg( "SALOME_PYQT_Module::customize()" ); - - // get study Id - SalomeApp_Study* aStudy = dynamic_cast( theStudy ); - int aStudyId = aStudy ? aStudy->studyDS()->StudyId() : 0; - - // initialize Python subinterpreter (on per study) and put it in variable - initInterp( aStudyId ); - if ( !myInterp ) - return; // Error - - // import Python GUI module - importModule(); - if ( !myModule ) - return; // Error - - if ( IsCallOldMethods ) { - // call Python module's setWorkspace() method - setWorkSpace(); - } - - // get python lock - PyLockWrapper aLock = myInterp->GetLockWrapper(); - - if ( IsCallOldMethods ) { - // call Python module's setSettings() method (obsolete) - if ( PyObject_HasAttrString( myModule , "setSettings" ) ) { - PyObjWrapper res( PyObject_CallMethod( myModule, "setSettings", "" ) ); - if( !res ) { - PyErr_Print(); - } - } - } -} - -/*! - \brief Internal deactivation: - - Performs the following actions: - - call Python module's deactivate() method - - \param theStudy parent study object -*/ -void SALOME_PYQT_Module::deactivate( SUIT_Study* theStudy ) -{ - FuncMsg fmsg( "SALOME_PYQT_Module::deactivate()" ); - - // check if the subinterpreter is initialized and Python module is imported - if ( !myInterp || !myModule ) { - // Error! Python subinterpreter should be initialized and module should be imported first! - return; - } - // then call Python module's deactivate() method - if ( PyObject_HasAttrString( myModule , "deactivate" ) ) { - PyObjWrapper res( PyObject_CallMethod( myModule, "deactivate", "" ) ); - if( !res ) { - PyErr_Print(); - } - } - - // Disconnect the SUIT_Desktop signal windowActivated() - SUIT_Desktop* aDesk = theStudy->application()->desktop(); - if ( aDesk ) - { - disconnect( aDesk, SIGNAL( windowActivated( SUIT_ViewWindow* ) ), - this, SLOT( onActiveViewChanged( SUIT_ViewWindow* ) ) ); - } -} - -/*! - \brief Perform internal actions when active study is changed. - - Called when active the study is actived (user brings its - desktop to top): - - initialize or get the Python interpreter (one per study) - - import the Python GUI module - - call Python module's activeStudyChanged() method - - \param theStudy study being activated -*/ -void SALOME_PYQT_Module::studyChanged( SUIT_Study* theStudy ) -{ - FuncMsg fmsg( "SALOME_PYQT_Module::studyChanged()" ); - - // get study Id - SalomeApp_Study* aStudy = dynamic_cast( theStudy ); - int aStudyId = aStudy ? aStudy->studyDS()->StudyId() : 0; - - // initialize Python subinterpreter (on per study) and put it in variable - initInterp( aStudyId ); - if ( !myInterp ) - return; // Error - - // import Python GUI module - importModule(); - if ( !myModule ) - return; // Error - - if ( IsCallOldMethods ) { - // call Python module's setWorkspace() method - setWorkSpace(); - } - - // get python lock - PyLockWrapper aLock = myInterp->GetLockWrapper(); - - // call Python module's activeStudyChanged() method - if ( PyObject_HasAttrString( myModule , "activeStudyChanged" ) ) { - PyObjWrapper res( PyObject_CallMethod( myModule, "activeStudyChanged", "i", aStudyId ) ); - if( !res ) { - PyErr_Print(); - } - } -} - -/*! - \brief Get module engine. - - Returns nil var if engine is not found in LifeCycleCORBA. - - \return module's engine reference -*/ -Engines::Component_var SALOME_PYQT_Module::getEngine() const -{ - FuncMsg fmsg( "SALOME_PYQT_Module::getEngine()" ); - - Engines::Component_var comp; - try { - comp = getApp()->lcc()->FindOrLoad_Component( "FactoryServerPy", name().toLatin1() ); - } - catch ( CORBA::Exception& ) { - } - return comp; -} - -/*! - \birief Get module engine IOR. - - Returns empty string if engine is not found in LifeCycleCORBA. - - \return module's engine IOR -*/ -QString SALOME_PYQT_Module::engineIOR() const -{ - FuncMsg fmsg( "SALOME_PYQT_Module::engineIOR()" ); - - QString anIOR = ""; - if ( !CORBA::is_nil( getEngine() ) ) - anIOR = getApp()->orb()->object_to_string( getEngine() ); - return anIOR; -} - -/*! - \brief Process (internally) context popup menu request. - - Performs the following actions: - - calls Python module's definePopup(...) method (obsolete function, - used for compatibility with old code) to define the popup menu context - - parses XML resourses file (if exists) and fills the popup menu with the items) - - calls Python module's customPopup(...) method (obsolete function, - used for compatibility with old code) to allow module to customize the popup menu - - for new modules calls createPopupMenu() function to allow the - modules to build the popup menu by using insertItem(...) Qt functions. - - \param theContext popup menu context - \param thePopupMenu popup menu -*/ -void SALOME_PYQT_Module::contextMenu( const QString& theContext, QMenu* thePopupMenu ) -{ - FuncMsg fmsg( "SALOME_PYQT_Module::contextMenu()" ); - - // Python interpreter should be initialized and Python module should be - // import first - if ( !myInterp || !myModule ) - return; - - QString aContext( "" ), aObject( "" ), aParent( theContext ); - - if ( IsCallOldMethods && PyObject_HasAttrString( myModule , "definePopup" ) ) { - // call definePopup() Python module's function - // this is obsolete function, used only for compatibility reasons - PyObjWrapper res( PyObject_CallMethod( myModule, - "definePopup", - "sss", - aContext.toLatin1().constData(), - aObject.toLatin1().constData(), - aParent.toLatin1().constData() ) ); - if( !res ) { - PyErr_Print(); - } - else { - // parse return value - char *co, *ob, *pa; - if( PyArg_ParseTuple( res, "sss", &co, &ob, &pa ) ) { - aContext = co; - aObject = ob; - aParent = pa; - } - } - } // if ( IsCallOldMethods ... ) - - // first try to create menu via XML parser: - // we create popup menus without help of QtxPopupMgr - if ( myXmlHandler ) - myXmlHandler->createPopup( thePopupMenu, aContext, aParent, aObject ); - - PyObjWrapper sipPopup( sipBuildResult( 0, "M", thePopupMenu, sipClass_QMenu ) ); - - // then call Python module's createPopupMenu() method (for new modules) - if ( PyObject_HasAttrString( myModule , "createPopupMenu" ) ) { - PyObjWrapper res1( PyObject_CallMethod( myModule, - "createPopupMenu", - "Os", - sipPopup.get(), - aContext.toLatin1().constData() ) ); - if( !res1 ) { - PyErr_Print(); - } - } - - if ( IsCallOldMethods && PyObject_HasAttrString( myModule , "customPopup" ) ) { - // call customPopup() Python module's function - // this is obsolete function, used only for compatibility reasons - PyObjWrapper res2( PyObject_CallMethod( myModule, - "customPopup", - "Osss", - sipPopup.get(), - aContext.toLatin1().constData(), - aObject.toLatin1().constData(), - aParent.toLatin1().constData() ) ); - if( !res2 ) { - PyErr_Print(); - } - } -} - -/*! - \brief Internal GUI event handling. - - Performs the following actions: - - calls Python module's OnGUIEvent() method - - \param theId GUI action ID -*/ -void SALOME_PYQT_Module::guiEvent( const int theId ) -{ - FuncMsg fmsg( "SALOME_PYQT_Module::guiEvent()" ); - - // Python interpreter should be initialized and Python module should be - // import first - if ( !myInterp || !myModule ) - return; - - if ( PyObject_HasAttrString( myModule , "OnGUIEvent" ) ) { - PyObjWrapper res( PyObject_CallMethod( myModule, "OnGUIEvent", "i", theId ) ); - if( !res ) { - PyErr_Print(); - } - } -} - -/*! - \brief Initialize (internally) preferences for the module. - - Performs the following actions: - - calls Python module's createPreferences() method -*/ -void SALOME_PYQT_Module::initPreferences() -{ - FuncMsg fmsg( "SALOME_PYQT_Module::initPreferences()" ); - - // Python interpreter should be initialized and Python module should be - // import first - if ( !myInterp || !myModule ) - return; - - // temporary set myInitModule because createPreferences() method - // might be called during the module intialization process - myInitModule = this; - - if ( PyObject_HasAttrString( myModule , "createPreferences" ) ) { - PyObjWrapper res( PyObject_CallMethod( myModule, "createPreferences", "" ) ); - if( !res ) { - PyErr_Print(); - } - } - - myInitModule = 0; -} - -/*! - \brief Initialize python subinterpreter (one per study). - \param theStudyId study ID -*/ -void SALOME_PYQT_Module::initInterp( int theStudyId ) -{ - FuncMsg fmsg( "SALOME_PYQT_Module::initInterp()" ); - - // check study Id - if ( !theStudyId ) { - // Error! Study Id must not be 0! - myInterp = NULL; - return; - } - // try to find the subinterpreter - if( myInterpMap.contains( theStudyId ) ) { - // found! - myInterp = myInterpMap[ theStudyId ]; - return; - } - // not found - create a new one! - /////////////////////////////////////////////////////////////////// - // Attention: the creation of Python interpretor must be protected - // by a C++ Lock because of C threads - /////////////////////////////////////////////////////////////////// - myInterp = new SALOME_PYQT_PyInterp(); - myInterp->initialize(); - myInterpMap[ theStudyId ] = myInterp; - - // import 'salome' module and call 'salome_init' method; - // do it only once on interpreter creation - // ... first get python lock - PyLockWrapper aLock = myInterp->GetLockWrapper(); - // ... then import a module - PyObjWrapper aMod = PyImport_ImportModule( "salome" ); - if( !aMod ) { - // Error! - PyErr_Print(); - return; - } - // ... then call a method - int embedded = 1; - PyObjWrapper aRes( PyObject_CallMethod( aMod, "salome_init", "ii", theStudyId, embedded ) ); - if( !aRes ) { - // Error! - PyErr_Print(); - return; - } -} - -/*! - \brief Import Python GUI module and remember the reference to the module. - - Attention! initInterp() should be called first!!! -*/ -void SALOME_PYQT_Module::importModule() -{ - FuncMsg fmsg( "SALOME_PYQT_Module::importModule()" ); - - // check if the subinterpreter is initialized - if ( !myInterp ) { - // Error! Python subinterpreter should be initialized first! - myModule = 0; - return; - } - // import Python GUI module and puts it in attribute - // ... first get python lock - PyLockWrapper aLock = myInterp->GetLockWrapper(); - // ... then import a module - QString aMod = name() + "GUI"; - myModule = PyImport_ImportModule( aMod.toLatin1().data() ); - if( !myModule ) { - // Error! - PyErr_Print(); - return; - } -} - -/*! - \brief Set study workspace to the Python module. - - Calls setWorkSpace() method of the Pythohn module with - PyQt QWidget object to use with interpreter. - - Attention! initInterp() and importModule() should be called first!!! -*/ -void SALOME_PYQT_Module::setWorkSpace() -{ - FuncMsg fmsg( "SALOME_PYQT_Module::setWorkSpace()" ); - - // check if the subinterpreter is initialized and Python module is imported - if ( !myInterp || !myModule ) { - // Error! Python subinterpreter should be initialized and module should be imported first! - return; - } - - // call setWorkspace() method - // ... first get python lock - PyLockWrapper aLock = myInterp->GetLockWrapper(); - - // ... then try to import SalomePyQt module. If it's not possible don't go on. - PyObjWrapper aQtModule( PyImport_ImportModule( "SalomePyQt" ) ); - if( !aQtModule ) { - // Error! - PyErr_Print(); - return; - } - - if ( IsCallOldMethods ) { - // ... then get workspace object - QWidget* aWorkspace = 0; - if ( getApp()->desktop()->inherits( "STD_MDIDesktop" ) ) { - STD_MDIDesktop* aDesktop = dynamic_cast( getApp()->desktop() ); - if ( aDesktop ) - aWorkspace = aDesktop->workspace(); - } - else if ( getApp()->desktop()->inherits( "STD_TabDesktop" ) ) { - STD_TabDesktop* aDesktop = dynamic_cast( getApp()->desktop() ); - if ( aDesktop ) - aWorkspace = aDesktop->workstack(); - } - PyObjWrapper pyws( sipBuildResult( 0, "M", aWorkspace, sipClass_QWidget ) ); - // ... and finally call Python module's setWorkspace() method (obsolete) - if ( PyObject_HasAttrString( myModule , "setWorkSpace" ) ) { - PyObjWrapper res( PyObject_CallMethod( myModule, "setWorkSpace", "O", pyws.get() ) ); - if( !res ) { - PyErr_Print(); - } - } - } -} - -/*! - \brief Preference changing callback function (internal). - - Performs the following actions: - - call Python module's preferenceChanged() method - - \param section setting section name - \param setting setting name -*/ -void SALOME_PYQT_Module::prefChanged( const QString& section, const QString& setting ) -{ - FuncMsg fmsg( "SALOME_PYQT_Module::prefChanged()" ); - - // Python interpreter should be initialized and Python module should be - // import first - if ( !myInterp || !myModule ) - return; - - if ( PyObject_HasAttrString( myModule , "preferenceChanged" ) ) { - PyObjWrapper res( PyObject_CallMethod( myModule, - "preferenceChanged", - "ss", - section.toLatin1().constData(), - setting.toLatin1().constData() ) ); - if( !res ) { - PyErr_Print(); - } - } -} - -/*! - \brief Get default menu group identifier - \return menu group ID (40 by default) -*/ -int SALOME_PYQT_Module::defaultMenuGroup() -{ - return DEFAULT_GROUP; -} - -// -// The next methods call the parent implementation. -// This is done to open protected methods from CAM_Module class. -// - -/*! - \brief Create toolbar with specified \a name. - \param name toolbar name - \return toolbar ID or -1 if toolbar creation is failed -*/ -int SALOME_PYQT_Module::createTool( const QString& name ) -{ - return SalomeApp_Module::createTool( name ); -} - -/*! - \brief Insert action with specified \a id to the toolbar. - \param id action ID - \param tBar toolbar ID - \param idx required index in the toolbar - \return action ID or -1 if action could not be added -*/ -int SALOME_PYQT_Module::createTool( const int id, const int tBar, const int idx ) -{ - return SalomeApp_Module::createTool( id, tBar, idx ); -} - -/*! - \brief Insert action with specified \a id to the toolbar. - \param id action ID - \param tBar toolbar name - \param idx required index in the toolbar - \return action ID or -1 if action could not be added -*/ -int SALOME_PYQT_Module::createTool( const int id, const QString& tBar, const int idx ) -{ - return SalomeApp_Module::createTool( id, tBar, idx ); -} - -/*! - \brief Insert action to the toolbar. - \param a action - \param tBar toolbar ID - \param id required action ID - \param idx required index in the toolbar - \return action ID or -1 if action could not be added -*/ -int SALOME_PYQT_Module::createTool( QAction* a, const int tBar, const int id, const int idx ) -{ - return SalomeApp_Module::createTool( a, tBar, id, idx ); -} - -/*! - \brief Insert action to the toolbar. - \param a action - \param tBar toolbar name - \param id required action ID - \param idx required index in the toolbar - \return action ID or -1 if action could not be added -*/ -int SALOME_PYQT_Module::createTool( QAction* a, const QString& tBar, const int id, const int idx ) -{ - return SalomeApp_Module::createTool( a, tBar, id, idx ); -} - -/*! - \brief Create main menu. - \param subMenu menu name - \param menu parent menu ID - \param id required menu ID - \param group menu group ID - \param idx required index in the menu - \return menu ID or -1 if menu could not be added -*/ -int SALOME_PYQT_Module::createMenu( const QString& subMenu, const int menu, const int id, const int group, const int idx ) -{ - return SalomeApp_Module::createMenu( subMenu, menu, id, group, idx ); -} - -/*! - \brief Create main menu. - \param subMenu menu name - \param menu parent menu name (list of menu names separated by "|") - \param id required menu ID - \param group menu group ID - \param idx required index in the menu - \return menu ID or -1 if menu could not be added -*/ -int SALOME_PYQT_Module::createMenu( const QString& subMenu, const QString& menu, const int id, const int group, const int idx ) -{ - return SalomeApp_Module::createMenu( subMenu, menu, id, group, idx ); -} - -/*! - \brief Insert action to the main menu. - \param id action ID - \param menu parent menu ID - \param group menu group ID - \param idx required index in the menu - \return action ID or -1 if action could not be added -*/ -int SALOME_PYQT_Module::createMenu( const int id, const int menu, const int group, const int idx ) -{ - return SalomeApp_Module::createMenu( id, menu, group, idx ); -} - -/*! - \brief Insert action to the main menu. - \param id action ID - \param menu parent menu name (list of menu names separated by "|") - \param group menu group ID - \param idx required index in the menu - \return action ID or -1 if action could not be added -*/ -int SALOME_PYQT_Module::createMenu( const int id, const QString& menu, const int group, const int idx ) -{ - return SalomeApp_Module::createMenu( id, menu, group, idx ); -} - -/*! - \brief Insert action to the main menu. - \param a action - \param menu parent menu ID - \param group menu group ID - \param idx required index in the menu - \return action ID or -1 if action could not be added -*/ -int SALOME_PYQT_Module::createMenu( QAction* a, const int menu, const int id, const int group, const int idx ) -{ - return SalomeApp_Module::createMenu( a, menu, id, group, idx ); -} - -/*! - \brief Insert action to the main menu. - \param a action - \param menu parent menu name (list of menu names separated by "|") - \param group menu group ID - \param idx required index in the menu - \return action ID or -1 if action could not be added -*/ -int SALOME_PYQT_Module::createMenu( QAction* a, const QString& menu, const int id, const int group, const int idx ) -{ - return SalomeApp_Module::createMenu( a, menu, id, group, idx ); -} - -/*! - \brief Create separator action which can be used in the menu or toolbar. - \return new separator action -*/ -QAction* SALOME_PYQT_Module::separator() -{ - return SalomeApp_Module::separator(); -} - -/*! - \brief Get action by specified \a id. - \return action or 0 if it is not found -*/ -QAction* SALOME_PYQT_Module::action( const int id ) const -{ - return SalomeApp_Module::action( id ); -} - -/*! - \brief Get action identifier. - \return action ID or -1 if action is not registered -*/ -int SALOME_PYQT_Module::actionId( const QAction* a ) const -{ - return SalomeApp_Module::actionId( a ); -} - -/*! - \brief Create new action. - - If the action with specified identifier already registered - it is not created, but its attributes are only modified. - - \param id action ID - \param text tooltip text - \param icon icon - \param menu menu text - \param tip status tip - \param key keyboard shortcut - \param toggle \c true for checkable action - \return created action -*/ -QAction* SALOME_PYQT_Module::createAction( const int id, const QString& text, const QString& icon, - const QString& menu, const QString& tip, const int key, - const bool toggle, QObject* parent ) -{ - QIcon anIcon = loadIcon( icon ); - QAction* a = action( id ); - if ( a ) { - if ( a->toolTip().isEmpty() && !text.isEmpty() ) a->setToolTip( text ); - if ( a->text().isEmpty() && !menu.isEmpty() ) a->setText( menu ); - if ( a->icon().isNull() && !anIcon.isNull() ) a->setIcon( anIcon ); - if ( a->statusTip().isEmpty() && !tip.isEmpty() ) a->setStatusTip( tip ); - if ( a->shortcut().isEmpty() && key ) a->setShortcut( key ); - if ( a->isCheckable() != toggle ) a->setCheckable( toggle ); - disconnect( a, SIGNAL( triggered( bool ) ), this, SLOT( onGUIEvent() ) ); - connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onGUIEvent() ) ); - } - else { - a = SalomeApp_Module::createAction( id, - text, - anIcon, - menu, - tip, - key, - parent ? parent : this, - toggle, - this, - SLOT( onGUIEvent() ) ); - } - return a; -} - -/*! - \brief Create new action group. - - If the action with specified identifier already registered - it is not created, but its attributes are only modified. - - \param id action ID - \param text tooltip text - \param icon icon - \param menu menu text - \param tip status tip - \param key keyboard shortcut - \param toggle \c true for checkable action - \return created action -*/ -/* -QActionGroup* SALOME_PYQT_Module::createActionGroup(const int id, const bool exclusive) -{ - QActionGroup* a = action( id ); - if ( !a || !a->inherits( "QActionGroup" ) ) { - a = new QActionGroup( this ); - SalomeApp_Module::registerAction( id, a ); - } - a->setExclusive( exclusive ); - return (QActionGroup*)a; -} -*/ -/*! - \brief Load icon from resource file. - \param fileName icon file name - \return icon (null icon if loading failed) -*/ -QIcon SALOME_PYQT_Module::loadIcon( const QString& fileName ) -{ - QIcon anIcon; - if ( !fileName.isEmpty() ) { - QPixmap pixmap = getApp()->resourceMgr()->loadPixmap( name(), tr( fileName.toLatin1() ) ); - if ( !pixmap.isNull() ) - anIcon = QIcon( pixmap ); - } - return anIcon; -} - -/*! - \brief Add global application preference (for example, - application specific section). - \param label preference name - \return preference ID -*/ -int SALOME_PYQT_Module::addGlobalPreference( const QString& label ) -{ - LightApp_Preferences* pref = preferences(); - if ( !pref ) - return -1; - - return pref->addPreference( label, -1 ); -} - -/*! - \brief Add preference. - \param label preference name - \return preference ID -*/ -int SALOME_PYQT_Module::addPreference( const QString& label ) -{ - return SalomeApp_Module::addPreference( label ); -} - -/*! - \brief Add preference. - \param label preference name - \param pId parent preference ID - \param type preference type - \param section resource file section name - \param param resource file setting name - \return preference ID -*/ -int SALOME_PYQT_Module::addPreference( const QString& label, - const int pId, const int type, - const QString& section, - const QString& param ) -{ - return SalomeApp_Module::addPreference( label, pId, type, section, param ); -} - -/*! - \brief Get the preference property. - \param id preference ID - \param prop property name - \return property value (invalid QVariant() if property is not found) -*/ -QVariant SALOME_PYQT_Module::preferenceProperty( const int id, - const QString& prop ) const -{ - QVariant v = SalomeApp_Module::preferenceProperty( id, prop ); - return v; -} - -/*! - \brief Set the preference property. - \param id preference ID - \param prop property name - \param var property value -*/ -void SALOME_PYQT_Module::setPreferenceProperty( const int id, - const QString& prop, - const QVariant& var ) -{ - SalomeApp_Module::setPreferenceProperty( id, prop, var ); -} - - -/*! - \brief Signal handler windowActivated(SUIT_ViewWindow*) of SUIT_Desktop - \param pview view being activated -*/ -void SALOME_PYQT_Module::onActiveViewChanged( SUIT_ViewWindow* pview ) -{ - class ActiveViewChange : public PyInterp_LockRequest - { - public: - ActiveViewChange( PyInterp_Interp* _py_interp, SALOME_PYQT_Module* _obj, const SUIT_ViewWindow* _pview ) - : PyInterp_LockRequest( _py_interp, 0, true ), - myObj(_obj),myView(_pview) {} - - protected: - virtual void execute() - { - myObj->activeViewChanged( myView ); - } - - private: - SALOME_PYQT_Module* myObj; - const SUIT_ViewWindow * myView; - }; - - PyInterp_Dispatcher::Get()->Exec( new ActiveViewChange( myInterp, this, pview ) ); -} - -/*! - \brief Processes the view changing, calls Python module's activeViewChanged() method - \param pview view being activated -*/ -void SALOME_PYQT_Module::activeViewChanged( const SUIT_ViewWindow* pview ) -{ - if ( !myInterp || !myModule ) - return; - - // Do not use SUIT_ViewWindow::closing() signal here. View manager reacts on - // this signal and deletes view. So our slot does not works if it is connected - // on this signal. SUIT_ViewManager::deleteView(SUIT_ViewWindow*) is used here - - connectView( pview ); - - if ( PyObject_HasAttrString( myModule, "activeViewChanged" ) ) - { - if ( !pview ) - return; - - PyObjWrapper res( PyObject_CallMethod( myModule, "activeViewChanged", "i" , pview->getId() ) ); - if( !res ) - PyErr_Print(); - } -} - -/*! - \brief Signal handler cloneView() of OCCViewer_ViewWindow - \param pview view being cloned -*/ -void SALOME_PYQT_Module::onViewCloned( SUIT_ViewWindow* pview ) -{ - class ViewClone : public PyInterp_LockRequest - { - public: - ViewClone( PyInterp_Interp* _py_interp, SALOME_PYQT_Module* _obj, const SUIT_ViewWindow* _pview ) - : PyInterp_LockRequest( _py_interp, 0, true ), - myObj(_obj), myView(_pview) {} - - protected: - virtual void execute() - { - myObj->viewCloned( myView ); - } - - private: - SALOME_PYQT_Module* myObj; - const SUIT_ViewWindow* myView; - }; - - PyInterp_Dispatcher::Get()->Exec( new ViewClone( myInterp, this, pview ) ); -} - -/*! - \brief Processes the view cloning, calls Python module's activeViewCloned() method - \param pview view being cloned -*/ -void SALOME_PYQT_Module::viewCloned( const SUIT_ViewWindow* pview ) -{ - if ( !myInterp || !myModule || !pview ) - return; - - if ( PyObject_HasAttrString( myModule, "viewCloned" ) ) - { - PyObjWrapper res( PyObject_CallMethod( myModule, "viewCloned", "i", pview->getId() ) ); - if( !res ) - PyErr_Print(); - } -} - -/*! - \brief Signal handler closing(SUIT_ViewWindow*) of a view - \param pview view being closed -*/ -void SALOME_PYQT_Module::onViewClosed( SUIT_ViewWindow* pview ) -{ - class ViewClose : public PyInterp_LockRequest - { - public: - ViewClose( PyInterp_Interp* _py_interp, SALOME_PYQT_Module* _obj, const SUIT_ViewWindow* _pview ) - : PyInterp_LockRequest( _py_interp, 0, true ), - myObj(_obj),myView(_pview) {} - - protected: - virtual void execute() - { - myObj->viewClosed( myView ); - } - - private: - SALOME_PYQT_Module* myObj; - const SUIT_ViewWindow * myView; - }; - - PyInterp_Dispatcher::Get()->Exec( new ViewClose( myInterp, this, pview ) ); -} - -/*! - \brief Processes the view closing, calls Python module's viewClosed() method - \param pview view being closed -*/ -void SALOME_PYQT_Module::viewClosed( const SUIT_ViewWindow* pview ) -{ - if ( !myInterp || !myModule ) - return; - - if ( PyObject_HasAttrString( myModule, "viewClosed" ) ) - { - PyObjWrapper res( PyObject_CallMethod( myModule, "viewClosed", "i", pview->getId() ) ); - if ( !res ) - { - PyErr_Print(); - } - } -} - -/*! - \brief Connects or disconnects signals about activating and cloning view on the module slots - \param pview view which is connected/disconnected -*/ -void SALOME_PYQT_Module::connectView( const SUIT_ViewWindow* pview ) -{ - SUIT_ViewManager* viewMgr = pview->getViewManager(); - SUIT_ViewModel* viewModel = viewMgr ? viewMgr->getViewModel() : 0; - - if ( viewMgr ) - { - disconnect( viewMgr, SIGNAL( deleteView( SUIT_ViewWindow* ) ), - this, SLOT( onViewClosed( SUIT_ViewWindow* ) ) ); - - connect( viewMgr, SIGNAL( deleteView( SUIT_ViewWindow* ) ), - this, SLOT( onViewClosed( SUIT_ViewWindow* ) ) ); - } - - // Connect cloneView() signal of an OCC View - if ( pview->inherits( "OCCViewer_ViewWindow" ) ) - { - disconnect( pview, SIGNAL( viewCloned( SUIT_ViewWindow* ) ), - this, SLOT( onViewCloned( SUIT_ViewWindow* ) ) ); - connect( pview, SIGNAL( viewCloned( SUIT_ViewWindow* ) ), - this, SLOT( onViewCloned( SUIT_ViewWindow* ) ) ); - } - // Connect cloneView() signal of Plot2d View manager - else if ( viewModel && viewModel->inherits( "Plot2d_Viewer" ) ) - { - disconnect( viewModel, SIGNAL( viewCloned( SUIT_ViewWindow* ) ), - this, SLOT( onViewCloned( SUIT_ViewWindow* ) ) ); - connect( viewModel, SIGNAL( viewCloned( SUIT_ViewWindow* ) ), - this, SLOT( onViewCloned( SUIT_ViewWindow* ) ) ); - } -} - -/*! - \brief Get tag name for the DOM element. - \param element DOM element - \return empty string if the element does not have tag name - \internal -*/ -static QString tagName( const QDomElement& element ) -{ - return element.tagName().trimmed(); -} - -/*! - \brief Get DOM element's attribute by its name. - \param element DOM element - \param attName attribute name - \return empty string if the element does not have such attribute - \internal -*/ -static QString attribute( const QDomElement& element, const QString& attName ) -{ - return element.attribute( attName ).trimmed(); -} - -/*! - \brief Inspect specified string for the boolean value. - - This function returns \c true if string represents boolean value: - - "true", "yes" or "1" for \c true - - "false", "no" or "0" for \c false - Second parameter allows to specify what boolean value is expected: - - 1: \c true - - 0: \c false - - other value is not taken into account (return represented value) - - \param value inspected string - \param check expected boolean value - \return boolean value represented by the string (\a check is not 1 or 0) - or \c true if value correspond to the specified \a check -*/ -static bool checkBool( const QString& value, const int check = -1 ) -{ - QString v = value.toLower(); - if ( ( v == "true" || v == "yes" || v == "1" ) && ( check != 0 ) ) - return true; - if ( ( v == "false" || v == "no" || v == "0" ) && ( check == 0 ) ) - return true; - return false; -} - -/*! - \brief Inspect specified string for the integer value. - - This function returns returns -1 if item is empty or represents - an invalid number. - \param value inspected string - \param def default value - \param shift shift value (it is added to the integer value to produce shifted result) -*/ -static int checkInt( const QString& value, const int def = -1, const int shift = -1 ) -{ - bool bOk; - int val = value.toInt( &bOk ); - if ( !bOk ) val = def; - if ( shift > 0 && bOk && val < 0 ) - val += shift; - return val; -} - -/*! - \brief Constructor - \internal - \param module parent module pointer - \param fileName XML file path -*/ -SALOME_PYQT_Module::XmlHandler::XmlHandler( SALOME_PYQT_Module* module, - const QString& fileName ) -: myModule( module ) -{ - if ( fileName.isEmpty() ) - return; - QFile aFile( fileName ); - if ( !aFile.open( QIODevice::ReadOnly ) ) - return; - myDoc.setContent( &aFile ); - aFile.close(); -} - -/*! - \brief Parse XML file and create actions. - \internal - - Called by SALOME_PYQT_Module::activate() in order to create actions - (menus, toolbars). -*/ -void SALOME_PYQT_Module::XmlHandler::createActions() -{ - // get document element - QDomElement aDocElem = myDoc.documentElement(); - - // create main menu actions - QDomNodeList aMenuList = aDocElem.elementsByTagName( "menu-item" ); - for ( int i = 0; i < aMenuList.count(); i++ ) { - QDomNode n = aMenuList.item( i ); - createMenu( n ); - } - - // create toolbars actions - QDomNodeList aToolsList = aDocElem.elementsByTagName( "toolbar" ); - for ( int i = 0; i < aToolsList.count(); i++ ) { - QDomNode n = aToolsList.item( i ); - createToolBar( n ); - } -} - -/*! - \brief Create popup menu. - \internal - \param menu popup menu - \param context popup menu context - \param context popup menu parent object name - \param context popup menu object name -*/ -void SALOME_PYQT_Module::XmlHandler::createPopup( QMenu* menu, - const QString& context, - const QString& parent, - const QString& object ) -{ - // get document element - QDomElement aDocElem = myDoc.documentElement(); - - // get popup menus actions - QDomNodeList aPopupList = aDocElem.elementsByTagName( "popupmenu" ); - for ( int i = 0; i < aPopupList.count(); i++ ) { - QDomNode n = aPopupList.item( i ); - if ( !n.isNull() && n.isElement() ) { - QDomElement e = n.toElement(); - // QString lab = attribute( e, "label-id" ); // not used // - QString ctx = attribute( e, "context-id" ); - QString prt = attribute( e, "parent-id" ); - QString obj = attribute( e, "object-id" ); - if ( ctx == context && prt == parent && obj == object ) { - insertPopupItems( n, menu ); - break; - } - } - } -} - -/*! - \brief Activate menus - \internal - \param enable if \c true menus are activated, otherwise menus are deactivated -*/ -void SALOME_PYQT_Module::XmlHandler::activateMenus( bool enable ) -{ - if ( !myModule ) - return; - - QtxActionMenuMgr* mgr = myModule->menuMgr(); - int id; - foreach( id, myMenuItems ) mgr->setEmptyEnabled( id, enable ); -} - -/*! - \brief Create main menu item and insert actions to it. - \internal - \param parentNode XML node with menu description - \param parentMenuId parent menu ID (-1 for top-level menu) - \param parentPopup parent popup menu (0 for top-level menu) -*/ -void SALOME_PYQT_Module::XmlHandler::createMenu( QDomNode& parentNode, - const int parentMenuId, - QMenu* parentPopup ) -{ - if ( !myModule || parentNode.isNull() ) - return; - - QDomElement parentElement = parentNode.toElement(); - if ( !parentElement.isNull() ) { - QString plabel = attribute( parentElement, "label-id" ); - int pid = checkInt( attribute( parentElement, "item-id" ) ); - int ppos = checkInt( attribute( parentElement, "pos-id" ) ); - int group = checkInt( attribute( parentElement, "group-id" ), - myModule->defaultMenuGroup() ); - if ( !plabel.isEmpty() ) { - QMenu* popup = 0; - int menuId = -1; - // create menu - menuId = myModule->createMenu( plabel, // label - parentMenuId, // parent menu ID, -1 for top-level menu - pid, // ID - group, // group ID - ppos ); // position - myMenuItems.append( menuId ); - QDomNode node = parentNode.firstChild(); - while ( !node.isNull() ) { - if ( node.isElement() ) { - QDomElement elem = node.toElement(); - QString aTagName = tagName( elem ); - if ( aTagName == "popup-item" ) { - int id = checkInt( attribute( elem, "item-id" ) ); - int pos = checkInt( attribute( elem, "pos-id" ) ); - int group = checkInt( attribute( elem, "group-id" ), - myModule->defaultMenuGroup() ); - QString label = attribute( elem, "label-id" ); - QString icon = attribute( elem, "icon-id" ); - QString tooltip = attribute( elem, "tooltip-id" ); - QString accel = attribute( elem, "accel-id" ); - bool toggle = checkBool( attribute( elem, "toggle-id" ) ); - - // -1 action ID is not allowed : it means that attribute is missed in the XML file! - // also check if the action with given ID is already created - if ( id != -1 ) { - // create menu action - QAction* action = myModule->createAction( id, // ID - tooltip, // tooltip - icon, // icon - label, // menu text - tooltip, // status-bar text - QKeySequence( accel ), // keyboard accelerator - toggle ); // toogled action - myModule->createMenu( action, // action - menuId, // parent menu ID - id, // ID (same as for createAction()) - group, // group ID - pos ); // position - } - } - else if ( aTagName == "submenu" ) { - // create sub-menu - createMenu( node, menuId, popup ); - } - else if ( aTagName == "separator" ) { - // create menu separator - int id = checkInt( attribute( elem, "item-id" ) ); // separator can have ID - int pos = checkInt( attribute( elem, "pos-id" ) ); - int group = checkInt( attribute( elem, "group-id" ), - myModule->defaultMenuGroup() ); - QAction* action = myModule->separator(); - myModule->createMenu( action, // separator action - menuId, // parent menu ID - id, // ID - group, // group ID - pos ); // position - } - } - node = node.nextSibling(); - } - } - } -} - -/*! - \brief Create a toolbar and insert actions to it. - \param parentNode XML node with toolbar description -*/ -void SALOME_PYQT_Module::XmlHandler::createToolBar( QDomNode& parentNode ) -{ - if ( !myModule || parentNode.isNull() ) - return; - - QDomElement parentElement = parentNode.toElement(); - if ( !parentElement.isNull() ) { - QString aLabel = attribute( parentElement, "label-id" ); - if ( !aLabel.isEmpty() ) { - // create toolbar - int tbId = myModule->createTool( aLabel ); - QDomNode node = parentNode.firstChild(); - while ( !node.isNull() ) { - if ( node.isElement() ) { - QDomElement elem = node.toElement(); - QString aTagName = tagName( elem ); - if ( aTagName == "toolbutton-item" ) { - int id = checkInt( attribute( elem, "item-id" ) ); - int pos = checkInt( attribute( elem, "pos-id" ) ); - QString label = attribute( elem, "label-id" ); - QString icon = attribute( elem, "icon-id" ); - QString tooltip = attribute( elem, "tooltip-id" ); - QString accel = attribute( elem, "accel-id" ); - bool toggle = checkBool( attribute( elem, "toggle-id" ) ); - - // -1 action ID is not allowed : it means that attribute is missed in the XML file! - // also check if the action with given ID is already created - if ( id != -1 ) { - // create toolbar action - QAction* action = myModule->createAction( id, // ID - tooltip, // tooltip - icon, // icon - label, // menu text - tooltip, // status-bar text - QKeySequence( accel ), // keyboard accelerator - toggle ); // toogled action - myModule->createTool( action, tbId, -1, pos ); - } - } - else if ( aTagName == "separatorTB" || aTagName == "separator" ) { - // create toolbar separator - int pos = checkInt( attribute( elem, "pos-id" ) ); - QAction* action = myModule->separator(); - myModule->createTool( action, tbId, -1, pos ); - } - } - node = node.nextSibling(); - } - } - } -} - -/*! - \brief Fill popup menu with the items. - \param parentNode XML node with popup menu description - \param menu popup menu -*/ -void SALOME_PYQT_Module::XmlHandler::insertPopupItems( QDomNode& parentNode, QMenu* menu ) -{ - if ( !myModule && parentNode.isNull() ) - return; - - // we create popup menus without help of QtxPopupMgr - QDomNode node = parentNode.firstChild(); - while ( !node.isNull() ) { - if ( node.isElement() ) { - QDomElement elem = node.toElement(); - QString aTagName = tagName( elem ); - QList actions = menu->actions(); - if ( aTagName == "popup-item" ) { - // insert a command item - int id = checkInt( attribute( elem, "item-id" ) ); - int pos = checkInt( attribute( elem, "pos-id" ) ); - QString label = attribute( elem, "label-id" ); - QString icon = attribute( elem, "icon-id" ); - QString tooltip = attribute( elem, "tooltip-id" ); - QString accel = attribute( elem, "accel-id" ); - bool toggle = checkBool( attribute( elem, "toggle-id" ) ); - - // -1 action ID is not allowed : it means that attribute is missed in the XML file! - // also check if the action with given ID is already created - if ( id != -1 ) { - QAction* action = myModule->createAction( id, // ID - tooltip, // tooltip - icon, // icon - label, // menu text - tooltip, // status-bar text - QKeySequence( accel ), // keyboard accelerator - toggle ); // toogled action - QAction* before = ( pos >= 0 && pos < actions.count() ) ? actions[ pos ] : 0; - menu->insertAction( before, action ); - } - } - else if ( aTagName == "submenu" ) { - // create sub-menu - ////int id = checkInt( attribute( elem, "item-id" ) ); // not used // - int pos = checkInt( attribute( elem, "pos-id" ) ); - QString label = attribute( elem, "label-id" ); - QString icon = attribute( elem, "icon-id" ); - - QIcon anIcon; - if ( !icon.isEmpty() ) { - QPixmap pixmap = myModule->getApp()->resourceMgr()->loadPixmap( myModule->name(), icon ); - if ( !pixmap.isNull() ) - anIcon = QIcon( pixmap ); - } - - QMenu* newPopup = menu->addMenu( anIcon, label ); - QAction* before = ( pos >= 0 && pos < actions.count() ) ? actions[ pos ] : 0; - menu->insertMenu( before, newPopup ); - insertPopupItems( node, newPopup ); - } - else if ( aTagName == "separator" ) { - // create menu separator - int pos = checkInt( attribute( elem, "pos-id" ) ); - QAction* action = myModule->separator(); - QAction* before = ( pos >= 0 && pos < actions.count() ) ? actions[ pos ] : 0; - menu->insertAction( before, action ); - } - } - node = node.nextSibling(); - } -} diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.h b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.h deleted file mode 100644 index 510fcabb9..000000000 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.h +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 : SALOME_PYQT_Module.h -// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// - -#ifndef SALOME_PYQT_MODULE_H -#define SALOME_PYQT_MODULE_H - -#include "SALOME_PYQT_GUI.h" -#include "SALOME_PYQT_PyInterp.h" // this include must be first (see PyInterp_Interp.h)! - -#include - -#include -#include -#include -#include - -#include -#include CORBA_CLIENT_HEADER(SALOME_Component) - -class SALOME_PYQT_PyInterp; -class SUIT_ViewWindow; -class QAction; -class QActionGroup; -class QMenu; - -class SALOME_PYQT_EXPORT SALOME_PYQT_Module: public SalomeApp_Module -{ - Q_OBJECT; - -private: - class XmlHandler; - - //! study to Python subinterpreter map - typedef QMap InterpMap; - - static InterpMap myInterpMap; //!< study to Python subinterpreter map - SALOME_PYQT_PyInterp* myInterp; //!< current Python subinterpreter - PyObjWrapper myModule; //!< Python GUI module - static SALOME_PYQT_Module* myInitModule; //!< Python GUI being initialized (not zero only during the initialization) - - XmlHandler* myXmlHandler; //!< XML resource file parser - QMap myWindowsMap; //!< windows map - QStringList myViewMgrList;//!< compatible view managers list - - bool myLastActivateStatus; //!< latest module activation status - -public: - SALOME_PYQT_Module(); - ~SALOME_PYQT_Module(); - -public: - static SALOME_PYQT_Module* getInitModule(); - - void initialize( CAM_Application* ); - void windows( QMap& ) const; - void viewManagers( QStringList& ) const; - void contextMenuPopup( const QString&, QMenu*, QString& ); - void createPreferences(); - QString engineIOR() const; - void studyActivated(); - void preferencesChanged( const QString&, const QString& ); - - static int defaultMenuGroup(); - - int createTool( const QString& ); - int createTool( const int, const int, const int = -1 ); - int createTool( const int, const QString&, const int = -1 ); - int createTool( QAction*, const int, - const int = -1, const int = -1 ); - int createTool( QAction*, const QString&, - const int = -1, const int = -1 ); - - int createMenu( const QString&, const int, - const int = -1, const int = -1, const int = -1 ); - int createMenu( const QString&, const QString&, - const int = -1, const int = -1, const int = -1 ); - int createMenu( const int, const int, - const int = -1, const int = -1 ); - int createMenu( const int, const QString&, - const int = -1, const int = -1 ); - int createMenu( QAction*, const int, - const int = -1, const int = -1, const int = -1 ); - int createMenu( QAction*, const QString&, - const int = -1, const int = -1, const int = -1 ); - - QAction* separator(); - - QAction* action( const int ) const; - int actionId( const QAction* ) const; - QAction* createAction( const int, const QString&, const QString&, - const QString&, const QString&, const int, - const bool = false, QObject* = 0 ); - // QActionGroup* createActionGroup( const int, const bool ); - - - QIcon loadIcon( const QString& fileName ); - - int addGlobalPreference( const QString& ); - int addPreference( const QString& ); - int addPreference( const QString&, const int, const int = -1, - const QString& = QString(), - const QString& = QString() ); - QVariant preferenceProperty( const int, const QString& ) const; - void setPreferenceProperty( const int, const QString&, - const QVariant& ); - -public slots: - virtual bool activateModule( SUIT_Study* ); - virtual bool deactivateModule( SUIT_Study* ); - void preferenceChanged( const QString&, - const QString&, - const QString& ); - void onGUIEvent(); - - void onActiveViewChanged( SUIT_ViewWindow* ); - void onViewClosed( SUIT_ViewWindow* ); - void onViewCloned( SUIT_ViewWindow* ); - -protected: - Engines::Component_var getEngine() const; - -private: - void init( CAM_Application* ); - void activate( SUIT_Study* ); - void deactivate( SUIT_Study* ); - bool lastActivationStatus() const; - void customize( SUIT_Study* ); - void studyChanged( SUIT_Study* ); - void contextMenu( const QString&, QMenu* ); - void guiEvent( const int ); - void initPreferences(); - void prefChanged( const QString&, const QString& ); - - void initInterp ( int ); - void importModule(); - void setWorkSpace(); - - void activeViewChanged( const SUIT_ViewWindow* ); - void viewClosed( const SUIT_ViewWindow* ); - void viewCloned( const SUIT_ViewWindow* ); - void connectView( const SUIT_ViewWindow* ); - - friend class XmlHandler; -}; - -#endif // SALOME_PYQT_MODULE_H diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.cxx b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.cxx deleted file mode 100644 index b086ba7b1..000000000 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.cxx +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 : SALOME_PYQT_PyInterp.cxx -// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// - -#include "SALOME_PYQT_PyInterp.h" // this include must be first (see PyInterp_base.h)! -#include -#include - -/*! - * constructor : the main SALOME Python interpreter is used for PyQt GUI. - * calls initialize method defined in base class, which calls virtual methods - * initstate & initcontext redefined here - */ -SALOME_PYQT_PyInterp::SALOME_PYQT_PyInterp(): PyInterp_Interp() -{ -} - -SALOME_PYQT_PyInterp::~SALOME_PYQT_PyInterp() -{ -} - -bool SALOME_PYQT_PyInterp::initState() -{ - /* - * The GIL is assumed to not be held on the call - * The GIL is acquired in initState and will be held on initState exit - * It is the caller responsability to release the lock on exit if needed - */ - SCRUTE(KERNEL_PYTHON::_gtstate); - _tstate = KERNEL_PYTHON::_gtstate; - PyEval_AcquireThread(_tstate); - SCRUTE(_tstate); - PyEval_ReleaseThread(_tstate); - return true; -} - -bool SALOME_PYQT_PyInterp::initContext() -{ - /* - * The GIL is assumed to be held - * It is the caller responsability to acquire the GIL before calling initContext - * It will still be held on initContext exit - */ - _g = PyDict_New(); // create interpreter dictionnary context - PyObject *bimod = PyImport_ImportModule("__builtin__"); - PyDict_SetItemString(_g, "__builtins__", bimod); - Py_DECREF(bimod); - return true; -} - -int SALOME_PYQT_PyInterp::run(const char *command) -{ - MESSAGE("compile"); - PyObject *code = Py_CompileString((char *)command,"PyGUI",Py_file_input); - if(!code){ - // Une erreur s est produite en general SyntaxError - PyErr_Print(); - return -1; - } - //#if PY_VERSION_HEX < 0x02040000 // python version earlier than 2.4.0 - // PyObject *r = PyEval_EvalCode(code,_g,_g); - //#else - PyObject *r = PyEval_EvalCode((PyCodeObject *)code,_g,_g); - //#endif - Py_DECREF(code); - if(!r){ - // Une erreur s est produite a l execution - PyErr_Print(); - return -1 ; - } - Py_DECREF(r); - return 0; -} diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.h b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.h deleted file mode 100644 index 0d104b546..000000000 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 : SALOME_PYQT_PyInterp.h -// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// - -#ifndef SALOME_PYQT_PYINTERP_H -#define SALOME_PYQT_PYINTERP_H - -#include "SALOME_PYQT_GUI.h" - -#include // this include must be first (see PyInterp_base.h)! - -class SALOME_PYQT_EXPORT SALOME_PYQT_PyInterp : public PyInterp_Interp -{ -public: - SALOME_PYQT_PyInterp(); - ~SALOME_PYQT_PyInterp(); - - int run( const char* ); - -protected: - virtual bool initState(); - virtual bool initContext(); -}; - -#endif // SALOME_PYQT_PYINTERP_H diff --git a/src/SALOME_PYQT/SalomePyQt/Makefile.am b/src/SALOME_PYQT/SalomePyQt/Makefile.am deleted file mode 100644 index ee24c1d7d..000000000 --- a/src/SALOME_PYQT/SalomePyQt/Makefile.am +++ /dev/null @@ -1,76 +0,0 @@ -# Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms 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 : Nicolas REJNERI -# Module : SALOME - -include $(top_srcdir)/adm_local/unix/make_common_starter.am - -# Sip common sources -SIP_SRC = sipSalomePyQtSalomePyQt.cc \ - sipSalomePyQtSALOME_Selection.cc \ - sipSalomePyQtQtxAction.cc \ - sipSalomePyQtcmodule.cc - -# Sip definition file -SIP_FILES = SalomePyQt.sip - -EXTRA_DIST += SalomePyQt.sip - -# Libraries targets -MOC_FILES = SalomePyQt_moc.cxx - -COMMON_CPP_FLAGS=$(QT_INCLUDES) $(QWT_INCLUDES) $(SIP_INCLUDES) $(PYTHON_INCLUDES) \ - $(CAS_CPPFLAGS) $(VTK_INCLUDES) $(OGL_INCLUDES) $(BOOST_CPPFLAGS) \ - -DHAVE_CONFIG_H @KERNEL_CXXFLAGS@ -I$(top_builddir)/salomeadn/unix \ - -I$(top_builddir)/idl \ - -I$(srcdir)/../../SUIT -I$(srcdir)/../../CAM -I$(srcdir)/../../STD \ - -I$(srcdir)/../../Qtx -I$(srcdir)/../../SalomeApp -I$(srcdir)/../../Event \ - -I$(srcdir)/../../SalomeSession -I$(srcdir)/../../LogWindow \ - -I$(srcdir)/../../VTKViewer -I$(srcdir)/../../TOOLSGUI \ - -I$(srcdir)/../../OCCViewer -I$(srcdir)/../../Plot2d \ - -I$(srcdir)/../SALOME_PYQT_GUI -I$(srcdir)/../../PyInterp \ - -I$(srcdir)/../../LightApp -I$(srcdir)/../../ObjBrowser \ - -I$(srcdir)/../../OBJECT \ - -I$(top_builddir)/salome_adm/unix @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ - -COMMON_LIBS=$(PYTHON_LIBS) $(SIP_LIBS) $(PYQT_LIBS) $(VTK_LIBS) $(QWT_LIBS) \ - $(OGL_LIBS) ../../SUIT/libsuit.la ../../CAM/libCAM.la ../../STD/libstd.la \ - ../../Qtx/libqtx.la ../../SalomeApp/libSalomeApp.la ../../Event/libEvent.la \ - ../../Session/libSalomeSession.la ../../LogWindow/libLogWindow.la \ - ../../VTKViewer/libVTKViewer.la ../../TOOLSGUI/libToolsGUI.la \ - ../SALOME_PYQT_GUI/libSalomePyQtGUI.la ../../OCCViewer/libOCCViewer.la \ - ../../Plot2d/libPlot2d.la - -lib_LTLIBRARIES = libSalomePyQt.la -dist_libSalomePyQt_la_SOURCES= SalomePyQt.cxx -nodist_libSalomePyQt_la_SOURCES= $(MOC_FILES) $(SIP_SRC) -libSalomePyQt_la_CPPFLAGS = $(COMMON_CPP_FLAGS) -libSalomePyQt_la_LIBADD = $(COMMON_LIBS) - -# Custom build step: generate C++ wrapping according to $(SIP_FILES) -$(SIP_SRC): $(SIP_FILES) - $(SIP) $(PYQT_SIPFLAGS) $< - -install-exec-hook: $(libdir)/SalomePyQt.so -$(libdir)/SalomePyQt.so: - (cd $(libdir); ln -s libSalomePyQt.so SalomePyQt.so;) - -mostlyclean-local: - rm -f sip* diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx deleted file mode 100644 index 0d2c16032..000000000 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx +++ /dev/null @@ -1,2620 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 : SalomePyQt.cxx -// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// - -#include // this include must be first!!! -#include "SalomePyQt.h" - -#include -#include -#include -#include -#include -#include - -#include - -//#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/*! - \brief Get the currently active application. - \internal - \return active application object or 0 if there is no any -*/ -static SalomeApp_Application* getApplication() -{ - if ( SUIT_Session::session() ) - return dynamic_cast( SUIT_Session::session()->activeApplication() ); - return 0; -} - -/*! - \brief Get the currently active study. - \internal - \return active study or 0 if there is no study opened -*/ -static SalomeApp_Study* getActiveStudy() -{ - if ( getApplication() ) - return dynamic_cast( getApplication()->activeStudy() ); - return 0; -} - -/*! - \brief Get the currently active module. - \internal - This function returns correct result only if Python-based - module is currently active. Otherwize, 0 is returned. -*/ -static SALOME_PYQT_Module* getActiveModule() -{ - SALOME_PYQT_Module* module = 0; - if ( SalomeApp_Application* anApp = getApplication() ) { - module = SALOME_PYQT_Module::getInitModule(); - if ( !module ) - module = dynamic_cast( anApp->activeModule() ); - } - return module; -} - -/*! - \class SALOME_Selection - \brief The class represents selection which can be used in Python. -*/ - -/*! - \brief Map of created selection objects. - \internal -*/ -static QMap SelMap; - -/*! - \brief Get the selection object for the specified application. - - Finds or creates the selection object (one per study). - - \param app application object - \return selection object or 0 if \a app is invalid -*/ -SALOME_Selection* SALOME_Selection::GetSelection( SalomeApp_Application* app ) -{ - SALOME_Selection* sel = 0; - if ( app && SelMap.find( app ) != SelMap.end() ) - sel = SelMap[ app ]; - else - sel = SelMap[ app ] = new SALOME_Selection( app ); - return sel; -} - -/*! - \brief Constructor. - \param p parent object -*/ -SALOME_Selection::SALOME_Selection( QObject* p ) : QObject( p ), mySelMgr( 0 ) -{ - SalomeApp_Application* app = dynamic_cast( p ); - if ( app ) { - mySelMgr = app->selectionMgr(); - connect( mySelMgr, SIGNAL( selectionChanged() ), this, SIGNAL( currentSelectionChanged() ) ); - connect( mySelMgr, SIGNAL( destroyed() ), this, SLOT ( onSelMgrDestroyed() ) ); - } -} -/*! - \brief Destructor. -*/ -SALOME_Selection::~SALOME_Selection() -{ - SalomeApp_Application* app = dynamic_cast( parent() ); - if ( app && SelMap.find( app ) != SelMap.end() ) - SelMap.remove( app ); -} - -/*! - \brief Called when selection manager is destroyed (usually - when the study is closed). -*/ -void SALOME_Selection::onSelMgrDestroyed() -{ - mySelMgr = 0; -} - -/*! - \brief Clear the selection. -*/ -void SALOME_Selection::Clear() -{ - class TEvent: public SALOME_Event { - LightApp_SelectionMgr* mySelMgr; - public: - TEvent( LightApp_SelectionMgr* selMgr ) - : mySelMgr( selMgr ) {} - virtual void Execute() { - if ( mySelMgr ) - mySelMgr->clearSelected(); - } - }; - ProcessVoidEvent( new TEvent( mySelMgr ) ); -} - -/*! - \brief Clear the selection. -*/ -void SALOME_Selection::ClearIObjects() -{ - Clear(); -} - -/*! - Removes all selection filters. -*/ -void SALOME_Selection::ClearFilters() -{ - class TEvent: public SALOME_Event { - LightApp_SelectionMgr* mySelMgr; - public: - TEvent( LightApp_SelectionMgr* selMgr ) - : mySelMgr( selMgr ) {} - virtual void Execute() { - if ( mySelMgr ) - mySelMgr->clearFilters(); - } - }; - ProcessVoidEvent( new TEvent( mySelMgr ) ); -} - -/*! - \class SalomePyQt - \brief The class provides utility functions which can be used in the Python - to operate with the SALOME GUI. - - All the functionality of this class is implemented as static methods, so they - can be called with the class name prefixed or via creation of the class instance. - For example, next both ways of SalomePyQt class usage are legal: - \code - from SalomePyQt import * - sg = SalomePyQt() - # using SalomePyQt class instance - desktop = sg.getDesktop() - # using SalomePyQt class directly - menubar = SalomePyQt.getMainMenuBar() - \endcode -*/ - -/*! - \fn QWidget* SalomePyQt::getDesktop(); - \brief Get the active application's desktop window. - \return desktop window or 0 if there is no any -*/ - -class TGetDesktopEvent: public SALOME_Event -{ -public: - typedef QWidget* TResult; - TResult myResult; - TGetDesktopEvent() : myResult( 0 ) {} - virtual void Execute() - { - if ( getApplication() ) - myResult = (QWidget*)( getApplication()->desktop() ); - } -}; -QWidget* SalomePyQt::getDesktop() -{ - return ProcessEvent( new TGetDesktopEvent() ); -} - -/*! - \fn QWidget* SalomePyQt::getMainFrame(); - \brief Get current application's main frame widget [obsolete]. - - Main frame widget is an internal widget of the application - desktop window (workspace). - - \return workspace widget (0 on any error) -*/ - -class TGetMainFrameEvent: public SALOME_Event -{ -public: - typedef QWidget* TResult; - TResult myResult; - TGetMainFrameEvent() : myResult( 0 ) {} - virtual void Execute() - { - if ( getApplication() ) { - SUIT_Desktop* aDesktop = getApplication()->desktop(); - myResult = (QWidget*)( aDesktop->centralWidget() ); - } - } -}; -QWidget* SalomePyQt::getMainFrame() -{ - return ProcessEvent( new TGetMainFrameEvent() ); -} - -/*! - \fn QMenuBar* SalomePyQt::getMainMenuBar(); - \brief Get current application desktop's main menu. - \return main menu object (0 on any error) -*/ - -class TGetMainMenuBarEvent: public SALOME_Event -{ -public: - typedef QMenuBar* TResult; - TResult myResult; - TGetMainMenuBarEvent() : myResult( 0 ) {} - virtual void Execute() - { - if ( SalomeApp_Application* anApp = getApplication() ) { - myResult = anApp->desktop()->menuBar(); - } - } -}; -QMenuBar* SalomePyQt::getMainMenuBar() -{ - return ProcessEvent( new TGetMainMenuBarEvent() ); -} - -/*! - QMenu* SalomePyQt::getPopupMenu( const MenuName menu ); - \brief Get main menu's child popup submenu by its identifier. - - This function is obsolete. - Use QMenu* SalomePyQt::getPopupMenu( const QString& menu ) instead. - - \param menu menu identifier - \return popup submenu object or 0 if it does not exist -*/ - -/*! - QMenu* SalomePyQt::getPopupMenu( const QString& menu ); - \brief Get main menu's child popup submenu by its name. - - The function creates menu if it does not exist. - - \param menu menu name - \return popup submenu object (0 on any error) -*/ - -class TGetPopupMenuEvent: public SALOME_Event -{ -public: - typedef QMenu* TResult; - TResult myResult; - QString myMenuName; - TGetPopupMenuEvent( const QString& menu ) : myResult( 0 ), myMenuName( menu ) {} - virtual void Execute() - { - SalomeApp_Application* anApp = getApplication(); - if ( anApp && !myMenuName.isEmpty() ) { - QtxActionMenuMgr* mgr = anApp->desktop()->menuMgr(); - myResult = mgr->findMenu( myMenuName, -1, false ); // search only top menu - } - } -}; - -static QString getMenuName( const QString& menuId ) -{ - QStringList contexts; - contexts << "SalomeApp_Application" << "LightApp_Application" << "STD_TabDesktop" << - "STD_MDIDesktop" << "STD_Application" << "SUIT_Application" << ""; - QString menuName = menuId; - for ( int i = 0; i < contexts.count() && menuName == menuId; i++ ) - menuName = QApplication::translate( contexts[i].toLatin1().data(), menuId.toLatin1().data() ); - return menuName; -} - -QMenu* SalomePyQt::getPopupMenu( const MenuName menu ) -{ - QString menuName; - switch( menu ) { - case File: - menuName = getMenuName( "MEN_DESK_FILE" ); break; - case View: - menuName = getMenuName( "MEN_DESK_VIEW" ); break; - case Edit: - menuName = getMenuName( "MEN_DESK_EDIT" ); break; - case Preferences: - menuName = getMenuName( "MEN_DESK_PREFERENCES" ); break; - case Tools: - menuName = getMenuName( "MEN_DESK_TOOLS" ); break; - case Window: - menuName = getMenuName( "MEN_DESK_WINDOW" ); break; - case Help: - menuName = getMenuName( "MEN_DESK_HELP" ); break; - } - return ProcessEvent( new TGetPopupMenuEvent( menuName ) ); -} -QMenu* SalomePyQt::getPopupMenu( const QString& menu ) -{ - return ProcessEvent( new TGetPopupMenuEvent( menu ) ); -} - -/*! - \fn int SalomePyQt::getStudyId(); - \brief Get active study's identifier. - \return active study ID or 0 if there is no active study -*/ - -class TGetStudyIdEvent: public SALOME_Event -{ -public: - typedef int TResult; - TResult myResult; - TGetStudyIdEvent() : myResult( 0 ) {} - virtual void Execute() - { - if ( SalomeApp_Study* aStudy = getActiveStudy() ) { - myResult = aStudy->studyDS()->StudyId(); - } - } -}; -int SalomePyQt::getStudyId() -{ - return ProcessEvent( new TGetStudyIdEvent() ); -} - -/*! - \fn SALOME_Selection* SalomePyQt::getSelection() - \brief Get the selection object for the current study. - - Creates a Selection object if it has not been created yet. - - \return selection object (0 on error) -*/ - -class TGetSelectionEvent: public SALOME_Event -{ -public: - typedef SALOME_Selection* TResult; - TResult myResult; - TGetSelectionEvent() : myResult( 0 ) {} - virtual void Execute() - { - myResult = SALOME_Selection::GetSelection( getApplication() ); - } -}; -SALOME_Selection* SalomePyQt::getSelection() -{ - return ProcessEvent( new TGetSelectionEvent() ); -} - -/*! - \fn void SalomePyQt::putInfo( const QString& msg, const int sec ) - \brief Put an information message to the current application's - desktop status bar. - - Optional second delay parameter (\a sec) can be used to specify - time of the message diplaying in seconds. If this parameter is less - or equal to zero, the constant message will be put. - - \param msg message text - \param sec message displaying time in seconds -*/ - -class TPutInfoEvent: public SALOME_Event -{ - QString myMsg; - int mySecs; -public: - TPutInfoEvent( const QString& msg, const int sec = 0 ) : myMsg( msg ), mySecs( sec ) {} - virtual void Execute() - { - if ( SalomeApp_Application* anApp = getApplication() ) { - anApp->putInfo( myMsg, mySecs * 1000 ); - } - } -}; -void SalomePyQt::putInfo( const QString& msg, const int sec ) -{ - ProcessVoidEvent( new TPutInfoEvent( msg, sec ) ); -} - -/*! - \fn const QString SalomePyQt::getActiveComponent(); - \brief Get the currently active module name (for the current study). - \return active module name or empty string if there is no active module -*/ - -class TGetActiveComponentEvent: public SALOME_Event -{ -public: - typedef QString TResult; - TResult myResult; - TGetActiveComponentEvent() {} - virtual void Execute() - { - if ( SalomeApp_Application* anApp = getApplication() ) { - if ( CAM_Module* mod = anApp->activeModule() ) { - myResult = mod->name(); - } - } - } -}; -const QString SalomePyQt::getActiveComponent() -{ - return ProcessEvent( new TGetActiveComponentEvent() ); -} - -/*! - \brief Update an Object Browser of the specified (by identifier) study. - - If \a studyId <= 0 the active study's object browser is updated. - The \a updateSelection parameter is obsolete and currently is not used. - This parameter will be removed in future, so try to avoid its usage in - your code. - - \brief studyId study identifier - \brief updateSelection update selection flag (not used) - \sa getActiveStudy() -*/ -void SalomePyQt::updateObjBrowser( const int studyId, bool updateSelection ) -{ - class TEvent: public SALOME_Event - { - int myStudyId; - bool myUpdateSelection; - public: - TEvent( const int studyId, bool updateSelection ) - : myStudyId( studyId ), myUpdateSelection( updateSelection ) {} - virtual void Execute() - { - if ( SUIT_Session::session() ) { - if ( getActiveStudy() && myStudyId <= 0 ) - myStudyId = getActiveStudy()->id(); - if ( myStudyId > 0 ) { - QList apps = SUIT_Session::session()->applications(); - QList::Iterator it; - for( it = apps.begin(); it != apps.end(); ++it ) { - SalomeApp_Application* anApp = dynamic_cast( *it ); - if ( anApp && anApp->activeStudy() && anApp->activeStudy()->id() == myStudyId ) { - anApp->updateObjectBrowser(); - return; - } - } - } - } - } - }; - ProcessVoidEvent( new TEvent( studyId, updateSelection ) ); -} - -/*! - \brief Default resource file section name. - \internal -*/ -static const char* DEFAULT_SECTION = "SalomePyQt"; - -/*! - \brief Add string setting to the application preferences. - - The parameter \a autoValue is obsolete parameter and currently is not used. - This parameter will be removed in future, so try to avoid its usage in - your code. - - This function is obsolete. Use one of addSetting() instead. - - \param name setting name (it should be of kind where - \c section is resources section name and \c setting is setting name) - \param value new setting value - \param autoValue (not used) -*/ -void SalomePyQt::addStringSetting( const QString& name, const QString& value, bool autoValue ) -{ - class TEvent: public SALOME_Event - { - QString myName; - QString myValue; - bool myAutoValue; - public: - TEvent( const QString& name, const QString& value, bool autoValue ) - : myName( name ), myValue( value ), myAutoValue( autoValue ) {} - virtual void Execute() { - if ( SUIT_Session::session() ) { - SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - QStringList sl = myName.split( ":", QString::SkipEmptyParts ); - QString _sec = sl.count() > 1 ? sl[ 0 ].trimmed() : QString( DEFAULT_SECTION ); - QString _nam = sl.count() > 1 ? sl[ 1 ].trimmed() : sl.count() > 0 ? sl[ 0 ].trimmed() : QString( "" ); - if ( !_sec.isEmpty() && !_nam.isEmpty() ) - resMgr->setValue( _sec, _nam, myValue ); - } - } - }; - ProcessVoidEvent( new TEvent( name, value, autoValue ) ); -} - -/*! - \brief Add integer setting to the application preferences. - - The parameter \a autoValue is obsolete parameter and currently is not used. - This parameter will be removed in future, so try to avoid its usage in - your code. - - This function is obsolete. Use one of addSetting() instead. - - \param name setting name (it should be of kind where - \c section is resources section name and \c setting is setting name) - \param value new setting value - \param autoValue (not used) -*/ -void SalomePyQt::addIntSetting( const QString& name, const int value, bool autoValue) -{ - class TEvent: public SALOME_Event - { - QString myName; - int myValue; - bool myAutoValue; - public: - TEvent( const QString& name, const int value, bool autoValue ) - : myName( name ), myValue( value ), myAutoValue( autoValue ) {} - virtual void Execute() - { - if ( SUIT_Session::session() ) { - SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - QStringList sl = myName.split( ":", QString::SkipEmptyParts ); - QString _sec = sl.count() > 1 ? sl[ 0 ].trimmed() : QString( DEFAULT_SECTION ); - QString _nam = sl.count() > 1 ? sl[ 1 ].trimmed() : sl.count() > 0 ? sl[ 0 ].trimmed() : QString( "" ); - if ( !_sec.isEmpty() && !_nam.isEmpty() ) - resMgr->setValue( _sec, _nam, myValue ); - } - } - }; - ProcessVoidEvent( new TEvent( name, value, autoValue ) ); -} - -/*! - \brief Add double setting to the application preferences. - - The parameter \a autoValue is obsolete parameter and currently is not used. - This parameter will be removed in future, so try to avoid its usage in - your code. - - This function is obsolete. Use one of addSetting() instead. - - \param name setting name (it should be of kind where - \c section is resources section name and \c setting is setting name) - \param value new setting value - \param autoValue (not used) -*/ -void SalomePyQt::addDoubleSetting( const QString& name, const double value, bool autoValue ) -{ - class TEvent: public SALOME_Event - { - QString myName; - double myValue; - bool myAutoValue; - public: - TEvent( const QString& name, const double value, bool autoValue ) - : myName( name ), myValue( value ), myAutoValue( autoValue ) {} - virtual void Execute() - { - if ( SUIT_Session::session() ) { - SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - QStringList sl = myName.split( ":", QString::SkipEmptyParts ); - QString _sec = sl.count() > 1 ? sl[ 0 ].trimmed() : QString( DEFAULT_SECTION ); - QString _nam = sl.count() > 1 ? sl[ 1 ].trimmed() : sl.count() > 0 ? sl[ 0 ].trimmed() : QString( "" ); - if ( !_sec.isEmpty() && !_nam.isEmpty() ) - resMgr->setValue( _sec, _nam, myValue ); - } - } - }; - ProcessVoidEvent( new TEvent( name, value, autoValue ) ); -} - -/*! - \brief Add boolean setting to the application preferences. - - The parameter \a autoValue is obsolete parameter and currently is not used. - This parameter will be removed in future, so try to avoid its usage in - your code. - - This function is obsolete. Use one of addSetting() instead. - - \param name setting name (it should be of kind where - \c section is resources section name and \c setting is setting name) - \param value new setting value - \param autoValue (not used) -*/ -void SalomePyQt::addBoolSetting( const QString& name, const bool value, bool autoValue ) -{ - class TEvent: public SALOME_Event - { - QString myName; - bool myValue; - bool myAutoValue; - public: - TEvent( const QString& name, const bool value, bool autoValue ) - : myName( name ), myValue( value ), myAutoValue( autoValue ) {} - virtual void Execute() - { - if ( SUIT_Session::session() ) { - SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - QStringList sl = myName.split( ":", QString::SkipEmptyParts ); - QString _sec = sl.count() > 1 ? sl[ 0 ].trimmed() : QString( DEFAULT_SECTION ); - QString _nam = sl.count() > 1 ? sl[ 1 ].trimmed() : sl.count() > 0 ? sl[ 0 ].trimmed() : QString( "" ); - if ( !_sec.isEmpty() && !_nam.isEmpty() ) - resMgr->setValue( _sec, _nam, myValue ); - } - } - }; - ProcessVoidEvent( new TEvent( name, value, autoValue ) ); -} - -/*! - \brief Remove setting from the application preferences. - - This function is obsolete. Use removeSetting() instead. - - \param name setting name (it should be of kind where - \c section is resources section name and \c setting is setting name) -*/ -void SalomePyQt::removeSettings( const QString& name ) -{ - class TEvent: public SALOME_Event { - QString myName; - public: - TEvent( const QString& name ) : myName( name ) {} - virtual void Execute() { - if ( SUIT_Session::session() ) { - SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - QStringList sl = myName.split( ":", QString::SkipEmptyParts ); - QString _sec = sl.count() > 1 ? sl[ 0 ].trimmed() : QString( DEFAULT_SECTION ); - QString _nam = sl.count() > 1 ? sl[ 1 ].trimmed() : sl.count() > 0 ? sl[ 0 ].trimmed() : QString( "" ); - if ( !_sec.isEmpty() && !_nam.isEmpty() ) - resMgr->remove( _sec, _nam ); - } - } - }; - ProcessVoidEvent( new TEvent( name ) ); -} - -/*! - \fn QString SalomePyQt::getSetting( const QString& name ); - \brief Get application setting value (as string represenation). - - This function is obsolete. Use stringSetting(), integerSetting(), - boolSetting(), stringSetting() or colorSetting() instead. - - \param name setting name (it should be of kind where - \c section is resources section name and \c setting is setting name) - \return setting name (empty string if setting name is invalid) -*/ - -class TGetSettingEvent: public SALOME_Event -{ -public: - typedef QString TResult; - TResult myResult; - QString myName; - TGetSettingEvent( const QString& name ) : myName( name ) {} - virtual void Execute() - { - if ( SUIT_Session::session() ) { - SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - QStringList sl = myName.split( ":", QString::SkipEmptyParts ); - QString _sec = sl.count() > 1 ? sl[ 0 ].trimmed() : QString( DEFAULT_SECTION ); - QString _nam = sl.count() > 1 ? sl[ 1 ].trimmed() : sl.count() > 0 ? sl[ 0 ].trimmed() : QString( "" ); - myResult = ( !_sec.isEmpty() && !_nam.isEmpty() ) ? resMgr->stringValue( _sec, _nam, "" ) : QString( "" ); - } - } -}; -QString SalomePyQt::getSetting( const QString& name ) -{ - return ProcessEvent( new TGetSettingEvent( name ) ); -} - -/*! - \brief Add double setting to the application preferences. - \param section resources file section name - \param name setting name - \param value new setting value -*/ -void SalomePyQt::addSetting( const QString& section, const QString& name, const double value ) -{ - class TEvent: public SALOME_Event - { - QString mySection; - QString myName; - double myValue; - public: - TEvent( const QString& section, const QString& name, double value ) - : mySection( section ), myName( name ), myValue( value ) {} - virtual void Execute() - { - if ( SUIT_Session::session() ) { - SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - if ( !mySection.isEmpty() && !myName.isEmpty() ) - resMgr->setValue( mySection, myName, myValue ); - } - } - }; - ProcessVoidEvent( new TEvent( section, name, value ) ); -} - -/*! - \brief Add integer setting to the application preferences. - \param section resources file section name - \param name setting name - \param value new setting value -*/ -void SalomePyQt::addSetting( const QString& section, const QString& name, const int value ) -{ - class TEvent: public SALOME_Event - { - QString mySection; - QString myName; - int myValue; - public: - TEvent( const QString& section, const QString& name, int value ) - : mySection( section ), myName( name ), myValue( value ) {} - virtual void Execute() - { - if ( SUIT_Session::session() ) { - SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - if ( !mySection.isEmpty() && !myName.isEmpty() ) - resMgr->setValue( mySection, myName, myValue ); - } - } - }; - ProcessVoidEvent( new TEvent( section, name, value ) ); -} - -/*! - \brief Add boolean setting to the application preferences. - \param section resources file section name - \param name setting name - \param value new setting value - \param dumb this parameter is used in order to avoid sip compilation error - because of conflicting int and bool types -*/ -void SalomePyQt::addSetting( const QString& section, const QString& name, const bool value, const int /*dumb*/ ) -{ - class TEvent: public SALOME_Event - { - QString mySection; - QString myName; - bool myValue; - public: - TEvent( const QString& section, const QString& name, bool value ) - : mySection( section ), myName( name ), myValue( value ) {} - virtual void Execute() - { - if ( SUIT_Session::session() ) { - SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - if ( !mySection.isEmpty() && !myName.isEmpty() ) - resMgr->setValue( mySection, myName, myValue ); - } - } - }; - ProcessVoidEvent( new TEvent( section, name, value ) ); -} - -/*! - \brief Add string setting to the application preferences. - \param section resources file section name - \param name setting name - \param value new setting value -*/ -void SalomePyQt::addSetting( const QString& section, const QString& name, const QString& value ) -{ - class TEvent: public SALOME_Event - { - QString mySection; - QString myName; - QString myValue; - public: - TEvent( const QString& section, const QString& name, const QString& value ) - : mySection( section ), myName( name ), myValue( value ) {} - virtual void Execute() - { - if ( SUIT_Session::session() ) { - SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - if ( !mySection.isEmpty() && !myName.isEmpty() ) - resMgr->setValue( mySection, myName, myValue ); - } - } - }; - ProcessVoidEvent( new TEvent( section, name, value ) ); -} - -/*! - \brief Add color setting to the application preferences. - \param section resources file section name - \param name setting name - \param value new setting value -*/ -void SalomePyQt::addSetting( const QString& section, const QString& name, const QColor& value ) -{ - class TEvent: public SALOME_Event - { - QString mySection; - QString myName; - QColor myValue; - public: - TEvent( const QString& section, const QString& name, const QColor& value ) - : mySection( section ), myName( name ), myValue( value ) {} - virtual void Execute() - { - if ( SUIT_Session::session() ) { - SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - if ( !mySection.isEmpty() && !myName.isEmpty() ) - resMgr->setValue( mySection, myName, myValue ); - } - } - }; - ProcessVoidEvent( new TEvent( section, name, value ) ); -} - -/*! - \fn int SalomePyQt::integerSetting( const QString& section, - const QString& name, - const int def ); - \brief Get integer setting from the application preferences. - \param section resources file section name - \param name setting name - \param def default value which is returned if the setting is not found - \return setting value -*/ - -class TGetIntSettingEvent: public SALOME_Event -{ -public: - typedef int TResult; - TResult myResult; - QString mySection; - QString myName; - TResult myDefault; - TGetIntSettingEvent( const QString& section, const QString& name, const int def ) - : mySection( section ), myName( name ), myDefault( def ) {} - virtual void Execute() - { - if ( SUIT_Session::session() ) { - SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - myResult = ( !mySection.isEmpty() && !myName.isEmpty() ) ? resMgr->integerValue( mySection, myName, myDefault ) : myDefault; - } - } -}; -int SalomePyQt::integerSetting( const QString& section, const QString& name, const int def ) -{ - return ProcessEvent( new TGetIntSettingEvent( section, name, def ) ); -} - -/*! - \fn double SalomePyQt::doubleSetting( const QString& section, - const QString& name, - const double def ); - \brief Get double setting from the application preferences. - \param section resources file section name - \param name setting name - \param def default value which is returned if the setting is not found - \return setting value -*/ - -class TGetDblSettingEvent: public SALOME_Event -{ -public: - typedef double TResult; - TResult myResult; - QString mySection; - QString myName; - TResult myDefault; - TGetDblSettingEvent( const QString& section, const QString& name, const double def ) - : mySection( section ), myName( name ), myDefault( def ) {} - virtual void Execute() - { - if ( SUIT_Session::session() ) { - SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - myResult = ( !mySection.isEmpty() && !myName.isEmpty() ) ? resMgr->doubleValue( mySection, myName, myDefault ) : myDefault; - } - } -}; -double SalomePyQt::doubleSetting( const QString& section, const QString& name, const double def ) -{ - return ProcessEvent( new TGetDblSettingEvent( section, name, def ) ); -} - -/*! - \fn bool SalomePyQt::boolSetting( const QString& section, - const QString& name, - const bool def ); - \brief Get boolean setting from the application preferences. - \param section resources file section name - \param name setting name - \param def default value which is returned if the setting is not found - \return setting value -*/ - -class TGetBoolSettingEvent: public SALOME_Event -{ -public: - typedef bool TResult; - TResult myResult; - QString mySection; - QString myName; - TResult myDefault; - TGetBoolSettingEvent( const QString& section, const QString& name, const bool def ) - : mySection( section ), myName( name ), myDefault( def ) {} - virtual void Execute() - { - if ( SUIT_Session::session() ) { - SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - myResult = ( !mySection.isEmpty() && !myName.isEmpty() ) ? resMgr->booleanValue( mySection, myName, myDefault ) : myDefault; - } - } -}; -bool SalomePyQt::boolSetting( const QString& section, const QString& name, const bool def ) -{ - return ProcessEvent( new TGetBoolSettingEvent( section, name, def ) ); -} - -/*! - \fn QString SalomePyQt::stringSetting( const QString& section, - const QString& name, - const QString& def ); - \brief Get string setting from the application preferences. - \param section resources file section name - \param name setting name - \param def default value which is returned if the setting is not found - \return setting value -*/ - -class TGetStrSettingEvent: public SALOME_Event -{ -public: - typedef QString TResult; - TResult myResult; - QString mySection; - QString myName; - TResult myDefault; - TGetStrSettingEvent( const QString& section, const QString& name, const QString& def ) - : mySection( section ), myName( name ), myDefault( def ) {} - virtual void Execute() - { - if ( SUIT_Session::session() ) { - SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - myResult = ( !mySection.isEmpty() && !myName.isEmpty() ) ? resMgr->stringValue( mySection, myName, myDefault ) : myDefault; - } - } -}; -QString SalomePyQt::stringSetting( const QString& section, const QString& name, const QString& def ) -{ - return ProcessEvent( new TGetStrSettingEvent( section, name, def ) ); -} - -/*! - \fn QColor SalomePyQt::colorSetting( const QString& section, - const QString& name, - const QColor def ); - \brief Get color setting from the application preferences. - \param section resources file section name - \param name setting name - \param def default value which is returned if the setting is not found - \return setting value -*/ - -class TGetColorSettingEvent: public SALOME_Event -{ -public: - typedef QColor TResult; - TResult myResult; - QString mySection; - QString myName; - TResult myDefault; - TGetColorSettingEvent( const QString& section, const QString& name, const QColor& def ) - : mySection( section ), myName( name ), myDefault( def ) {} - virtual void Execute() - { - if ( SUIT_Session::session() ) { - SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - myResult = ( !mySection.isEmpty() && !myName.isEmpty() ) ? resMgr->colorValue( mySection, myName, myDefault ) : myDefault; - } - } -}; -QColor SalomePyQt::colorSetting ( const QString& section, const QString& name, const QColor& def ) -{ - return ProcessEvent( new TGetColorSettingEvent( section, name, def ) ); -} - -/*! - \brief Remove setting from the application preferences. - \param section resources file section name - \param name setting name -*/ -void SalomePyQt::removeSetting( const QString& section, const QString& name ) -{ - class TEvent: public SALOME_Event - { - QString mySection; - QString myName; - public: - TEvent( const QString& section, const QString& name ) : mySection( section ), myName( name ) {} - virtual void Execute() - { - if ( SUIT_Session::session() ) { - SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - if ( !mySection.isEmpty() && !myName.isEmpty() ) - resMgr->remove( mySection, myName ); - } - } - }; - ProcessVoidEvent( new TEvent( section, name ) ); -} - -/*! - \fn bool SalomePyQt::hasSetting( const QString& section, const QString& name ); - \brief Check setting existence in the application preferences. - \param section resources file section name - \param name setting name - \return \c true if setting exists -*/ - -class THasColorSettingEvent: public SALOME_Event -{ -public: - typedef bool TResult; - TResult myResult; - QString mySection; - QString myName; - THasColorSettingEvent( const QString& section, const QString& name ) - : mySection( section ), myName( name ) {} - virtual void Execute() - { - if ( SUIT_Session::session() ) { - SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - myResult = resMgr->hasValue( mySection, myName ); - } - } -}; -bool SalomePyQt::hasSetting( const QString& section, const QString& name ) -{ - return ProcessEvent( new THasColorSettingEvent( section, name ) ); -} - -/*! - \fn QString SalomePyQt::getFileName( QWidget* parent, - const QString& initial, - const QStringList& filters, - const QString& caption, - bool open ); - \brief Show 'Open/Save file' dialog box for file selection - and return a user's choice (selected file name). - \param parent parent widget - \param initial initial directory the dialog box to be opened in - \param filters list of files filters (wildcards) - \param caption dialog box title - \param open if \c true, "Open File" dialog box is shown; - otherwise "Save File" dialog box is shown - \return selected file name (null string if user cancels operation) -*/ - -class TGetFileNameEvent: public SALOME_Event -{ -public: - typedef QString TResult; - TResult myResult; - QWidget* myParent; - QString myInitial; - QStringList myFilters; - QString myCaption; - bool myOpen; - TGetFileNameEvent( QWidget* parent, - const QString& initial, - const QStringList& filters, - const QString& caption, - bool open ) - : myParent ( parent ), - myInitial( initial ), - myFilters( filters ), - myCaption( caption ), - myOpen ( open ) {} - virtual void Execute() - { - if ( SalomeApp_Application* anApp = getApplication() ) { - myResult = anApp->getFileName( myOpen, myInitial, myFilters.join(";;"), - myCaption, myParent ); - } - } -}; -QString SalomePyQt::getFileName( QWidget* parent, - const QString& initial, - const QStringList& filters, - const QString& caption, - bool open ) -{ - return ProcessEvent( new TGetFileNameEvent( parent, initial, filters, caption, open ) ); -} - -/*! - \fn QStringList SalomePyQt::getOpenFileNames( QWidget* parent, - const QString& initial, - const QStringList& filters, - const QString& caption ); - \brief Show 'Open files' dialog box for multiple files selection - and return a user's choice (selected file names list). - \param parent parent widget - \param initial initial directory the dialog box to be opened in - \param filters list of files filters (wildcards) - \param caption dialog box title - \return selected file names list (empty list if user cancels operation) -*/ - -class TGetOpenFileNamesEvent: public SALOME_Event -{ -public: - typedef QStringList TResult; - TResult myResult; - QWidget* myParent; - QString myInitial; - QStringList myFilters; - QString myCaption; - TGetOpenFileNamesEvent( QWidget* parent, - const QString& initial, - const QStringList& filters, - const QString& caption ) - : myParent ( parent ), - myInitial( initial ), - myFilters( filters ), - myCaption( caption ) {} - virtual void Execute() - { - if ( SalomeApp_Application* anApp = getApplication() ) { - myResult = anApp->getOpenFileNames( myInitial, myFilters.join(";;"), myCaption, myParent ); - } - } -}; -QStringList SalomePyQt::getOpenFileNames( QWidget* parent, - const QString& initial, - const QStringList& filters, - const QString& caption ) -{ - return ProcessEvent( new TGetOpenFileNamesEvent( parent, initial, filters, caption ) ); -} - -/*! - \fn QString SalomePyQt::getExistingDirectory( QWidget* parent, - const QString& initial, - const QString& caption ); - \brief Show 'Get Directory' dialog box for the directory selection - and return a user's choice (selected directory name). - \param parent parent widget - \param initial initial directory the dialog box to be opened in - \param caption dialog box title - \return selected directory name (null string if user cancels operation) -*/ - -class TGetExistingDirectoryEvent: public SALOME_Event -{ -public: - typedef QString TResult; - TResult myResult; - QWidget* myParent; - QString myInitial; - QString myCaption; - TGetExistingDirectoryEvent( QWidget* parent, - const QString& initial, - const QString& caption ) - : myParent ( parent ), - myInitial( initial ), - myCaption( caption ) {} - virtual void Execute() - { - if ( SalomeApp_Application* anApp = getApplication() ) { - myResult = anApp->getDirectory( myInitial, myCaption, myParent ); - } - } -}; -QString SalomePyQt::getExistingDirectory( QWidget* parent, - const QString& initial, - const QString& caption ) -{ - return ProcessEvent( new TGetExistingDirectoryEvent( parent, initial, caption ) ); -} - -/*! - \brief Open external browser to display context help information. - \todo - - Current implementation does nothing. - - \param source documentation (HTML) file name - \param context context (for example, HTML ancor name) -*/ -void SalomePyQt::helpContext( const QString& source, const QString& context ) -{ - class TEvent: public SALOME_Event - { - QString mySource; - QString myContext; - public: - TEvent( const QString& source, const QString& context ) - : mySource( source ), myContext( context ) {} - virtual void Execute() - { - if ( SalomeApp_Application* anApp = getApplication() ) { - anApp->onHelpContextModule( "", mySource, myContext ); - } - } - }; - ProcessVoidEvent( new TEvent( source, context ) ); -} - -/*! - \fn bool SalomePyQt::dumpView( const QString& filename ); - \brief Dump the contents of the currently active view window - to the image file in the specified format. - - For the current moment JPEG, PNG and BMP images formats are supported. - The image format is defined automatically by the file name extension. - By default, BMP format is used. - - \param filename image file name - \return operation status (\c true on success) -*/ - -class TDumpViewEvent: public SALOME_Event -{ -public: - typedef bool TResult; - TResult myResult; - QString myFileName; - TDumpViewEvent( const QString& filename ) - : myResult ( false ), myFileName( filename ) {} - virtual void Execute() - { - if ( SalomeApp_Application* anApp = getApplication() ) { - SUIT_ViewManager* vm = anApp->activeViewManager(); - if ( vm ) { - SUIT_ViewWindow* vw = vm->getActiveView(); - if ( vw ) { - QImage im = vw->dumpView(); - if ( !im.isNull() && !myFileName.isEmpty() ) { - QString fmt = SUIT_Tools::extension( myFileName ).toUpper(); - if ( fmt.isEmpty() ) fmt = QString( "BMP" ); // default format - if ( fmt == "JPG" ) fmt = "JPEG"; - myResult = im.save( myFileName, fmt.toLatin1() ); - } - } - } - } - } -}; -bool SalomePyQt::dumpView( const QString& filename ) -{ - return ProcessEvent( new TDumpViewEvent( filename ) ); -} - -/*! - \fn int SalomePyQt::defaultMenuGroup(); - \brief Get detault menu group identifier which can be used when - creating menus (insert custom menu commands). - \return default menu group ID -*/ - -class TDefMenuGroupEvent: public SALOME_Event -{ -public: - typedef int TResult; - TResult myResult; - TDefMenuGroupEvent() : myResult( -1 ) {} - virtual void Execute() - { - myResult = SALOME_PYQT_Module::defaultMenuGroup(); - } -}; -int SalomePyQt::defaultMenuGroup() -{ - return ProcessEvent( new TDefMenuGroupEvent() ); -} - -class CrTool -{ -public: - CrTool( const QString& tBar ) - : myCase( 0 ), myTbName( tBar ) {} - CrTool( const int id, const int tBar, const int idx ) - : myCase( 1 ), myId( id ), myTbId( tBar ), myIndex( idx ) {} - CrTool( const int id, const QString& tBar, const int idx ) - : myCase( 2 ), myId( id ), myTbName( tBar ), myIndex( idx ) {} - CrTool( QAction* action, const int tbId, const int id, const int idx ) - : myCase( 3 ), myAction( action ), myTbId( tbId ), myId( id ), myIndex( idx ) {} - CrTool( QAction* action, const QString& tBar, const int id, const int idx ) - : myCase( 4 ), myAction( action ), myTbName( tBar ), myId( id ), myIndex( idx ) {} - - int execute( SALOME_PYQT_Module* module ) const - { - if ( module ) { - switch ( myCase ) { - case 0: - return module->createTool( myTbName ); - case 1: - return module->createTool( myId, myTbId, myIndex ); - case 2: - return module->createTool( myId, myTbName, myIndex ); - case 3: - return module->createTool( myAction, myTbId, myId, myIndex ); - case 4: - return module->createTool( myAction, myTbName, myId, myIndex ); - } - } - return -1; - } -private: - int myCase; - QString myTbName; - int myTbId; - QAction* myAction; - int myId; - int myIndex; -}; - -class TCreateToolEvent: public SALOME_Event -{ -public: - typedef int TResult; - TResult myResult; - const CrTool& myCrTool; - TCreateToolEvent( const CrTool& crTool ) - : myResult( -1 ), myCrTool( crTool ) {} - virtual void Execute() - { - SALOME_PYQT_Module* module = getActiveModule(); - if ( module ) - myResult = myCrTool.execute( module ); - } -}; - -/*! - \brief Create toolbar with specified name. - \param tBar toolbar name - \return toolbar ID or -1 if toolbar creation is failed -*/ -int SalomePyQt::createTool( const QString& tBar ) -{ - return ProcessEvent( new TCreateToolEvent( CrTool( tBar ) ) ); -} - -/*! - \brief Insert action with specified \a id to the toolbar. - \param id action ID - \param tBar toolbar ID - \param idx required index in the toolbar - \return action ID or -1 if action could not be added -*/ -int SalomePyQt::createTool( const int id, const int tBar, const int idx ) -{ - return ProcessEvent( new TCreateToolEvent( CrTool( id, tBar, idx ) ) ); -} - -/*! - \brief Insert action with specified \a id to the toolbar. - \param id action ID - \param tBar toolbar name - \param idx required index in the toolbar - \return action ID or -1 if action could not be added -*/ -int SalomePyQt::createTool( const int id, const QString& tBar, const int idx ) -{ - return ProcessEvent( new TCreateToolEvent( CrTool( id, tBar, idx ) ) ); -} - -/*! - \brief Insert action to the toolbar. - \param a action - \param tBar toolbar ID - \param id required action ID - \param idx required index in the toolbar - \return action ID or -1 if action could not be added -*/ -int SalomePyQt::createTool( QAction* a, const int tBar, const int id, const int idx ) -{ - return ProcessEvent( new TCreateToolEvent( CrTool( a, tBar, id, idx ) ) ); -} - -/*! - \brief Insert action to the toolbar. - \param a action - \param tBar toolbar name - \param id required action ID - \param idx required index in the toolbar - \return action ID or -1 if action could not be added -*/ -int SalomePyQt::createTool( QAction* a, const QString& tBar, const int id, const int idx ) -{ - return ProcessEvent( new TCreateToolEvent( CrTool( a, tBar, id, idx ) ) ); -} - -class CrMenu -{ -public: - CrMenu( const QString& subMenu, const int menu, const int id, const int group, const int idx ) - : myCase( 0 ), mySubMenuName( subMenu ), myMenuId( menu ), myId( id ), myGroup( group ), myIndex( idx ) {} - CrMenu( const QString& subMenu, const QString& menu, const int id, const int group, const int idx ) - : myCase( 1 ), mySubMenuName( subMenu ), myMenuName( menu ), myId( id ), myGroup( group ), myIndex( idx ) {} - CrMenu( const int id, const int menu, const int group, const int idx ) - : myCase( 2 ), myId( id ), myMenuId( menu ), myGroup( group ), myIndex( idx ) {} - CrMenu( const int id, const QString& menu, const int group, const int idx ) - : myCase( 3 ), myId( id ), myMenuName( menu ), myGroup( group ), myIndex( idx ) {} - CrMenu( QAction* action, const int menu, const int id, const int group, const int idx ) - : myCase( 4 ), myAction( action ), myMenuId( menu ), myId( id ), myGroup( group ), myIndex( idx ) {} - CrMenu( QAction* action, const QString& menu, const int id, const int group, const int idx ) - : myCase( 5 ), myAction( action ), myMenuName( menu ), myId( id ), myGroup( group ), myIndex( idx ) {} - - int execute( SALOME_PYQT_Module* module ) const - { - if ( module ) { - switch ( myCase ) { - case 0: - return module->createMenu( mySubMenuName, myMenuId, myId, myGroup, myIndex ); - case 1: - return module->createMenu( mySubMenuName, myMenuName, myId, myGroup, myIndex ); - case 2: - return module->createMenu( myId, myMenuId, myGroup, myIndex ); - case 3: - return module->createMenu( myId, myMenuName, myGroup, myIndex ); - case 4: - return module->createMenu( myAction, myMenuId, myId, myGroup, myIndex ); - case 5: - return module->createMenu( myAction, myMenuName, myId, myGroup, myIndex ); - } - } - return -1; - } -private: - int myCase; - QString myMenuName; - int myMenuId; - QString mySubMenuName; - int myGroup; - QAction* myAction; - int myId; - int myIndex; -}; - -class TCreateMenuEvent: public SALOME_Event -{ -public: - typedef int TResult; - TResult myResult; - const CrMenu& myCrMenu; - TCreateMenuEvent( const CrMenu& crMenu ) - : myResult( -1 ), myCrMenu( crMenu ) {} - virtual void Execute() - { - SALOME_PYQT_Module* module = getActiveModule(); - if ( module ) - myResult = myCrMenu.execute( module ); - } -}; - -/*! - \brief Create main menu. - \param subMenu menu name - \param menu parent menu ID - \param id required menu ID - \param group menu group ID - \param idx required index in the menu - \return menu ID or -1 if menu could not be added -*/ -int SalomePyQt::createMenu( const QString& subMenu, const int menu, const int id, const int group, const int idx ) -{ - return ProcessEvent( new TCreateMenuEvent( CrMenu( subMenu, menu, id, group, idx ) ) ); -} - -/*! - \brief Create main menu. - \param subMenu menu name - \param menu parent menu name (list of menu names separated by "|") - \param id required menu ID - \param group menu group ID - \param idx required index in the menu - \return menu ID or -1 if menu could not be added -*/ -int SalomePyQt::createMenu( const QString& subMenu, const QString& menu, const int id, const int group, const int idx ) -{ - return ProcessEvent( new TCreateMenuEvent( CrMenu( subMenu, menu, id, group, idx ) ) ); -} - -/*! - \brief Insert action to the main menu. - \param id action ID - \param menu parent menu ID - \param group menu group ID - \param idx required index in the menu - \return action ID or -1 if action could not be added -*/ -int SalomePyQt::createMenu( const int id, const int menu, const int group, const int idx ) -{ - return ProcessEvent( new TCreateMenuEvent( CrMenu( id, menu, group, idx ) ) ); -} - -/*! - \brief Insert action to the main menu. - \param id action ID - \param menu parent menu name (list of menu names separated by "|") - \param group menu group ID - \param idx required index in the menu - \return action ID or -1 if action could not be added -*/ -int SalomePyQt::createMenu( const int id, const QString& menu, const int group, const int idx ) -{ - return ProcessEvent( new TCreateMenuEvent( CrMenu( id, menu, group, idx ) ) ); -} - -/*! - \brief Insert action to the main menu. - \param a action - \param menu parent menu ID - \param group menu group ID - \param idx required index in the menu - \return action ID or -1 if action could not be added -*/ -int SalomePyQt::createMenu( QAction* a, const int menu, const int id, const int group, const int idx ) -{ - return ProcessEvent( new TCreateMenuEvent( CrMenu( a, menu, id, group, idx ) ) ); -} - -/*! - \brief Insert action to the main menu. - \param a action - \param menu parent menu name (list of menu names separated by "|") - \param group menu group ID - \param idx required index in the menu - \return action ID or -1 if action could not be added -*/ -int SalomePyQt::createMenu( QAction* a, const QString& menu, const int id, const int group, const int idx ) -{ - return ProcessEvent( new TCreateMenuEvent( CrMenu( a, menu, id, group, idx ) ) ); -} - -/*! - \fn QAction* SalomePyQt::createSeparator(); - \brief Create separator action which can be used in the menu or toolbar. - \return new separator action -*/ - -class TCreateSepEvent: public SALOME_Event -{ -public: - typedef QAction* TResult; - TResult myResult; - TCreateSepEvent() - : myResult( 0 ) {} - virtual void Execute() - { - SALOME_PYQT_Module* module = getActiveModule(); - if ( module ) - myResult = (QAction*)module->separator(); - } -}; -QAction* SalomePyQt::createSeparator() -{ - return ProcessEvent( new TCreateSepEvent() ); -} - -/*! - \fn QAction* SalomePyQt::createAction( const int id, - const QString& menuText, - const QString& tipText, - const QString& statusText, - const QString& icon, - const int key, - const bool toggle ) - \brief Create an action which can be then used in the menu or toolbar. - \param id the unique id action to be registered to - \param menuText action text which should appear in menu - \param tipText text which should appear in the tooltip - \param statusText text which should appear in the status bar when action is activated - \param icon the name of the icon file (the actual icon file name can be coded in the translation files) - \param key the key accelrator for the action - \param toggle if \c true the action is checkable -*/ - -class TCreateActionEvent: public SALOME_Event -{ -public: - typedef QAction* TResult; - TResult myResult; - int myId; - QString myMenuText; - QString myTipText; - QString myStatusText; - QString myIcon; - int myKey; - bool myToggle; - TCreateActionEvent( const int id, const QString& menuText, const QString& tipText, - const QString& statusText, const QString& icon, const int key, const bool toggle ) - : myResult( 0 ), myId( id ), myMenuText( menuText ), myTipText( tipText ), - myStatusText( statusText ), myIcon( icon ), myKey( key ), myToggle( toggle ) {} - virtual void Execute() - { - SALOME_PYQT_Module* module = getActiveModule(); - if ( module ) - myResult = (QAction*)module->createAction( myId, myTipText, myIcon, myMenuText, myStatusText, myKey, myToggle ); - } -}; -QAction* SalomePyQt::createAction( const int id, const QString& menuText, - const QString& tipText, const QString& statusText, - const QString& icon, const int key, const bool toggle ) -{ - return ProcessEvent( new TCreateActionEvent( id, menuText, tipText, statusText, icon, key, toggle ) ); -} - -/*! - \fn QActionGroup* SalomePyQt::createActionGroup( const int id, const bool exclusive ) - \brief Create an action group which can be then used in the menu or toolbar - \param id : the unique id action group to be registered to - \param exclusive : if \c true the action group does exclusive toggling -*/ -/* -struct TcreateActionGroupEvent: public SALOME_Event { - typedef QActionGroup* TResult; - TResult myResult; - int myId; - bool myExclusive; - TcreateActionGroupEvent( const int id, const bool exclusive ) - : myId( id ), myExclusive( exclusive ) {} - virtual void Execute() - { - SALOME_PYQT_Module* module = getActiveModule(); - if ( module ) - myResult = (QAction*)module->createActionGroup( myId, myExclusive ); - } -}; -QActionGroup* SalomePyQt::createActionGroup(const int id, const bool exclusive) -{ - return ProcessEvent( new TcreateActionGroupEvent( id, exclusive ) ); -} -*/ -/*! - \fn QAction* SalomePyQt::action( const int id ) - \brief Get action by specified identifier. - \return action or 0 if action is not registered -*/ - -class TActionEvent: public SALOME_Event -{ -public: - typedef QAction* TResult; - TResult myResult; - int myId; - TActionEvent( const int id ) - : myResult( 0 ), myId( id ) {} - virtual void Execute() - { - SALOME_PYQT_Module* module = getActiveModule(); - if ( module ) - myResult = (QAction*)module->action( myId ); - } -}; -QAction* SalomePyQt::action( const int id ) -{ - return ProcessEvent( new TActionEvent( id ) ); -} - -/*! - \fn int SalomePyQt::actionId( const QAction* a ); - \brief Get an action identifier. - \return action ID or -1 if action is not registered -*/ - -class TActionIdEvent: public SALOME_Event -{ -public: - typedef int TResult; - TResult myResult; - const QAction* myAction; - TActionIdEvent( const QAction* action ) - : myResult( -1 ), myAction( action ) {} - virtual void Execute() - { - SALOME_PYQT_Module* module = getActiveModule(); - if ( module ) - myResult = module->actionId( myAction ); - } -}; -int SalomePyQt::actionId( const QAction* a ) -{ - return ProcessEvent( new TActionIdEvent( a ) ); -} - -/*! - \fn int SalomePyQt::addGlobalPreference( const QString& label ); - \brief Add global (not module-related) preferences group. - \param label global preferences group name - \return preferences group identifier -*/ - -class TAddGlobalPrefEvent: public SALOME_Event -{ -public: - typedef int TResult; - TResult myResult; - QString myLabel; - TAddGlobalPrefEvent( const QString& label ) - : myResult( -1 ), myLabel( label ) {} - virtual void Execute() - { - SALOME_PYQT_Module* module = getActiveModule(); - if ( module ) - myResult = module->addGlobalPreference( myLabel ); - } -}; -int SalomePyQt::addGlobalPreference( const QString& label ) -{ - return ProcessEvent( new TAddGlobalPrefEvent( label ) ); -} - -/*! - \fn int SalomePyQt::addPreference( const QString& label ); - \brief Add module-related preferences group. - \param label preferences group name - \return preferences group identifier -*/ - -class TAddPrefEvent: public SALOME_Event -{ -public: - typedef int TResult; - TResult myResult; - QString myLabel; - TAddPrefEvent( const QString& label ) - : myResult( -1 ), myLabel( label ) {} - virtual void Execute() - { - SALOME_PYQT_Module* module = getActiveModule(); - if ( module ) - myResult = module->addPreference( myLabel ); - } -}; -int SalomePyQt::addPreference( const QString& label ) -{ - return ProcessEvent( new TAddPrefEvent( label ) ); -} - -/*! - \fn int SalomePyQt::addPreference( const QString& label, const int pId, const int type, - const QString& section, const QString& param ); - \brief Add module-related preferences. - \param label preferences group name - \param pId parent preferences group id - \param type preferences type - \param section resources file section name - \param param resources file setting name - \return preferences identifier -*/ - -class TAddPrefParamEvent: public SALOME_Event -{ -public: - typedef int TResult; - TResult myResult; - QString myLabel; - int myPId; - int myType; - QString mySection; - QString myParam; - TAddPrefParamEvent( const QString& label, - const int pId, const int type, - const QString& section, - const QString& param ) - : myResult( -1 ), - myLabel( label ), myPId( pId ), myType( type ), - mySection( section ), myParam ( param ) {} - virtual void Execute() - { - SALOME_PYQT_Module* module = getActiveModule(); - if ( module ) - myResult = module->addPreference( myLabel, myPId, myType, mySection, myParam ); - } -}; -int SalomePyQt::addPreference( const QString& label, const int pId, const int type, - const QString& section, const QString& param ) -{ - return ProcessEvent( new TAddPrefParamEvent( label, pId, type, section, param ) ); -} - -/*! - \fn QVariant SalomePyQt::preferenceProperty( const int id, const QString& prop ); - \brief Get the preferences property. - \param id preferences identifier - \param prop preferences property name - \return preferences property value or null QVariant if property is not set -*/ - -class TPrefPropEvent: public SALOME_Event -{ -public: - typedef QVariant TResult; - TResult myResult; - int myId; - QString myProp; - TPrefPropEvent( const int id, const QString& prop ) - : myId( id ), myProp( prop ) {} - virtual void Execute() - { - SALOME_PYQT_Module* module = getActiveModule(); - if ( module ) - myResult = module->preferenceProperty( myId, myProp ); - } -}; -QVariant SalomePyQt::preferenceProperty( const int id, const QString& prop ) -{ - return ProcessEvent( new TPrefPropEvent( id, prop ) ); -} - -/*! - \brief Set the preferences property. - \param id preferences identifier - \param prop preferences property name - \param var preferences property value -*/ -void SalomePyQt::setPreferenceProperty( const int id, - const QString& prop, - const QVariant& var ) -{ - class TEvent: public SALOME_Event - { - int myId; - QString myProp; - QVariant myVar; - public: - TEvent( const int id, const QString& prop, const QVariant& var ) - : myId( id ), myProp( prop ), myVar( var ) {} - virtual void Execute() - { - SALOME_PYQT_Module* module = getActiveModule(); - if ( module ) - module->setPreferenceProperty( myId, myProp, myVar ); - } - }; - ProcessVoidEvent( new TEvent( id, prop, var) ); -} - -/*! - \brief Add the property value to the list of values. - - This method allows creating properties which are QList - - there is no way to pass such values directly to QVariant parameter with PyQt. - - \param id preferences identifier - \param prop preferences property name - \param idx preferences property index - \param var preferences property value for the index \a idx -*/ -void SalomePyQt::addPreferenceProperty( const int id, - const QString& prop, - const int idx, - const QVariant& var ) -{ - class TEvent: public SALOME_Event - { - int myId; - QString myProp; - int myIdx; - QVariant myVar; - public: - TEvent( const int id, const QString& prop, const int idx, const QVariant& var ) - : myId( id ), myProp( prop ), myIdx( idx), myVar( var ) {} - virtual void Execute() - { - SALOME_PYQT_Module* module = getActiveModule(); - if ( module ) { - QVariant var = module->preferenceProperty( myId, myProp ); - if ( var.isValid() ) { - if ( var.type() == QVariant::StringList ) { - QStringList sl = var.toStringList(); - if ( myIdx >= 0 && myIdx < sl.count() ) - sl[myIdx] = myVar.toString(); - else - sl.append( myVar.toString() ); - module->setPreferenceProperty( myId, myProp, sl ); - } - else if ( var.type() == QVariant::List ) { - QList vl = var.toList(); - if ( myIdx >= 0 && myIdx < vl.count() ) - vl[myIdx] = myVar; - else - vl.append( myVar ); - module->setPreferenceProperty( myId, myProp, vl ); - } - } - else { - QList vl; - vl.append( myVar ); - module->setPreferenceProperty( myId, myProp, vl ); - } - } - } - }; - ProcessVoidEvent( new TEvent( id, prop, idx, var) ); -} - -/*! - \brief Put the message to the Log messages output window - \param msg message text (it can be of simple rich text format) - \param addSeparator boolean flag which specifies if it is necessary - to separate the message with predefined separator -*/ -void SalomePyQt::message( const QString& msg, bool addSeparator ) -{ - class TEvent: public SALOME_Event - { - QString myMsg; - bool myAddSep; - public: - TEvent( const QString& msg, bool addSeparator ) - : myMsg( msg ), myAddSep( addSeparator ) {} - virtual void Execute() - { - if ( SalomeApp_Application* anApp = getApplication() ) { - LogWindow* lw = anApp->logWindow(); - if ( lw ) - lw->putMessage( myMsg, myAddSep ); - } - } - }; - ProcessVoidEvent( new TEvent( msg, addSeparator ) ); -} - -/*! - \brief Remove all the messages from the Log messages output window. -*/ -void SalomePyQt::clearMessages() -{ - class TEvent: public SALOME_Event - { - public: - TEvent() {} - virtual void Execute() - { - if ( SalomeApp_Application* anApp = getApplication() ) { - LogWindow* lw = anApp->logWindow(); - if ( lw ) - lw->clear(); - } - } - }; - ProcessVoidEvent( new TEvent() ); -} - -/*! - \brief Gets window with specified identifier - \internal - \param id window identifier - \return pointer on the window -*/ -static SUIT_ViewWindow* getWnd( const int id ) -{ - SUIT_ViewWindow* resWnd = 0; - - SalomeApp_Application* app = getApplication(); - if ( app ) - { - STD_TabDesktop* tabDesk = dynamic_cast( app->desktop() ); - if ( tabDesk ) - { - QList wndlist = tabDesk->windows(); - SUIT_ViewWindow* wnd; - foreach ( wnd, wndlist ) - { - if ( id == wnd->getId() ) - { - resWnd = wnd; - break; - } - } - } - } - - return resWnd; -} - -/*! - \fn QList SalomePyQt::getViews() - \brief Get list of integer identifiers of all the currently opened views - \return list of integer identifiers of all the currently opened views -*/ - -class TGetViews: public SALOME_Event -{ -public: - typedef QList TResult; - TResult myResult; - TGetViews() {} - virtual void Execute() - { - myResult.clear(); - SalomeApp_Application* app = getApplication(); - if ( app ) - { - STD_TabDesktop* tabDesk = dynamic_cast( app->desktop() ); - if ( tabDesk ) - { - QList wndlist = tabDesk->windows(); - SUIT_ViewWindow* wnd; - foreach ( wnd, wndlist ) - myResult.append( wnd->getId() ); - } - } - } -}; -QList SalomePyQt::getViews() -{ - return ProcessEvent( new TGetViews() ); -} - -/*! - \fn int SalomePyQt::getActiveView() - \brief Get integer identifier of the currently active view - \return integer identifier of the currently active view -*/ - -class TGetActiveView: public SALOME_Event -{ -public: - typedef int TResult; - TResult myResult; - TGetActiveView() - : myResult( -1 ) {} - virtual void Execute() - { - SalomeApp_Application* app = getApplication(); - if ( app ) - { - SUIT_ViewManager* viewMgr = app->activeViewManager(); - if ( viewMgr ) - { - SUIT_ViewWindow* wnd = viewMgr->getActiveView(); - if ( wnd ) - myResult = wnd->getId(); - } - } - } -}; -int SalomePyQt::getActiveView() -{ - return ProcessEvent( new TGetActiveView() ); -} - -/*! - \fn QString SalomePyQt::getViewType( const int id ) - \brief Get type of the specified view, e.g. "OCCViewer" - \param id window identifier - \return view type -*/ - -class TGetViewType: public SALOME_Event -{ -public: - typedef QString TResult; - TResult myResult; - int myWndId; - TGetViewType( const int id ) - : myWndId( id ) {} - virtual void Execute() - { - SUIT_ViewWindow* wnd = getWnd( myWndId ); - if ( wnd ) - { - SUIT_ViewManager* viewMgr = wnd->getViewManager(); - if ( viewMgr ) - myResult = viewMgr->getType(); - } - } -}; -QString SalomePyQt::getViewType( const int id ) -{ - return ProcessEvent( new TGetViewType( id ) ); -} - -/*! - \fn bool SalomePyQt::setViewTitle( const int id, const QString& title ) - \brief Change view caption - \param id window identifier - \param title new window title - \return \c true if operation is completed successfully and \c false otherwise -*/ - -class TSetViewTitle: public SALOME_Event -{ -public: - typedef bool TResult; - TResult myResult; - int myWndId; - QString myTitle; - TSetViewTitle( const int id, const QString& title ) - : myResult( false ), - myWndId( id ), - myTitle( title ) {} - virtual void Execute() - { - SUIT_ViewWindow* wnd = getWnd( myWndId ); - if ( wnd ) - { - wnd->setWindowTitle( myTitle ); - myResult = true; - } - } -}; -bool SalomePyQt::setViewTitle( const int id, const QString& title ) -{ - return ProcessEvent( new TSetViewTitle( id, title ) ); -} - - -/*! - \fn QString SalomePyQt::getViewTitle( const int id ) - \brief Get view caption - \param id window identifier - \return view caption -*/ - -class TGetViewTitle: public SALOME_Event -{ -public: - typedef QString TResult; - TResult myResult; - int myWndId; - TGetViewTitle( const int id ) - : myWndId( id ) {} - virtual void Execute() - { - SUIT_ViewWindow* wnd = getWnd( myWndId ); - if ( wnd ) - myResult = wnd->windowTitle(); - } -}; -QString SalomePyQt::getViewTitle( const int id ) -{ - return ProcessEvent( new TGetViewTitle( id ) ); -} - -/*! - \fn QList SalomePyQt::findViews( const QString& type ) - \brief Get list of integer identifiers of all the - currently opened views of the specified type - \param type viewer type - \return list of integer identifiers -*/ - -class TFindViews: public SALOME_Event -{ -public: - typedef QList TResult; - TResult myResult; - QString myType; - TFindViews( const QString& type ) - : myType( type ) {} - virtual void Execute() - { - myResult.clear(); - SalomeApp_Application* app = getApplication(); - if ( app ) - { - ViewManagerList vmList; - app->viewManagers( myType, vmList ); - SUIT_ViewManager* viewMgr; - foreach ( viewMgr, vmList ) - { - QVector vec = viewMgr->getViews(); - for ( int i = 0, n = vec.size(); i < n; i++ ) - { - SUIT_ViewWindow* wnd = vec[ i ]; - if ( wnd ) - myResult.append( wnd->getId() ); - } - } - } - } -}; -QList SalomePyQt::findViews( const QString& type ) -{ - return ProcessEvent( new TFindViews( type ) ); -} - -/*! - \fn bool SalomePyQt::activateView( const int id ) - \brief Activate view - \param id window identifier - \return \c true if operation is completed successfully and \c false otherwise -*/ - -class TActivateView: public SALOME_Event -{ -public: - typedef bool TResult; - TResult myResult; - int myWndId; - TActivateView( const int id ) - : myResult( false ), - myWndId( id ) {} - virtual void Execute() - { - SUIT_ViewWindow* wnd = getWnd( myWndId ); - if ( wnd ) - { - wnd->setFocus(); - myResult = true; - } - } -}; -bool SalomePyQt::activateView( const int id ) -{ - return ProcessEvent( new TActivateView( id ) ); -} - -/*! - \fn int SalomePyQt::createView( const QString& type ) - \brief Create new view and activate it - \param type viewer type - \return integer identifier of created view (or -1 if view could not be created) -*/ - -class TCreateView: public SALOME_Event -{ -public: - typedef int TResult; - TResult myResult; - QString myType; - TCreateView( const QString& theType ) - : myResult( -1 ), - myType( theType ) {} - virtual void Execute() - { - SalomeApp_Application* app = getApplication(); - if ( app ) - { - SUIT_ViewManager* viewMgr = app->createViewManager( myType ); - if ( viewMgr ) - { - SUIT_ViewWindow* wnd = viewMgr->getActiveView(); - if ( wnd ) - myResult = wnd->getId(); - } - } - } -}; -int SalomePyQt::createView( const QString& type ) -{ - return ProcessEvent( new TCreateView( type ) ); -} - -/*! - \fn bool SalomePyQt::closeView( const int id ) - \brief Close view - \param id window identifier - \return \c true if operation is completed successfully and \c false otherwise -*/ - -class TCloseView: public SALOME_Event -{ -public: - typedef bool TResult; - TResult myResult; - int myWndId; - TCloseView( const int id ) - : myResult( false ), - myWndId( id ) {} - virtual void Execute() - { - SUIT_ViewWindow* wnd = getWnd( myWndId ); - if ( wnd ) - { - SUIT_ViewManager* viewMgr = wnd->getViewManager(); - if ( viewMgr ) - { - wnd->close(); - myResult = true; - } - } - } -}; -bool SalomePyQt::closeView( const int id ) -{ - return ProcessEvent( new TCloseView( id ) ); -} - -/*! - \fn int SalomePyQt::cloneView( const int id ) - \brief Clone view (if this operation is supported for specified view type) - \param id window identifier - \return integer identifier of the cloned view or -1 or operation could not be performed -*/ - -class TCloneView: public SALOME_Event -{ -public: - typedef int TResult; - TResult myResult; - int myWndId; - TCloneView( const int id ) - : myResult( -1 ), - myWndId( id ) {} - virtual void Execute() - { - SUIT_ViewWindow* wnd = getWnd( myWndId ); - if ( wnd ) - { - SUIT_ViewManager* viewMgr = wnd->getViewManager(); - if ( viewMgr ) - { - if ( wnd->inherits( "OCCViewer_ViewWindow" ) ) - { - OCCViewer_ViewWindow* occView = (OCCViewer_ViewWindow*)( wnd ); - occView->onCloneView(); - - wnd = viewMgr->getActiveView(); - if ( wnd ) - myResult = wnd->getId(); - } - else if ( wnd->inherits( "Plot2d_ViewWindow" ) ) - { - Plot2d_ViewManager* viewMgr2d = dynamic_cast( viewMgr ); - Plot2d_ViewWindow* srcWnd2d = dynamic_cast( wnd ); - if ( viewMgr2d && srcWnd2d ) - { - Plot2d_ViewWindow* resWnd = viewMgr2d->cloneView( srcWnd2d ); - myResult = resWnd->getId(); - } - } - } - } - } -}; -int SalomePyQt::cloneView( const int id ) -{ - return ProcessEvent( new TCloneView( id ) ); -} - -/*! - \fn bool SalomePyQt::isViewVisible( const int id ) - \brief Check whether view is visible ( i.e. it is on the top of the views stack) - \param id window identifier - \return \c true if view is visible and \c false otherwise -*/ - -class TIsViewVisible: public SALOME_Event -{ -public: - typedef bool TResult; - TResult myResult; - int myWndId; - TIsViewVisible( const int id ) - : myResult( false ), - myWndId( id ) {} - virtual void Execute() - { - SUIT_ViewWindow* wnd = getWnd( myWndId ); - if ( wnd ) - { - QWidget* p = wnd->parentWidget(); - myResult = ( p && p->isVisibleTo( p->parentWidget() ) ); - } - } -}; -bool SalomePyQt::isViewVisible( const int id ) -{ - return ProcessEvent( new TIsViewVisible( id ) ); -} - -/*! - \fn bool SalomePyQt::groupAllViews() - \brief Group all views to the single tab area - \return \c true if operation is completed successfully and \c false otherwise -*/ - -class TGroupAllViews: public SALOME_Event -{ -public: - typedef bool TResult; - TResult myResult; - TGroupAllViews() - : myResult( false ) {} - virtual void Execute() - { - SalomeApp_Application* app = getApplication(); - if ( app ) - { - STD_TabDesktop* tabDesk = dynamic_cast( app->desktop() ); - if ( tabDesk ) - { - QtxWorkstack* wStack = tabDesk->workstack(); - if ( wStack ) - { - wStack->stack(); - myResult = true; - } - } - } - } -}; -bool SalomePyQt::groupAllViews() -{ - return ProcessEvent( new TGroupAllViews() ); -} - -/*! - \fn bool SalomePyQt::splitView( const int id, const Orientation ori, const Action action ) - \brief Split tab area to which view with identifier belongs to - \param id window identifier - \param ori orientation of split operation - \param action action to be performed - \return \c true if operation is completed successfully \c false otherwise -*/ - -class TSplitView: public SALOME_Event -{ -public: - typedef bool TResult; - TResult myResult; - int myWndId; - Orientation myOri; - Action myAction; - TSplitView( const int id, - const Orientation ori, - const Action action ) - : myResult( false ), - myWndId( id ), - myOri( ori ), - myAction( action ) {} - virtual void Execute() - { - SUIT_ViewWindow* wnd = getWnd( myWndId ); - if ( wnd ) - { - // activate view - // wnd->setFocus(); ??? - - // split workstack - if ( getApplication() ) - { - STD_TabDesktop* desk = - dynamic_cast( getApplication()->desktop() ); - if ( desk ) - { - QtxWorkstack* wStack = desk->workstack(); - if ( wStack ) - { - Qt::Orientation qtOri = - ( myOri == Horizontal ) ? Qt::Horizontal : Qt::Vertical; - - QtxWorkstack::SplitType sType; - if ( myAction == MoveWidget ) - sType = QtxWorkstack::SplitMove; - else if ( myAction == LeaveWidget ) - sType = QtxWorkstack::SplitStay; - else - sType = QtxWorkstack::SplitAt; - - wStack->Split( wnd, qtOri, sType ); - myResult = true; - } - } - } - } - } -}; -bool SalomePyQt::splitView( const int id, const Orientation ori, const Action action ) -{ - return ProcessEvent( new TSplitView( id, ori, action ) ); -} - -/*! - \fn bool SalomePyQt::moveView( const int id, const int id_to, const bool before ) - \brief Move view with the first identifier to the same area which - another view with the second identifier belongs to - \param id source window identifier - \param id_to destination window identifier - param before specifies whether the first viewt has to be moved before or after - the second view - \return \c true if operation is completed successfully and \c false otherwise -*/ - -class TMoveView: public SALOME_Event -{ -public: - typedef bool TResult; - TResult myResult; - int myWndId; - int myWndToId; - bool myIsBefore; - TMoveView( const int id, const int id_to, const bool before ) - : myResult( false ), - myWndId( id ), - myWndToId( id_to ), - myIsBefore( before ) {} - virtual void Execute() - { - SUIT_ViewWindow* wnd = getWnd( myWndId ); - SUIT_ViewWindow* wnd_to = getWnd( myWndToId ); - if ( wnd && wnd_to ) - { - QtxWorkstack* wStack = dynamic_cast( - getApplication()->desktop() )->workstack(); - if ( wStack ) - myResult = wStack->move( wnd, wnd_to, myIsBefore ); - } - } -}; -bool SalomePyQt::moveView( const int id, const int id_to, const bool before ) -{ - return ProcessEvent( new TMoveView( id, id_to, before ) ); -} - -/*! - \fn QList SalomePyQt::neighbourViews( const int id ) - \brief Get list of views identifiers that belongs to the same area as - specified view (excluding it) - \param id window identifier - \return list of views identifiers -*/ - -class TNeighbourViews: public SALOME_Event -{ -public: - typedef QList TResult; - TResult myResult; - int myWndId; - TNeighbourViews( const int id ) - : myWndId( id ) {} - virtual void Execute() - { - myResult.clear(); - SUIT_ViewWindow* wnd = getWnd( myWndId ); - if ( wnd ) - { - QtxWorkstack* wStack = dynamic_cast( - getApplication()->desktop() )->workstack(); - if ( wStack ) - { - QWidgetList wgList = wStack->windowList( wnd ); - QWidget* wg; - foreach ( wg, wgList ) - { - SUIT_ViewWindow* tmpWnd = dynamic_cast( wg ); - if ( tmpWnd && tmpWnd != wnd ) - myResult.append( tmpWnd->getId() ); - } - } - } - } -}; -QList SalomePyQt::neighbourViews( const int id ) -{ - return ProcessEvent( new TNeighbourViews( id ) ); -} diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h deleted file mode 100644 index 829c20f17..000000000 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.h +++ /dev/null @@ -1,220 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 : SalomePyQt.h -// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// - -#ifndef SALOME_PYQT_H -#define SALOME_PYQT_H - -#include -#include -#include - -#include -#include - -class LightApp_SelectionMgr; -class SalomeApp_Application; -class QMenuBar; -class QMenu; -class QWidget; -class QAction; -class QActionGroup; - -class SALOME_Selection : public QObject -{ - Q_OBJECT - -public: - ~SALOME_Selection(); - static SALOME_Selection* GetSelection( SalomeApp_Application* ); - - void Clear(); - void ClearIObjects(); - void ClearFilters(); - -signals: - void currentSelectionChanged(); - -private slots: - void onSelMgrDestroyed(); - -private: - LightApp_SelectionMgr* mySelMgr; - SALOME_Selection( QObject* ); -}; - -enum MenuName { - File = 1, - View = 2, - Edit = 3, - Preferences = 4, - Tools = 5, - Window = 6, - Help = 7 -}; - -enum { - WT_ObjectBrowser = LightApp_Application::WT_ObjectBrowser, - WT_PyConsole = LightApp_Application::WT_PyConsole, - WT_LogWindow = LightApp_Application::WT_LogWindow, - WT_User = LightApp_Application::WT_User -}; - -enum { - PT_Space = LightApp_Preferences::Space, - PT_Bool = LightApp_Preferences::Bool, - PT_Color = LightApp_Preferences::Color, - PT_String = LightApp_Preferences::String, - PT_Selector = LightApp_Preferences::Selector, - PT_DblSpin = LightApp_Preferences::DblSpin, - PT_IntSpin = LightApp_Preferences::IntSpin, - PT_Double = LightApp_Preferences::Double, - PT_Integer = LightApp_Preferences::Integer, - PT_GroupBox = LightApp_Preferences::GroupBox, - PT_Font = LightApp_Preferences::Font, - PT_DirList = LightApp_Preferences::DirList, - PT_File = LightApp_Preferences::File, -}; - -//! Orientation -enum Orientation { - Horizontal = 0, //!< Horizontal orientation - Vertical = 1 //!< Vertical orientation -}; - -//! Action of splitting corresponding to QtxWorkstack::SplitType enumeration -enum Action { - MoveWidget = 0, //!< move specified widget to the new area, other views stay in the previous area - LeaveWidget = 1, //!< specified widget stays in the old area, all other views are moved to the new area - SplitAt = 2 //!< the view area is splitted in such a way, that specified view and all views which follow it, are moved to the new area -}; - -class SalomePyQt -{ -public: - static QWidget* getDesktop(); - static QWidget* getMainFrame(); - static QMenuBar* getMainMenuBar(); - static QMenu* getPopupMenu( const MenuName ); - static QMenu* getPopupMenu( const QString& ); - static SALOME_Selection* getSelection(); - static int getStudyId(); - static void putInfo( const QString&, const int = 0 ); - static const QString getActiveComponent(); - static void updateObjBrowser( const int = 0, bool = true ); - - static QString getFileName ( QWidget*, const QString&, const QStringList&, const QString&, bool ); - static QStringList getOpenFileNames ( QWidget*, const QString&, const QStringList&, const QString& ); - static QString getExistingDirectory( QWidget*, const QString&, const QString& ); - - static void helpContext( const QString&, const QString& ); - - static bool dumpView( const QString& ); - - static int defaultMenuGroup(); - - static int createTool( const QString& ); - static int createTool( const int, const int, const int = -1 ); - static int createTool( const int, const QString&, const int = -1 ); - static int createTool( QAction*, const int, const int = -1, const int = -1 ); - static int createTool( QAction*, const QString&, const int = -1, const int = -1 ); - - static int createMenu( const QString&, const int = -1, - const int = -1, const int = -1, const int = -1 ); - static int createMenu( const QString&, const QString& = QString(), - const int = -1, const int = -1, const int = -1 ); - static int createMenu( const int, const int = -1, - const int = -1, const int = -1 ); - static int createMenu( const int, const QString& = QString(), - const int = -1, const int = -1 ); - static int createMenu( QAction*, const int, const int = -1, - const int = -1, const int = -1 ); - static int createMenu( QAction*, const QString&, const int = -1, - const int = -1, const int = -1 ); - - static QAction* createSeparator(); - - static QAction* createAction( const int, const QString&, - const QString& = QString(), const QString& = QString(), - const QString& = QString(), const int = 0, const bool = false ); - - // static QActionGroup* createActionGroup( const int, const bool = true ); - - static QAction* action( const int ); - static int actionId( const QAction* ); - - static void addSetting ( const QString&, const QString&, const double ); - static void addSetting ( const QString&, const QString&, const int ); - static void addSetting ( const QString&, const QString&, const bool, const int ); - static void addSetting ( const QString&, const QString&, const QString& ); - static void addSetting ( const QString&, const QString&, const QColor& ); - static int integerSetting( const QString&, const QString&, const int = 0 ); - static double doubleSetting ( const QString&, const QString&, const double = 0 ); - static bool boolSetting ( const QString&, const QString&, const bool = 0 ); - static QString stringSetting ( const QString&, const QString&, const QString& = QString("") ); - static QColor colorSetting ( const QString&, const QString&, const QColor& = QColor() ); - static void removeSetting ( const QString&, const QString& ); - static bool hasSetting ( const QString&, const QString& ); - // obsolete - static void addStringSetting( const QString&, const QString&, bool = true ); - static void addIntSetting ( const QString&, const int, bool = true ); - static void addBoolSetting ( const QString&, const bool, bool = true ); - static void addDoubleSetting( const QString&, const double, bool = true ); - static void removeSettings ( const QString& ); - static QString getSetting ( const QString& ); - - static int addGlobalPreference( const QString& ); - static int addPreference( const QString& ); - static int addPreference( const QString&, - const int, const int = -1, - const QString& = QString(), - const QString& = QString() ); - static QVariant preferenceProperty( const int, const QString& ); - static void setPreferenceProperty( const int, - const QString&, - const QVariant& ); - static void addPreferenceProperty( const int, - const QString&, - const int, - const QVariant& ); - - static void message( const QString&, bool = true ); - static void clearMessages(); - - static QList getViews(); - static int getActiveView(); - static QString getViewType( const int ); - static bool setViewTitle( const int, const QString& ); - static QString getViewTitle( const int ); - static QList findViews( const QString& ); - static bool activateView( const int ); - static int createView( const QString& ); - static bool closeView( const int ); - static int cloneView( const int ); - static bool isViewVisible( const int id ); - - static bool groupAllViews(); - static bool splitView( const int, const Orientation, const Action ); - static bool moveView( const int, const int, const bool ); - static QList neighbourViews( const int ); -}; - -#endif // SALOME_PYQT_H diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip deleted file mode 100644 index 1a2a12a7f..000000000 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.sip +++ /dev/null @@ -1,216 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 : SalomePyQt.sip -// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// - -%Module SalomePyQt - -%Import QtGuimod.sip -%Import QtXmlmod.sip - -%ExportedHeaderCode -#include -%End - -class SALOME_Selection : QObject -{ -%TypeHeaderCode -#include -%End - -public: - void Clear() /ReleaseGIL/ ; - void ClearIObjects() /ReleaseGIL/ ; - void ClearFilters() /ReleaseGIL/ ; - -private: - SALOME_Selection( QObject* /TransferThis/ ); - -signals: - void currentSelectionChanged(); -}; - -enum MenuName { - File = 1, - View = 2, - Edit = 3, - Preferences = 4, - Tools = 5, - Window = 6, - Help = 7 -}; - -enum WindowType { - WT_ObjectBrowser, - WT_PyConsole, - WT_LogWindow, - WT_User -}; - -enum PrefType { - PT_Space, - PT_Bool, - PT_Color, - PT_String, - PT_Selector, - PT_DblSpin, - PT_IntSpin, - PT_Double, - PT_Integer, - PT_GroupBox, - PT_Font, - PT_DirList, - PT_File, -}; - -enum Orientation { - Horizontal = 0, - Vertical = 1 -}; - -enum Action { - MoveWidget = 0, - LeaveWidget = 1, - SplitAt = 2 -}; - -class QtxAction : QAction -{ -%TypeHeaderCode -#include -%End - -private: - QtxAction(const QtxAction &); -}; - -class SalomePyQt -{ -%TypeHeaderCode -#include -%End - -public: - static QWidget* getDesktop() /ReleaseGIL/ ; - static QWidget* getMainFrame() /ReleaseGIL/ ; - static QMenuBar* getMainMenuBar() /ReleaseGIL/ ; - static QMenu* getPopupMenu( const MenuName ) /ReleaseGIL/ ; - static QMenu* getPopupMenu( const QString& ) /ReleaseGIL/ ; - static SALOME_Selection* getSelection() /Factory,ReleaseGIL/ ; - static int getStudyId() /ReleaseGIL/ ; - static void putInfo( const QString&, const int = 0 ) /ReleaseGIL/ ; - static const QString getActiveComponent() /ReleaseGIL/ ; - static void updateObjBrowser( const int = 0, bool = true ) /ReleaseGIL/ ; - - static QString getFileName ( QWidget*, const QString&, const QStringList&, const QString&, bool ) /ReleaseGIL/ ; - static QStringList getOpenFileNames ( QWidget*, const QString&, const QStringList&, const QString& ) /ReleaseGIL/ ; - static QString getExistingDirectory( QWidget*, const QString&, const QString& ) /ReleaseGIL/ ; - - static void helpContext( const QString&, const QString& ) /ReleaseGIL/ ; - - static bool dumpView( const QString& ) /ReleaseGIL/ ; - - static int defaultMenuGroup() /ReleaseGIL/ ; - - static int createTool( const QString& ) /ReleaseGIL/ ; - static int createTool( const int, const int, const int = -1 ) /ReleaseGIL/ ; - static int createTool( const int, const QString&, const int = -1 ) /ReleaseGIL/ ; - static int createTool( QAction*, const int, const int = -1, const int = -1 ) /ReleaseGIL/ ; - static int createTool( QAction*, const QString&, const int = -1, const int = -1 ) /ReleaseGIL/ ; - - static int createMenu( const QString&, const int, - const int = -1, const int = -1, const int = -1 ) /ReleaseGIL/ ; - static int createMenu( const QString&, const QString&, - const int = -1, const int = -1, const int = -1 ) /ReleaseGIL/ ; - static int createMenu( const int, const int, - const int = -1, const int = -1 ) /ReleaseGIL/ ; - static int createMenu( const int, const QString&, - const int = -1, const int = -1 ) /ReleaseGIL/ ; - static int createMenu( QAction*, const int, const int = -1, - const int = -1, const int = -1 ) /ReleaseGIL/ ; - static int createMenu( QAction*, const QString&, const int = -1, - const int = -1, const int = -1 ) /ReleaseGIL/ ; - static QAction* createSeparator() /ReleaseGIL/ ; - - static QAction* createAction( const int, const QString&, - const QString& = QString(), const QString& = QString(), - const QString& = QString(), const int = 0, const bool = false ) /ReleaseGIL/ ; - - //static QActionGroup* createActionGroup( const int, const bool = true ) /ReleaseGIL/ ; - - static QAction* action( const int ) /ReleaseGIL/ ; - static int actionId( const QAction* ) /ReleaseGIL/ ; - - static void addSetting ( const QString&, const QString&, const double ) /ReleaseGIL/ ; - static void addSetting ( const QString&, const QString&, const int /Constrained/ ) /ReleaseGIL/ ; - static void addSetting ( const QString&, const QString&, const bool, const int ) /ReleaseGIL/ ; - static void addSetting ( const QString&, const QString&, const QString& ) /ReleaseGIL/ ; - static void addSetting ( const QString&, const QString&, const QColor& ) /ReleaseGIL/ ; - static int integerSetting( const QString&, const QString&, const int = 0 ) /ReleaseGIL/ ; - static double doubleSetting ( const QString&, const QString&, const double = 0 ) /ReleaseGIL/ ; - static bool boolSetting ( const QString&, const QString&, const bool = false ) /ReleaseGIL/ ; - static QString stringSetting ( const QString&, const QString&, const QString& = QString("") ) /ReleaseGIL/ ; - static QColor colorSetting ( const QString&, const QString&, const QColor& = QColor() ) /ReleaseGIL/ ; - static void removeSetting ( const QString&, const QString& ) /ReleaseGIL/ ; - static bool hasSetting ( const QString&, const QString& ) /ReleaseGIL/ ; - -// obsolete - static void addStringSetting( const QString&, const QString&, bool = true ) /ReleaseGIL/ ; - static void addIntSetting ( const QString&, const int, bool = true ) /ReleaseGIL/ ; - static void addDoubleSetting( const QString&, const double, bool = true ) /ReleaseGIL/ ; - static void addBoolSetting ( const QString&, const bool, bool = true ) /ReleaseGIL/ ; - static void removeSettings ( const QString& ) /ReleaseGIL/ ; - static QString getSetting ( const QString& ) /ReleaseGIL/ ; - - static int addGlobalPreference( const QString& ) /ReleaseGIL/ ; - static int addPreference( const QString& ) /ReleaseGIL/ ; - static int addPreference( const QString&, - const int, const int = -1, - const QString& = QString(), - const QString& = QString() ) /ReleaseGIL/ ; - static QVariant preferenceProperty( const int, const QString& ) /ReleaseGIL/ ; - static void setPreferenceProperty( const int, - const QString&, - const QVariant& ) /ReleaseGIL/ ; - static void addPreferenceProperty( const int, - const QString&, - const int, - const QVariant& ) /ReleaseGIL/ ; - - static void message( const QString&, bool = true ) /ReleaseGIL/ ; - static void clearMessages() /ReleaseGIL/ ; - - static QList getViews() /ReleaseGIL/ ; - static int getActiveView() /ReleaseGIL/ ; - static QString getViewType( const int ) /ReleaseGIL/ ; - static bool setViewTitle( const int, const QString& ) /ReleaseGIL/ ; - static QString getViewTitle( const int ) /ReleaseGIL/ ; - static QList findViews( const QString& ) /ReleaseGIL/ ; - static bool activateView( const int ) /ReleaseGIL/ ; - static int createView( const QString& ) /ReleaseGIL/ ; - static bool closeView( const int ) /ReleaseGIL/ ; - static int cloneView( const int ) /ReleaseGIL/ ; - static bool isViewVisible( const int id ) /ReleaseGIL/ ; - - static bool groupAllViews() /ReleaseGIL/ ; - static bool splitView( const int, Orientation, Action ) /ReleaseGIL/ ; - static bool moveView( const int, const int, const bool ) /ReleaseGIL/ ; - static QList neighbourViews( const int ) /ReleaseGIL/ ; -}; diff --git a/src/SALOME_SWIG/Help.py b/src/SALOME_SWIG/Help.py deleted file mode 100755 index 404ee4dfc..000000000 --- a/src/SALOME_SWIG/Help.py +++ /dev/null @@ -1,141 +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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -# -# -# -# File : Help.py -# Author : Paul RASCLE, EDF -# Module : SALOME -# $Header$ - -class SalomeDoc: - def __init__(self, aDoc): - self.doc = aDoc - def __repr__(self): - print self.doc - return "---" - def salome(self): - doc_salome = ''' -MODULE : salome ---------------- -module salome gives access to Salome ressources: -variables: - - salome:orb : CORBA - salome.naming_service : instance of naming Service class - methods: - Resolve(name) : find a CORBA object (ior) by its pathname - Register(name) : register a CORBA object under a pathname - salome.lcc : instance of lifeCycleCORBA class - methods: - FindOrLoadComponent(server,name) : - obtain an Engine (CORBA object) - or launch the Engine if not found, - with a Server name and an Engine name - salome.sg - methods: - updateObjBrowser(bool): - getActiveStudyId(): - getActiveStudyName(): - - SelectedCount(): returns number of selected objects - getSelected(i): returns entry of selected object number i - getAllSelected(): returns list of entry of selected objects - AddIObject(Entry): select an existing Interactive object - RemoveIObject(Entry): remove object from selection - ClearIObjects(): clear selection - - Display(*Entry): - DisplayOnly(Entry): - Erase(Entry): - DisplayAll(): - EraseAll(): - - IDToObject(Entry): returns CORBA reference from entry - - salome.myStudyName : active Study Name - salome.myStudyId : active Study Id - salome.myStudy : the active Study itself (CORBA ior) - methods : defined in SALOMEDS.idl - -methods: - salome.DumpStudy(study) : Dump a study, given the ior ---- -''' - print doc_salome - - def geompy(self): - doc_geompy = ''' -MODULE : geompy ---------------- -module geompy provides an encapsulation of GEOM Engine methods -variables: - geompy.geom : a Geometry Engine, found or loaded - at first import of module geompy. - methods : defined in GEOM_Gen.idl - geompy.myBuilder : a study builder - geompy.father : GEOM root in current study (salome.myStudy) - -methods: - addToStudy(aShape, aName) : add the shape into the current study - --- all methods of GEOM_Gen.idl that returns a shape are encapsulated, - with the same interface : shapes are named with their ior -''' - print doc_geompy - - def supervision(self): - doc_supervision = ''' -MODULES : SALOME_SuperVisionEditor and SALOME_SuperVisionExecutor ------------------------------------------------------------------ -this modules provide access to Editor and Executor Engine methods - -See SUPERV.idl - -In order to run the example (supervisionexample.py) - - Type : from supervisionexample import * - supervisionexample.py contains comments - -A new python example avoids references to LifeCycleCORBA - avoids references to NamingService - avoids references to ModuleCatalog - avoids SuperVisionComponent creation - allows G.Input(...) instead of AddInput(G,...) - replaces Editor/Executor with Graph - allows Nodes, Ports and Links CORBA objects - shortens methods names - ... - - See /SuperVisionTest/resources/GraphExample.py - and GraphExample.xml ---- -''' - print doc_supervision - - - -help = SalomeDoc(''' -Availables modules: - salome : gives access to Salome ressources - geompy : encapsulation of GEOM Engine methods - supervision : gives access to SuperVision Engine -To obtain specific help on a module "truc", type: help.truc() -To run an example, type: import example3 -''') - diff --git a/src/SALOME_SWIG/Makefile.am b/src/SALOME_SWIG/Makefile.am deleted file mode 100755 index 54436da3f..000000000 --- a/src/SALOME_SWIG/Makefile.am +++ /dev/null @@ -1,116 +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 -# -# -# -# File : Makefile.in -# Author : Paul RASCLE, EDF -# Module : SALOME -# $Header$ - -include $(top_srcdir)/adm_local/unix/make_common_starter.am - -# =============================================================== -# Swig targets -# =============================================================== -# (cf. http://www.geocities.com/foetsch/python/swig_linux.htm) -# -# Step 1: build the wrapping source files with swig -# -# libSALOME_Swig.i -- swig --> swig_wrap.cpp libSALOME_Swig.py -# -# Step 2: build the dynamic library from cpp built source files and -# dependant libraries. -# -# swig_wrap.cpp -- gcc --> swig_wrap.o |-- link --> _libSALOME_Swig.la -# + | -# dependant libs | -# -# The file libSALOME_Swig.py will be installed in the -# /lib/python/site-package/salome folder. -# The library libSALOME_Swigcmodule.so will be installed in -# the /lib/salome folder. -# - -# this option puts it to dist -#BUILT_SOURCES = swig_wrap.cpp - -SWIG_FLAGS = @SWIG_FLAGS@ -I$(srcdir) -SWIG_SOURCES = libSALOME_Swig.i - -nodist_pkgpython_DATA = libSALOME_Swig.py -libSALOME_Swig.py: swig_wrap.cpp - -# library -lib_LTLIBRARIES = libSALOME_Swigcmodule.la -libSALOME_Swigcmodule_la_SOURCES = $(BUILT_SOURCES) $(SWIG_SOURCES) SALOMEGUI_Swig.cxx -nodist_libSALOME_Swigcmodule_la_SOURCES = swig_wrap.cpp -salomeinclude_HEADERS= SALOMEGUI_Swig.hxx SALOMEGUI_Swig.i - -libSALOME_Swigcmodule_la_CPPFLAGS =\ - $(QT_INCLUDES) $(QWT_INCLUDES) $(PYTHON_INCLUDES) $(CAS_CPPFLAGS) $(VTK_INCLUDES) \ - $(OGL_INCLUDES) $(BOOST_CPPFLAGS) -DHAVE_CONFIG_H @KERNEL_CXXFLAGS@ \ - -I$(top_builddir)/salome_adm/unix -I$(top_builddir)/idl \ - -I$(srcdir)/../SalomeApp -I$(srcdir)/../Qtx -I$(srcdir)/../SUIT \ - -I$(srcdir)/../ObjBrowser -I$(srcdir)/../LightApp -I$(srcdir)/../SOCC \ - -I$(srcdir)/../SVTK -I$(srcdir)/../Event -I$(srcdir)/../OBJECT \ - -I$(srcdir)/../CAM -I$(srcdir)/../STD -I$(srcdir)/../OCCViewer \ - -I$(srcdir)/../Prs -I$(srcdir)/../VTKViewer -I$(srcdir)/../SPlot2d \ - -I$(srcdir)/../Plot2d \ - @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ - -libSALOME_Swigcmodule_la_LDFLAGS = -module -libSALOME_Swigcmodule_la_LIBADD = \ - ../SalomeApp/libSalomeApp.la \ - @PYTHON_LIBS@ - -swig_wrap.cpp : $(SWIG_SOURCES) - $(SWIG) $(SWIG_FLAGS) -o $@ $< - -CLEANFILES = swig_wrap.cpp - -# -# =============================================================== -# Files to be installed -# =============================================================== -# - -# Scripts to be installed. -dist_salomescript_DATA= \ - examplevtk1.py \ - test_table.py \ - test_big_table.py \ - test_many_objects.py \ - test_remove_ref.py \ - libSALOME_Swig.py - -nodist_salomescript_DATA= \ - supervisionexample.py \ - supervisiongeomexample.py - -EXTRA_DIST+= \ - supervisionexample.py.in \ - supervisiongeomexample.py.in - -sharedpkgpython_PYTHON= SALOMEGUI_shared_modules.py - -install-exec-hook: $(libdir)/_libSALOME_Swig.so - -$(libdir)/_libSALOME_Swig.so: - (cd $(libdir); ln -sf libSALOME_Swigcmodule.so _libSALOME_Swig.so;) diff --git a/src/SALOME_SWIG/PyInterp.py b/src/SALOME_SWIG/PyInterp.py deleted file mode 100755 index 3e0133d89..000000000 --- a/src/SALOME_SWIG/PyInterp.py +++ /dev/null @@ -1,102 +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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -# -# -# -# File : PyInterp.py -# Author : Paul RASCLE, EDF -# Module : SALOME -# $Header$ - -import sys -from omniORB import CORBA -from LifeCycleCORBA import * -from libSALOME_Swig import * -import SALOMEDS -from SALOME_NamingServicePy import * - - #-------------------------------------------------------------------------- - -def DumpComponent(Study, SO, offset): - it = Study.NewChildIterator(SO) - Builder = Study.NewBuilder() - while it.More(): - CSO = it.Value() - it.Next() - anAttr = Builder.FindOrCreateAttribute(CSO, "AttributeName") - AtName = anAttr._narrow(SALOMEDS.AttributeName) - t_name = AtName.Value() - if t_name[0] == 1: - ofs = 1 - a = "" - while ofs <= offset: - a = a + "--" - ofs = ofs +1 - print a + ">" + CSO.GetID() + " " + t_name[1] - t_RefSO = CSO.ReferencedObject() - if t_RefSO[0] == 1: - RefSO = t_RefSO[1] - ofs = 1 - a = "" - while ofs <= offset: - a = a + " " - ofs = ofs +1 - print a + ">" + RefSO.GetID() - DumpComponent(Study, CSO, offset+2) - - #-------------------------------------------------------------------------- - -def DumpStudy(Study): - itcomp = Study.NewComponentIterator() - while itcomp.More(): - SC = itcomp.Value() - itcomp.Next() - name = SC.ComponentDataType() - print "-> ComponentDataType is " + name - DumpComponent(Study, SC, 1) - - - #-------------------------------------------------------------------------- - -# initialise the ORB -orb = CORBA.ORB_init([''], CORBA.ORB_ID) - -# create an LifeCycleCORBA instance -lcc = LifeCycleCORBA(orb) - -# create an SALOMEGUI_Swig instance -sg = SALOMEGUI_Swig() - -#create an naming service instance -naming_service = SALOME_NamingServicePy_i(orb) - -# get active study name and id -myStudyName = sg.getActiveStudyName() -print myStudyName - -myStudyId = sg.getActiveStudyId() -print myStudyId - -# get Study Manager reference -obj = naming_service.Resolve('myStudyManager') -myStudyManager = obj._narrow(SALOMEDS.StudyManager) - -# get active study -myStudy = myStudyManager.GetStudyByName(myStudyName) - diff --git a/src/SALOME_SWIG/SALOMEGUI_Swig.cxx b/src/SALOME_SWIG/SALOMEGUI_Swig.cxx deleted file mode 100644 index 3c533fee2..000000000 --- a/src/SALOME_SWIG/SALOMEGUI_Swig.cxx +++ /dev/null @@ -1,810 +0,0 @@ -// SALOME SALOMEGUI : implementation of desktop and GUI kernel -// -// 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 : SALOMEGUI_Swig.cxx -// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// - -#include "SALOMEGUI_Swig.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -/*! - \class SALOMEGUI_Swig - \brief Python interface module for SALOME GUI. - - This module provides an access to the SALOME GUI implementing set of functions - which can be used from Python. This module is implemented using SWIG wrappings - for some GUI functionality: - - getActiveStudyId(), getActiveStudyName() : get active study identifier and name - - updateObjBrowser() : update contents of the Object Browser - - SelectedCount() : get number of currently selected items - - getSelected() : get entry of the speicified selected item - - ClearIObjects() : clear selection - - Display(), DisplayOnly(), Erase() : display/erase objects - - etc. - - Instance of this class is created every time "import salome" line is typed - - in IAPP embedded Python interpretor (SALOME_Session_Server executable) - - in inline Python nodes in Supervisor (in SALOME_Container executable) - - in stand-alone Python console outside any executable - - SALOME GUI (desktop and other objects) is only available in SALOME_Session_Server. - It means that it can not be accessed from the external Python console. - - The usage in Python: - \code - import libSALOME_Swig - sg = libSALOME_Swig.SALOMEGUI_Swig() - if sg.hasDesktop(): - selcount = sg.SelectedCount() - if selcount > 0: - sg.Erase( sg.getSelected( 0 ) ) - pass - \endcode -*/ - -/* - --- INTERNAL COMMENTS SECTION --- - - ASV : 03.12.04 : added checking for NULL GUI objects in almost all methods. - In the scope of fixing bug PAL6869. - - VSR : 19.04.05 : Reimplemented for new SALOME GUI (SUIT-based) - All methods are implemeted using Event mechanism. - Display/Erase methods use SALOME_Prs/SALOME_View mechanism. It is currently - implemented only for OCC and VTK viewers. -*/ - -/*! - \brief Get active application object - \internal - \return active application or 0 if there is no any -*/ -static SalomeApp_Application* getApplication() -{ - if ( SUIT_Session::session() ) - return dynamic_cast( SUIT_Session::session()->activeApplication() ); - return 0; -} - -/*! - \brief Get active study object - \internal - \return active study or 0 if there is no study opened -*/ -static SalomeApp_Study* getActiveStudy() -{ - if ( getApplication() ) - return dynamic_cast( getApplication()->activeStudy() ); - return 0; -} - -/*! - \brief Constructor. -*/ -SALOMEGUI_Swig::SALOMEGUI_Swig() -{ -} - -/*! - \brief Destructor -*/ -SALOMEGUI_Swig::~SALOMEGUI_Swig() -{ -} - -/*! - \fn bool SALOMEGUI_Swig::hasDesktop() - \brief Check GUI availability. - \return \c true if GUI is available -*/ - -class THasDesktopEvent: public SALOME_Event -{ -public: - typedef bool TResult; - TResult myResult; - THasDesktopEvent() : myResult( false ) {} - virtual void Execute() - { - myResult = (bool)( getApplication() && getApplication()->desktop() ); - } -}; -bool SALOMEGUI_Swig::hasDesktop() -{ - return ProcessEvent( new THasDesktopEvent() ); -} - -/*! - \brief Update active study's Object Browser. - \param updateSelection this parameter is obsolete -*/ -void SALOMEGUI_Swig::updateObjBrowser( bool /*updateSelection*/ ) -{ - class TEvent: public SALOME_Event - { - public: - TEvent() {} - virtual void Execute() - { - if ( SalomeApp_Application* anApp = getApplication() ) { - anApp->updateObjectBrowser(); - anApp->updateActions(); //SRN: added in order to update the toolbar - } - } - }; - ProcessVoidEvent( new TEvent() ); -} - -/*! - \fn int SALOMEGUI_Swig::getActiveStudyId() - \brief Get active study identifier - \return active study's ID or 0 if there is no active study -*/ - -class TGetActiveStudyIdEvent: public SALOME_Event -{ -public: - typedef int TResult; - TResult myResult; - TGetActiveStudyIdEvent() : myResult( 0 ) {} - virtual void Execute() - { - if ( SalomeApp_Study* aStudy = getActiveStudy() ) { - myResult = aStudy->studyDS()->StudyId(); - } - } -}; -int SALOMEGUI_Swig::getActiveStudyId() -{ - return ProcessEvent( new TGetActiveStudyIdEvent() ); -} - -/*! - \fn const char* SALOMEGUI_Swig::getActiveStudyName() - \brief Get active study name - \return active study's name or null string if there is no active study -*/ - -class TGetActiveStudyNameEvent: public SALOME_Event -{ -public: - typedef std::string TResult; - TResult myResult; - TGetActiveStudyNameEvent() {} - virtual void Execute() - { - if ( SalomeApp_Study* aStudy = getActiveStudy() ) { - myResult = aStudy->studyDS()->Name(); - } - } -}; -const char* SALOMEGUI_Swig::getActiveStudyName() -{ - std::string result = ProcessEvent( new TGetActiveStudyNameEvent() ); - return result.empty() ? 0 : result.c_str(); -} - -/*! - \fn const char* SALOMEGUI_Swig::getComponentName( const char* componentUserName ) - \brief Get name of the component by its title (user name) - \param componentUserName component title (user name) - \return component name or null string if component title is invalid -*/ - -/*! - \fn const char* SALOMEGUI_Swig::getComponentUserName( const char* componentName ) - \brief Get title (user name) of the component by its name - \param componentName component name - \return component title or null string if component name is invalid -*/ - -class TGetComponentNameEvent: public SALOME_Event -{ -public: - typedef QString TResult; - TResult myResult; - QString myName; - bool myIsUserName; - TGetComponentNameEvent( const QString& name, bool isUserName ) - : myName( name ), myIsUserName( isUserName ) {} - virtual void Execute() - { - if ( SalomeApp_Application* app = getApplication() ) { - myResult = myIsUserName ? app->moduleTitle( myName ) : app->moduleName( myName ); - } - } -}; -const char* SALOMEGUI_Swig::getComponentName( const char* componentUserName ) -{ - QString result = ProcessEvent( new TGetComponentNameEvent( componentUserName, false ) ); - return result.isEmpty() ? 0 : strdup( result.toLatin1().constData() ); -} -const char* SALOMEGUI_Swig::getComponentUserName( const char* componentName ) -{ - QString result = ProcessEvent( new TGetComponentNameEvent( componentName, true ) ); - return result.isEmpty() ? 0 : strdup( result.toLatin1().constData() ); -} - -/*! - \fn int SALOMEGUI_Swig::SelectedCount() - \brief Get number of selected items - \return number of selected items in the active study -*/ - -/*! - \fn const char* SALOMEGUI_Swig::getSelected( int index ) - \brief Get entry of the specified selected item - \param index selected object index - \return selected object entry (null string if index is invalid) -*/ - -class TGetSelectedEvent: public SALOME_Event -{ -public: - typedef QStringList TResult; - TResult myResult; - TGetSelectedEvent() {} - virtual void Execute() - { - if ( SalomeApp_Application* anApp = getApplication() ) { - SalomeApp_Study* aStudy = dynamic_cast( anApp->activeStudy() ); // for sure! - LightApp_SelectionMgr* aSelMgr = anApp->selectionMgr(); - if ( aStudy && aSelMgr ) { - SUIT_DataOwnerPtrList aList; - aSelMgr->selected( aList ); - - for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); - itr != aList.end(); ++itr ) { - const LightApp_DataOwner* owner = - dynamic_cast( (*itr).operator->() ); - if( !owner ) - continue; - QString entry = owner->entry(); - if( !myResult.contains( entry ) ) - myResult.append( entry ); - } - } - } - } -}; -int SALOMEGUI_Swig::SelectedCount() -{ - QStringList selected = ProcessEvent( new TGetSelectedEvent() ); - return selected.count(); -} -const char* SALOMEGUI_Swig::getSelected( int index ) -{ - QStringList selected = ProcessEvent( new TGetSelectedEvent() ); - return index >= 0 && index < selected.count() ? - strdup( selected[ index ].toLatin1().constData() ) : 0; -} - -/*! - \brief Add an object to the current selection. - \param theEntry object entry -*/ -void SALOMEGUI_Swig::AddIObject( const char* theEntry ) -{ - class TEvent: public SALOME_Event - { - public: - QString myEntry; - TEvent( const char* theEntry ) : myEntry( theEntry ) {} - virtual void Execute() - { - if ( SalomeApp_Application* anApp = getApplication() ) { - SalomeApp_Study* aStudy = dynamic_cast( anApp->activeStudy() ); // for sure! - LightApp_SelectionMgr* aSelMgr = anApp->selectionMgr(); - if ( aStudy && aSelMgr ) { - SALOME_ListIO anIOList; - anIOList.Append( new SALOME_InteractiveObject( myEntry.toLatin1(), "", "" ) ); - aSelMgr->setSelectedObjects( anIOList, true ); - } - } - } - }; - ProcessVoidEvent( new TEvent( theEntry ) ); -} - -/*! - \brief Remove the object from the selection. - \param theEntry object entry -*/ -void SALOMEGUI_Swig::RemoveIObject( const char* theEntry ) -{ - class TEvent: public SALOME_Event - { - public: - QString myEntry; - TEvent( const char* theEntry ) : myEntry( theEntry ) {} - virtual void Execute() - { - if ( SalomeApp_Application* anApp = getApplication() ) { - SalomeApp_Study* aStudy = dynamic_cast( anApp->activeStudy() ); // for sure! - LightApp_SelectionMgr* aSelMgr = anApp->selectionMgr(); - if ( aStudy && aSelMgr ) { - SALOME_ListIO anIOList; - // VSR: temporary solution, until LightApp_SelectionMgr::unsetSelectedObjects() method appears - // Lately this should be replaced by the following: - // anIOList.Append( new SALOME_InteractiveObject( myEntry, "", "" ) ); - // aSelMgr->unsetSelectedObjects( anIOList ); - /////////////////////////////////////////////// - aSelMgr->selectedObjects( anIOList ); - SALOME_ListIteratorOfListIO anIter( anIOList ); - for( ; anIter.More(); anIter.Next() ) { - if ( anIter.Value()->isSame( new SALOME_InteractiveObject( myEntry.toLatin1(), "", "" ) ) ) { - anIOList.Remove( anIter ); - aSelMgr->setSelectedObjects( anIOList, true ); - return; - } - } - } - } - } - }; - ProcessVoidEvent( new TEvent( theEntry ) ); -} - -/*! - \brief Clear selection (unselect all objects). -*/ -void SALOMEGUI_Swig::ClearIObjects() -{ - class TEvent: public SALOME_Event - { - public: - TEvent() {} - virtual void Execute() - { - if ( SalomeApp_Application* anApp = getApplication() ) { - SalomeApp_Study* aStudy = dynamic_cast( anApp->activeStudy() ); // for sure! - LightApp_SelectionMgr* aSelMgr = anApp->selectionMgr(); - if ( aStudy && aSelMgr ) - aSelMgr->clearSelected(); - } - } - }; - ProcessVoidEvent( new TEvent() ); -} - -/*! - \brief Display an object in the current view window. - - The presentable object should be previously created and - displayed in this viewer. - - For the current moment implemented for OCC and VTK viewers only. - - \param theEntry object entry -*/ -void SALOMEGUI_Swig::Display( const char* theEntry ) -{ - class TEvent: public SALOME_Event - { - QString myEntry; - public: - TEvent( const char* theEntry ) : myEntry( theEntry ) {} - virtual void Execute() { - if ( SalomeApp_Application* anApp = getApplication() ) { - SUIT_ViewWindow* window = anApp->desktop()->activeWindow(); - if ( window ) { - SALOME_View* view = dynamic_cast( window->getViewManager()->getViewModel() ); - if ( view ) - view->Display( view->CreatePrs( myEntry.toLatin1() ) ); - } - } - } - }; - ProcessVoidEvent( new TEvent( theEntry ) ); -} - -/*! - \brief Displays an object in the current view window and - erases all other ones. - - The presentable object should be previously created and - displayed in this viewer. - - For the current moment implemented for OCC and VTK viewers only. - - \param theEntry object entry -*/ -void SALOMEGUI_Swig::DisplayOnly( const char* theEntry ) -{ - class TEvent: public SALOME_Event - { - QString myEntry; - public: - TEvent( const char* theEntry ) : myEntry( theEntry ) {} - virtual void Execute() - { - if ( SalomeApp_Application* anApp = getApplication() ) { - SUIT_ViewWindow* window = anApp->desktop()->activeWindow(); - if ( window ) { - SALOME_View* view = dynamic_cast( window->getViewManager()->getViewModel() ); - if ( view ) { - view->EraseAll( false ); - view->Display( view->CreatePrs( myEntry.toLatin1() ) ); - } - } - } - } - }; - ProcessVoidEvent( new TEvent( theEntry ) ); -} - -/*! - \brief Erase an object in the current view window. - - The presentable object should be previously created and - displayed in this viewer. - - For the current moment implemented for OCC and VTK viewers only. - - \param theEntry object entry -*/ -void SALOMEGUI_Swig::Erase( const char* theEntry ) -{ - class TEvent: public SALOME_Event - { - QString myEntry; - public: - TEvent( const char* theEntry ) : myEntry( theEntry ) {} - virtual void Execute() - { - if ( SalomeApp_Application* anApp = getApplication() ) { - SUIT_ViewWindow* window = anApp->desktop()->activeWindow(); - if ( window ) { - SALOME_View* view = dynamic_cast( window->getViewManager()->getViewModel() ); - if ( view ) - view->Erase( view->CreatePrs( myEntry.toLatin1() ) ); - } - } - } - }; - ProcessVoidEvent( new TEvent( theEntry ) ); -} - -/*! - \brief Display all active module's presentable - child objects in the current view window. - - The presentable objects should be previously created and - displayed in this viewer. - - For the current moment implemented for OCC and VTK viewers only. -*/ -void SALOMEGUI_Swig::DisplayAll() -{ - class TEvent: public SALOME_Event - { - public: - TEvent() {} - virtual void Execute() - { - if ( SalomeApp_Application* anApp = getApplication() ) { - SalomeApp_Study* study = dynamic_cast( anApp->activeStudy() ); // for sure! - SUIT_ViewWindow* window = anApp->desktop()->activeWindow(); - SalomeApp_Module* activeModule = dynamic_cast( anApp->activeModule() ); - if ( study && window && activeModule ) { - SALOME_View* view = dynamic_cast( window->getViewManager()->getViewModel() ); - if ( view ) { - for ( SUIT_DataObjectIterator it( activeModule->dataModel()->root(), SUIT_DataObjectIterator::DepthLeft ); it.current(); ++it ) { - SalomeApp_DataObject* obj = dynamic_cast( it.current() ); - if ( obj && !obj->entry().isEmpty() ) - view->Display( view->CreatePrs( obj->entry().toLatin1() ) ); - } - } - } - } - } - }; - ProcessVoidEvent( new TEvent() ); -} - -/*! - \brief Erase all objects from the current view window. - - For the current moment implemented for OCC and VTK viewers only. -*/ -void SALOMEGUI_Swig::EraseAll() -{ - class TEvent: public SALOME_Event - { - public: - TEvent() {} - virtual void Execute() - { - if ( SalomeApp_Application* anApp = getApplication() ) { - SUIT_ViewWindow* window = anApp->desktop()->activeWindow(); - if ( window ) { - SALOME_View* view = dynamic_cast( window->getViewManager()->getViewModel() ); - if ( view ) - view->EraseAll( false ); - } - } - } - }; - ProcessVoidEvent( new TEvent() ); -} - -/*! - \fn bool SALOMEGUI_Swig::IsInCurrentView( const char* theEntry ) - \brief Check it the object is displayed in the current view window. - - VSR: For the current moment implemented for OCC and VTK viewers only. - - \param theEntry object entry - \return \c true if the object with given entry is displayed - in the current viewer -*/ - -class TIsInViewerEvent: public SALOME_Event -{ - QString myEntry; -public: - typedef bool TResult; - TResult myResult; - TIsInViewerEvent( const char* theEntry ) : myEntry( theEntry ), myResult( false ) {} - virtual void Execute() - { - if ( SalomeApp_Application* anApp = getApplication() ) { - SUIT_ViewWindow* window = anApp->desktop()->activeWindow(); - if ( window ) { - SALOME_View* view = dynamic_cast( window->getViewManager()->getViewModel() ); - if ( view ) { - SALOME_Prs* aPrs = view->CreatePrs( myEntry.toLatin1() ); - myResult = !aPrs->IsNull(); - } - } - } - } -}; -bool SALOMEGUI_Swig::IsInCurrentView( const char* theEntry ) -{ - return ProcessEvent( new TIsInViewerEvent( theEntry ) ); -} - -/*! - \brief Update (repaint) current view window. -*/ -void SALOMEGUI_Swig::UpdateView() -{ - class TEvent: public SALOME_Event - { - public: - TEvent() {} - virtual void Execute() - { - if ( SalomeApp_Application* anApp = getApplication() ) { - SUIT_ViewWindow* window = anApp->desktop()->activeWindow(); - if ( window ) { - SALOME_View* view = dynamic_cast( window->getViewManager()->getViewModel() ); - if ( view ) - view->Repaint(); - } - } - } - }; - ProcessVoidEvent( new TEvent() ); -} - -/*! - \brief Fit current view window to display all its contents. -*/ -void SALOMEGUI_Swig::FitAll() -{ - class TEvent: public SALOME_Event - { - public: - TEvent() {} - virtual void Execute() - { - if ( SalomeApp_Application* anApp = getApplication() ) { - SUIT_ViewWindow* window = anApp->desktop()->activeWindow(); - if ( window ) { - if ( dynamic_cast( window ) ) - ( dynamic_cast( window ) )->onFitAll(); - else if ( dynamic_cast( window ) ) - ( dynamic_cast( window ) )->onFitAll(); - else if ( dynamic_cast( window ) ) - ( dynamic_cast( window ) )->onFitAll(); - } - } - } - }; - ProcessVoidEvent( new TEvent() ); -} - -/*! - \brief Reset current view window to the default state. -*/ -void SALOMEGUI_Swig::ResetView() -{ - class TEvent: public SALOME_Event - { - public: - TEvent() {} - virtual void Execute() - { - if ( SalomeApp_Application* anApp = getApplication() ) { - SUIT_ViewWindow* window = anApp->desktop()->activeWindow(); - if ( window ) { - if ( dynamic_cast( window ) ) - (dynamic_cast( window ))->onResetView(); - else if ( dynamic_cast( window ) ) - (dynamic_cast( window ))->onResetView(); - else if ( dynamic_cast( window ) ) - (dynamic_cast( window ))->onFitAll(); - // VSR: there is no 'ResetView' functionality for Plot2d viewer, - // so we use 'FitAll' instead. - } - } - } - }; - ProcessVoidEvent( new TEvent() ); -} - -/*! - \brief View operation type. - \internal -*/ -enum { - __ViewTop, //!< view top side - __ViewBottom, //!< view bottom side - __ViewLeft, //!< view left side - __ViewRight, //!< view right side - __ViewFront, //!< view front side - __ViewBack //!< view back side -}; - -/*! - \brief Change the view of the current view window. - \internal - \param view view operation type -*/ -static void setView( int view ) -{ - class TEvent: public SALOME_Event - { - private: - int myView; - public: - TEvent( int view ) : myView( view ) {} - virtual void Execute() - { - if ( SalomeApp_Application* anApp = getApplication() ) { - SUIT_ViewWindow* window = anApp->desktop()->activeWindow(); - if ( window ) { - if ( dynamic_cast( window ) ) { - switch( myView ) { - case __ViewTop: - (dynamic_cast( window ))->onTopView(); break; - case __ViewBottom: - (dynamic_cast( window ))->onBottomView(); break; - case __ViewLeft: - (dynamic_cast( window ))->onLeftView(); break; - case __ViewRight: - (dynamic_cast( window ))->onRightView(); break; - case __ViewFront: - (dynamic_cast( window ))->onFrontView(); break; - case __ViewBack: - (dynamic_cast( window ))->onBackView(); break; - default: - break; - } - } - else if ( dynamic_cast( window ) ) { - switch( myView ) { - case __ViewTop: - (dynamic_cast( window ))->onTopView(); break; - case __ViewBottom: - (dynamic_cast( window ))->onBottomView(); break; - case __ViewLeft: - (dynamic_cast( window ))->onLeftView(); break; - case __ViewRight: - (dynamic_cast( window ))->onRightView(); break; - case __ViewFront: - (dynamic_cast( window ))->onFrontView(); break; - case __ViewBack: - (dynamic_cast( window ))->onBackView(); break; - default: - break; - } - } - } - } - } - }; - ProcessVoidEvent( new TEvent( view ) ); -} - -/*! - \brief Switch current view window to show the top view. -*/ -void SALOMEGUI_Swig::ViewTop() -{ - setView( __ViewTop ); -} - -/*! - \brief Switch current view window to show the bottom view -*/ -void SALOMEGUI_Swig::ViewBottom() -{ - setView( __ViewBottom ); -} - -/*! - \brief Switch current view window to show the left view -*/ -void SALOMEGUI_Swig::ViewLeft() -{ - setView( __ViewLeft ); -} - -/*! - \brief Switch current view window to show the right view -*/ -void SALOMEGUI_Swig::ViewRight() -{ - setView( __ViewRight ); -} - -/*! - \brief Switch current view window to show the front view -*/ -void SALOMEGUI_Swig::ViewFront() -{ - setView( __ViewFront ); -} - -/*! - \brief Switch current view window to show the back view -*/ -void SALOMEGUI_Swig::ViewBack() -{ - setView( __ViewBack ); -} diff --git a/src/SALOME_SWIG/SALOMEGUI_Swig.hxx b/src/SALOME_SWIG/SALOMEGUI_Swig.hxx deleted file mode 100644 index 483300f38..000000000 --- a/src/SALOME_SWIG/SALOMEGUI_Swig.hxx +++ /dev/null @@ -1,69 +0,0 @@ -// SALOME SALOMEGUI : implementation of desktop and GUI kernel -// -// 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 : SALOMEGUI_Swig.hxx -// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// - -#ifndef SALOMEGUI_SWIG_HXX -#define SALOMEGUI_SWIG_HXX - -class SALOMEGUI_Swig -{ -public: - SALOMEGUI_Swig(); - ~SALOMEGUI_Swig(); - - bool hasDesktop(); - - void updateObjBrowser( bool ); - - int getActiveStudyId(); - const char* getActiveStudyName(); - - const char* getComponentName( const char* ); - const char* getComponentUserName( const char* ); - - int SelectedCount(); - const char* getSelected( int i ); - void AddIObject( const char* ); - void RemoveIObject( const char* ); - void ClearIObjects(); - - void Display( const char* ); - void DisplayOnly( const char* ); - void Erase( const char* ); - void DisplayAll(); - void EraseAll(); - bool IsInCurrentView( const char* ); - void UpdateView(); - - void FitAll(); - void ResetView(); - void ViewTop(); - void ViewBottom(); - void ViewLeft(); - void ViewRight(); - void ViewFront(); - void ViewBack(); -}; - -#endif // SALOMEGUI_SWIG_HXX diff --git a/src/SALOME_SWIG/SALOMEGUI_Swig.i b/src/SALOME_SWIG/SALOMEGUI_Swig.i deleted file mode 100644 index e2298b803..000000000 --- a/src/SALOME_SWIG/SALOMEGUI_Swig.i +++ /dev/null @@ -1,94 +0,0 @@ -// SALOME SALOMEGUI : implementation of desktop and GUI kernel -// -// 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 : SALOMEGUI_Swig.i -// Author : Paul RASCLE, EDF -// - -%{ -#include "SALOMEGUI_Swig.hxx" -%} - -%include "cpointer.i" - -/* 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 -} - -class SALOMEGUI_Swig -{ -public: - SALOMEGUI_Swig(); - virtual ~SALOMEGUI_Swig(); - - /* check GUI */ - bool hasDesktop(); - - /* update object browser*/ - void updateObjBrowser(bool); - - /* get active study */ - int getActiveStudyId(); - const char *getActiveStudyName(); - - /* get component name/username */ - const char* getComponentName( const char* ComponentUserName ); - const char* getComponentUserName( const char* ComponentName ); - - /* selection processing */ - int SelectedCount(); - const char *getSelected(int i); - void AddIObject(const char *Entry); - void RemoveIObject(const char *Entry); - void ClearIObjects(); - - /* display/erase */ - void Display(const char *Entry); - void DisplayOnly(const char *Entry); - void Erase(const char *Entry); - void DisplayAll(); - void EraseAll(); - bool IsInCurrentView(const char *Entry); - void UpdateView(); - - /* view operations */ - void FitAll(); - void ResetView(); - void ViewTop(); - void ViewBottom(); - void ViewLeft(); - void ViewRight(); - void ViewFront(); - void ViewBack(); -}; diff --git a/src/SALOME_SWIG/SALOMEGUI_shared_modules.py b/src/SALOME_SWIG/SALOMEGUI_shared_modules.py deleted file mode 100755 index 25170ebfd..000000000 --- a/src/SALOME_SWIG/SALOMEGUI_shared_modules.py +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms 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 -# -""" - -""" - -import SALOME_Session_idl - -from import_hook import register_name -register_name("SalomePyQt") - -# this function is required - -def init_shared_modules(): - """ - This function initializes shared modules that need to be - """ - pass diff --git a/src/SALOME_SWIG/examplevtk1.py b/src/SALOME_SWIG/examplevtk1.py deleted file mode 100755 index e214bedf8..000000000 --- a/src/SALOME_SWIG/examplevtk1.py +++ /dev/null @@ -1,40 +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 -# -# -# -# File : examplevtk1.py -# Module : SALOME - -import libSalomePy -ren=libSalomePy.renderer -#iren=libSalomePy.interactor - -from libVTKCommonPython import * -from libVTKGraphicsPython import * -cone = vtkConeSource() -cone.SetResolution(8) -coneMapper = vtkPolyDataMapper() -coneMapper.SetInput(cone.GetOutput()) -coneActor = vtkActor() -coneActor.SetMapper(coneMapper) - -ren.AddActor(coneActor) -iren = vtkRenderWindowInteractor() - diff --git a/src/SALOME_SWIG/libSALOME_Swig.i b/src/SALOME_SWIG/libSALOME_Swig.i deleted file mode 100755 index a96601f7e..000000000 --- a/src/SALOME_SWIG/libSALOME_Swig.i +++ /dev/null @@ -1,31 +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 -// -// -// -// File : libSALOME_Swig.i -// Author : Paul RASCLE, EDF -// Module : SALOME -// $Header$ - -%module libSALOME_Swig - -//%include "SALOME_NamingService.i" -%include "SALOMEGUI_Swig.i" - diff --git a/src/SALOME_SWIG/salome.py b/src/SALOME_SWIG/salome.py deleted file mode 100755 index 9d45865db..000000000 --- a/src/SALOME_SWIG/salome.py +++ /dev/null @@ -1,157 +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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -# -# -# -# File : salome.py -# Author : Paul RASCLE, EDF -# Module : SALOME -# $Header$ - -from omniORB import CORBA -from LifeCycleCORBA import * -from libSALOME_Swig import * -import SALOMEDS -from SALOME_NamingServicePy import * - -from SALOME_utilities import * - -#-------------------------------------------------------------------------- - -def DumpComponent(Study, SO, offset): - it = Study.NewChildIterator(SO) - Builder = Study.NewBuilder() - while it.More(): - CSO = it.Value() - it.Next() - anAttr = Builder.FindOrCreateAttribute(CSO, "AttributeName") - AtName = anAttr._narrow(SALOMEDS.AttributeName) - t_name = AtName.Value() - if t_name[0] == 1: - ofs = 1 - a = "" - while ofs <= offset: - a = a + "--" - ofs = ofs +1 - MESSAGE( a + ">" + str(CSO.GetID()) + " " + str(t_name[1]) ) - t_RefSO = CSO.ReferencedObject() - if t_RefSO[0] == 1: - RefSO = t_RefSO[1] - ofs = 1 - a = "" - while ofs <= offset: - a = a + " " - ofs = ofs +1 - MESSAGE( a + ">" + str(RefSO.GetID()) ) - DumpComponent(Study, CSO, offset+2) - - #-------------------------------------------------------------------------- - -def DumpStudy(Study): - itcomp = Study.NewComponentIterator() - while itcomp.More(): - SC = itcomp.Value() - itcomp.Next() - name = SC.ComponentDataType() - MESSAGE( "-> ComponentDataType is " + name ) - DumpComponent(Study, SC, 1) - - - #-------------------------------------------------------------------------- - -def ImportComponentGUI(ComponentName): - libName = "lib" + ComponentName + "_Swig" - command = "from " + libName + " import *" - exec ( command ) - constructor = ComponentName + "_Swig()" - command = "gui = " + constructor - exec ( command ) - return gui - - #-------------------------------------------------------------------------- - -def SalomeGUIgetAllSelected(self): - selNumber = self.SelectedCount() - listSelected = [] - for i in range(selNumber): - listSelected.append(self.getSelected(i)) - return listSelected - -class SalomeGUI(SALOMEGUI_Swig): - getAllSelected = SalomeGUIgetAllSelected - - #-------------------------------------------------------------------------- - -def IDToObject(id): - myObj = None - mySO = myStudy.FindObjectID(id); - if mySO is not None: - ok, anAttr = mySO.FindAttribute("AttributeIOR") - if ok: - AtIOR = anAttr._narrow(SALOMEDS.AttributeIOR) - if AtIOR.Value() != "": - myObj = orb.string_to_object(AtIOR.Value()) - return myObj - -def ObjectToSObject(obj): - mySO = None - if obj is not None: - ior = orb.object_to_string(obj) - if ior != "": - mySO = myStudy.FindObjectIOR(ior) - return mySO - -def ObjectToID(obj): - mySO = ObjectToSObject(obj) - if mySO: - return mySO.GetID() - return "" - -def IDToSObject(id): - mySO = myStudy.FindObjectID(id); - return mySO - - #-------------------------------------------------------------------------- - -# initialise the ORB -orb = CORBA.ORB_init([''], CORBA.ORB_ID) - -# create an LifeCycleCORBA instance -lcc = LifeCycleCORBA(orb) - -# create an SALOMEGUI_Swig instance -sg = SalomeGUI() - -#create an naming service instance -naming_service = SALOME_NamingServicePy_i(orb) - -# get active study name and id -myStudyName = sg.getActiveStudyName() -MESSAGE( myStudyName ) - -myStudyId = sg.getActiveStudyId() -MESSAGE( str(myStudyId) ) - -# get Study Manager reference -obj = naming_service.Resolve('myStudyManager') -myStudyManager = obj._narrow(SALOMEDS.StudyManager) - -# get active study -myStudy = myStudyManager.GetStudyByName(myStudyName) - diff --git a/src/SALOME_SWIG/supervisionexample.py.in b/src/SALOME_SWIG/supervisionexample.py.in deleted file mode 100755 index 66974aeb6..000000000 --- a/src/SALOME_SWIG/supervisionexample.py.in +++ /dev/null @@ -1,85 +0,0 @@ -#============================================================================== -# File : supervisionexample.py -# Created : 23 nov 2001 -# Author : Jean Rahuel -# Project : SALOME -# Copyright : CEA -#============================================================================== - -from SuperV import * - - - -# load this object with Nodes, Links and Datas stored in GraphEssai.xml -# (GraphEssai.xml was created with python in SuperVisionTest and GraphEssai.py) -myGraph = Graph("@ROOT_BUILDDIR@/share/salome/resources/superv/GraphEssai.xml") - -#myGraph = Graph("/home/data/jr_HEAD/build/share/salome/resources/superv/GraphEssai.xml") -# This DataFlow is "valid" : no loop, correct links between Nodes etc... - -print myGraph.IsValid() - -# Get Nodes -myGraph.PrintNodes() -Add,Sub,Mul,Div = myGraph.Nodes() - -# Load Datas -Addx = Add.Input("x",3.) -Addy = Add.Input("y",4.5) -Subx = Sub.Input("x",1.5) - -# Get Output Port -Addz = Add.Port('z') -Subz = Sub.Port('z') -Mulz = Mul.Port('z') -Divz = Div.Port('z') - -# This DataFlow is "executable" : all pending Ports are defined with Datas -print myGraph.IsExecutable() - -# Starts only execution of that DataFlow and gets control immediatly -print myGraph.Run() - -# That DataFlow is running ==> 0 (false) -print myGraph.IsDone() - -# Events of execution : -aStatus,aNode,anEvent,aState = myGraph.Event() -while aStatus : - print aNode.Thread(),aNode.SubGraph(),aNode.Name(),anEvent,aState - aStatus,aNode,anEvent,aState = myGraph.Event() -print myGraph.IsDone() - -# Wait for Completion (but it is already done after event loop ...) -print "Done : ",myGraph.DoneW() - -# Get result -print "Result : ",Divz.ToString() - -# Intermediate results : -print "Intermediate Result Add\z : ",Addz.ToString() -print "Intermediate Result Sub\z : ",Subz.ToString() -print "Intermediate Result Mul\z : ",Mulz.ToString() - -print " " -print "Type : print myGraph.IsDone()" -print " If execution is finished ==> 1 (true)" -print " " -print "Type : print Divz.ToString()" -print " You will get the result" -print " " -print "Type : myGraph.PrintPorts()" -print " to see input and output values of the graph" -print " " -print "Type : Add.PrintPorts()" -print "Type : Sub.PrintPorts()" -print "Type : Mul.PrintPorts()" -print "Type : Div.PrintPorts()" -print " to see input and output values of nodes" - -# Export will create newsupervisionexample.xml and the corresponding .py file -print myGraph.Export("@ROOT_BUILDDIR@/share/salome/resources/superv/newsupervisionexample.xml") - -print " " -print "See file @ROOT_BUILDDIR@/share/salome/resources/superv/newsupervisionexample.xml" -print "See file @ROOT_BUILDDIR@/share/salome/resources/superv/newsupervisionexample.py" diff --git a/src/SALOME_SWIG/supervisiongeomexample.py.in b/src/SALOME_SWIG/supervisiongeomexample.py.in deleted file mode 100755 index 8c56bb1f2..000000000 --- a/src/SALOME_SWIG/supervisiongeomexample.py.in +++ /dev/null @@ -1,103 +0,0 @@ - -# Generated python file of Graph GraphGeom2Essai - -from SuperV import * - -import salome - -import geompy - - -geom = lcc.FindOrLoadComponent("FactoryServer", "Geometry") -geom.GetCurrentStudy(salome.myStudyId) - -myBuilder = salome.myStudy.NewBuilder() - -# Graph creation -GraphGeom2Essai = Graph( 'GraphGeom2Essai' ) -print GraphGeom2Essai.SetAuthor( '' ) -print GraphGeom2Essai.SetComment( '' ) -GraphGeom2Essai.Coords( 0 , 0 ) - -# Creation of Nodes -MakeSphere = GraphGeom2Essai.Node( 'Geometry' , 'Geometry' , 'MakeSphere' ) -print MakeSphere.SetAuthor( '' ) -print MakeSphere.SetContainer( 'FactoryServer' ) -print MakeSphere.SetComment( '' ) -MakeSphere.Coords( 26 , 13 ) -MakeCopy = GraphGeom2Essai.Node( 'Geometry' , 'Geometry' , 'MakeCopy' ) -print MakeCopy.SetAuthor( '' ) -print MakeCopy.SetContainer( 'FactoryServer' ) -print MakeCopy.SetComment( '' ) -MakeCopy.Coords( 219 , 12 ) -MakeTranslation = GraphGeom2Essai.Node( 'Geometry' , 'Geometry' , 'MakeTranslation' ) -print MakeTranslation.SetAuthor( '' ) -print MakeTranslation.SetContainer( 'FactoryServer' ) -print MakeTranslation.SetComment( '' ) -MakeTranslation.Coords( 219 , 159 ) -MakeFuse = GraphGeom2Essai.Node( 'Geometry' , 'Geometry' , 'MakeFuse' ) -print MakeFuse.SetAuthor( '' ) -print MakeFuse.SetContainer( 'FactoryServer' ) -print MakeFuse.SetComment( '' ) -MakeFuse.Coords( 465 , 106 ) - -# Creation of intermediate Output variables and of links -MakeSphereshape = MakeSphere.Port( 'shape' ) -MakeCopyshape1 = GraphGeom2Essai.Link( MakeSphereshape , MakeCopy.Port( 'shape1' ) ) -MakeTranslationshape1 = GraphGeom2Essai.Link( MakeSphereshape , MakeTranslation.Port( 'shape1' ) ) -MakeCopyshape = MakeCopy.Port( 'shape' ) -MakeFuseshape1 = GraphGeom2Essai.Link( MakeCopyshape , MakeFuse.Port( 'shape1' ) ) -MakeTranslationshape = MakeTranslation.Port( 'shape' ) -MakeFuseshape2 = GraphGeom2Essai.Link( MakeTranslationshape , MakeFuse.Port( 'shape2' ) ) - -# Creation of Input datas -MakeSpherex1 = MakeSphere.Input( 'x1' , 0) -MakeSpherey1 = MakeSphere.Input( 'y1' , 0) -MakeSpherez1 = MakeSphere.Input( 'z1' , 0) -MakeSphereradius = MakeSphere.Input( 'radius' , 50) -MakeTranslationx1 = MakeTranslation.Input( 'x1' , 80) -MakeTranslationy1 = MakeTranslation.Input( 'y1' , 0) -MakeTranslationz1 = MakeTranslation.Input( 'z1' , 0) - -# Missing Input datas : None - -# Creation of Output variables -MakeFuseshape = MakeFuse.Port( 'shape' ) - -# State of Ports of the Graph -GraphGeom2Essai.PrintPorts() - -# Start asynchronous run -print GraphGeom2Essai.Run() - -# Done ? -print GraphGeom2Essai.IsDone() - -# Events of execution : -aStatus,aNode,anEvent,aState = GraphGeom2Essai.Event() -while aStatus : - print aNode.Thread(),aNode.SubGraph(),aNode.Name(),anEvent,aState - aStatus,aNode,anEvent,aState = GraphGeom2Essai.Event() -print GraphGeom2Essai.IsDone() - -# Waiting end of execution : -print GraphGeom2Essai.DoneW() - -print " " -print "Type print GraphGeom2Essai.IsDone()" -print "1 <==> It's done" -print " " -print "Type print GraphGeom2Essai.DoneW()" -print "Wait until end of execution : 1(success)" -print " " -print "Type GraphGeom2Essai.PrintPorts()" -print " to see input and output values of the graph" -print " " -print "Type MakeSphere.PrintPorts()" -print "Type MakeCopy.PrintPorts()" -print "Type MakeTranslation.PrintPorts()" -print "Type MakeFuse.PrintPorts()" -print " to see input and output values of nodes" -print " " -print "Type print GraphGeom2Essai.Export('File-Name')" -print "You will get a .py and a .xml file of this graph" diff --git a/src/SALOME_SWIG/test_big_table.py b/src/SALOME_SWIG/test_big_table.py deleted file mode 100755 index 126a549ec..000000000 --- a/src/SALOME_SWIG/test_big_table.py +++ /dev/null @@ -1,67 +0,0 @@ -# Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms 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 : test_big_table.py -# Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -# - -import salome -import math -import SALOMEDS - -# >>> Getting study builder ================================================== -myStudy = salome.myStudy -myBuilder = myStudy.NewBuilder() - -# >>> Creating virtual component ============================================= -myComponent = myStudy.FindComponent("VirtualComponent") -if not myComponent: - myComponent = myBuilder.NewComponent("VirtualComponent") - aName = myBuilder.FindOrCreateAttribute(myComponent, "AttributeName") - aName.SetValue("VirtualComponent") - -# >>> Creating object with Table of real[ 200 * 20 ] ======================== -myTRealObject = myBuilder.NewObject(myComponent) -AName = myBuilder.FindOrCreateAttribute(myTRealObject, "AttributeName") -AName.SetValue("Table Of Real") -ARealTable = myBuilder.FindOrCreateAttribute(myTRealObject, "AttributeTableOfReal") -myHorNb = 10 -myVerNb = 200 - -k={} -for j in range(0,myHorNb): - k[j] = j*10+1 -ARealTable.AddRow(k.values()) -ARealTable.SetRowTitle(1, "Frequency") -ARealTable.SetRowUnit(1, "Hz") - -for i in range(1,myVerNb+1): - for j in range(0,myHorNb): - if j % 2 == 1: - k[j] = math.log10(j*30*math.pi/180) * 20 + i * 15 + j*5 - else: - k[j] = math.sin(j*30*math.pi/180) * 20 + i * 15 + j*5 - ARealTable.AddRow(k.values()) - ARealTable.SetRowTitle(i+1, "Power " + str(i)) - ARealTable.SetRowUnit(i+1, "Wt") -ARealTable.SetTitle("Very useful data") - -# >>> Updating Object Browser ================================================ -salome.sg.updateObjBrowser(1) - -# ============================================================================ diff --git a/src/SALOME_SWIG/test_many_objects.py b/src/SALOME_SWIG/test_many_objects.py deleted file mode 100755 index df486b271..000000000 --- a/src/SALOME_SWIG/test_many_objects.py +++ /dev/null @@ -1,87 +0,0 @@ -# Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms 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 : visu_many_objects.py -# Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -# - -import salome -import SALOMEDS - -# >>> Getting study builder ================================================== -myStudy = salome.myStudy -myBuilder = myStudy.NewBuilder() - -# >>> Creating virtual component ============================================= -myComponent = myBuilder.NewComponent("VIRTUAL") -AName = myBuilder.FindOrCreateAttribute(myComponent, "AttributeName") -AName.SetValue("Virtual") -ACmt = myBuilder.FindOrCreateAttribute(myComponent, "AttributeComment") -ACmt.SetValue("Virtual") - -# >>> Creating objects ======================================================= -# TO CHANGE TOTAL NUMBER OF OBJECTS, SET PROPER , , -# IF YOU DON'T WANT TO ADD REFERENCES, SET = 0 -myNb1 = 20 -myNb2 = 5 -myNb3 = 3 -myAddRef = 1 - -if myAddRef == 1: - myContainer = myBuilder.NewObject(myComponent) - AName = myBuilder.FindOrCreateAttribute(myContainer, "AttributeName") - AName.SetValue("References") - ACmt = myBuilder.FindOrCreateAttribute(myContainer, "AttributeComment") - ACmt.SetValue("Container for objects") - -for i in range(0,myNb1): - myObject1 = myBuilder.NewObject(myComponent) - AName = myBuilder.FindOrCreateAttribute(myObject1, "AttributeName") - AName.SetValue("Object "+str(i)) - ACmt = myBuilder.FindOrCreateAttribute(myObject1, "AttributeComment") - ACmt.SetValue("Virtual object "+str(i)) - if myAddRef == 1: - myRefObject = myBuilder.NewObject(myContainer) - myBuilder.Addreference(myRefObject,myObject1); - - for j in range(0,myNb2): - myObject2 = myBuilder.NewObject(myObject1) - AName = myBuilder.FindOrCreateAttribute(myObject2, "AttributeName") - AName.SetValue("Object "+str(i)+"-"+str(j)) - ACmt = myBuilder.FindOrCreateAttribute(myObject2, "AttributeComment") - ACmt.SetValue("Virtual object "+str(i)+"-"+str(j)) - if myAddRef == 1: - myRefObject = myBuilder.NewObject(myContainer) - myBuilder.Addreference(myRefObject,myObject2); - - for k in range(0,myNb3): - myObject3 = myBuilder.NewObject(myObject2) - AName = myBuilder.FindOrCreateAttribute(myObject3, "AttributeName") - AName.SetValue("Object "+str(i)+"-"+str(j)+"-"+str(k)) - ACmt = myBuilder.FindOrCreateAttribute(myObject3, "AttributeComment") - ACmt.SetValue("Virtual object "+str(i)+"-"+str(j)+"-"+str(k)) - if myAddRef == 1: - myRefObject = myBuilder.NewObject(myContainer) - myBuilder.Addreference(myRefObject,myObject3); - -# >>> Updating Object Browser ================================================ -salome.sg.updateObjBrowser(1) - -# ============================================================================ - - diff --git a/src/SALOME_SWIG/test_remove_ref.py b/src/SALOME_SWIG/test_remove_ref.py deleted file mode 100755 index dcc18c922..000000000 --- a/src/SALOME_SWIG/test_remove_ref.py +++ /dev/null @@ -1,49 +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 -# -# -# -# File : test_remove_ref.py -# Module : SALOMEDS - -from salome import * - -myBuilder = myStudy.NewBuilder() - - -obj1 = myStudy.FindObjectID("0:1") -if obj1 is None: print "Is null obj1 " -else: print obj1.GetID() - -obj2 = myBuilder.NewObject(obj1) -print "Obj2 ID = "+obj2.GetID() - -myBuilder.Addreference(obj1, obj2) - -(f, obj3) = obj1.ReferencedObject() - -print "Ref obj ID = "+obj3.GetID() - - -myBuilder.RemoveReference(obj1) - -(f, obj4) = obj1.ReferencedObject() - -print "Ref is found ", f - \ No newline at end of file diff --git a/src/SALOME_SWIG/test_table.py b/src/SALOME_SWIG/test_table.py deleted file mode 100755 index 740029932..000000000 --- a/src/SALOME_SWIG/test_table.py +++ /dev/null @@ -1,113 +0,0 @@ -# Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms 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 : test_table.py -# Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -# - -import salome -import math -import SALOMEDS - -# >>> Getting study builder ================================================== -myStudy = salome.myStudy -myBuilder = myStudy.NewBuilder() - -# >>> Creating virtual component ============================================= -myComponent = myStudy.FindComponent("VirtualComponent") -if not myComponent: - myComponent = myBuilder.NewComponent("VirtualComponent") - aName = myBuilder.FindOrCreateAttribute(myComponent, "AttributeName") - aName.SetValue("VirtualComponent") - -# >>> Creating object with Table of integer ================================== -myTIntObject = myBuilder.NewObject(myComponent) -AName = myBuilder.FindOrCreateAttribute(myTIntObject, "AttributeName") -AName.SetValue("Table Of Integer") -AIntTable = myBuilder.FindOrCreateAttribute(myTIntObject, "AttributeTableOfInteger") - -a=[1,2,3,4,5,6,7,8,9,10] -AIntTable.AddRow(a) -a=[110,120,130,140,150,160,170,180,190,200] -AIntTable.AddRow(a) -a=[-1,272,0,0,-642,10000,13,578,-578,99] -AIntTable.AddRow(a) -AIntTable.SetTitle("TEST table of integer") -AIntTable.SetRowTitle(1,"FR") -AIntTable.SetRowUnit(1,"m/h") -AIntTable.SetRowTitle(2,"SR") -AIntTable.SetRowUnit(2,"s") -AIntTable.SetRowTitle(3,"TR") -AIntTable.SetRowUnit(3,"$") -c=["C1","C2","C3","C4","C5","C6","C7","C8","C9","C10"] -AIntTable.SetColumnTitles(c) - -# >>> Creating object with Table of real ===================================== -myTRealObject = myBuilder.NewObject(myComponent) -AName = myBuilder.FindOrCreateAttribute(myTRealObject, "AttributeName") -AName.SetValue("Table Of Real") -ARealTable = myBuilder.FindOrCreateAttribute(myTRealObject, "AttributeTableOfReal") - -k={} -l={} -for j in range(0,20): - k[j] = j*10+1 - l[j] = "C"+str(j+1) -ARealTable.AddRow(k.values()) -ARealTable.SetRowTitle(1, "Row 0") -ARealTable.SetRowUnit(1, "Hz") -ARealTable.SetColumnTitles(l.values()) -for i in range(1,11): - for j in range(1,21): - if j % 2 == 1: - k[j] = math.log10(j*30*math.pi/180) * 20 + i * 15 + j*5 - else: - k[j] = math.sin(j*30*math.pi/180) * 20 + i * 15 + j*5 - ARealTable.AddRow(k.values()) - ARealTable.SetRowTitle(i+1, "Row " + str(i)) - ARealTable.SetRowUnit(i+1, "Wt") -ARealTable.SetTitle("TEST table of real") - -# >>> Creating object with integer attribute ================================= -myIntObject = myBuilder.NewObject(myComponent) -AName = myBuilder.FindOrCreateAttribute(myIntObject, "AttributeName") -AName.SetValue("Integer") -AInt = myBuilder.FindOrCreateAttribute(myIntObject, "AttributeInteger") -AInt.SetValue(123) - -# >>> Creating object with real attribute ==================================== -myRealObject = myBuilder.NewObject(myComponent) -AName = myBuilder.FindOrCreateAttribute(myRealObject, "AttributeName") -AName.SetValue("Real") -AReal = myBuilder.FindOrCreateAttribute(myRealObject, "AttributeReal") -AReal.SetValue(-56.9634) - -# >>> Creating object with comment attribute ================================= -myCmtObject = myBuilder.NewObject(myComponent) -AName = myBuilder.FindOrCreateAttribute(myCmtObject, "AttributeName") -AName.SetValue("Comment") -ACmt = myBuilder.FindOrCreateAttribute(myCmtObject, "AttributeComment") -ACmt.SetValue("Just a comment") - -# >>> Updating Object Browser ================================================ -salome.sg.updateObjBrowser(1) - -# ============================================================================ - - - diff --git a/src/SOCC/Makefile.am b/src/SOCC/Makefile.am deleted file mode 100755 index e822208e5..000000000 --- a/src/SOCC/Makefile.am +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms 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 : Alexander Solovyov(OCN) -# Module : SOCC -# $Header: /dn06/SALOME_CVS/GUI_SRC/src/SOCC/Makefile.in,v 1.1 - -include $(top_srcdir)/adm_local/unix/make_common_starter.am - -lib_LTLIBRARIES=libSOCC.la - -salomeinclude_HEADERS= \ - SOCC.h \ - SOCC_ViewModel.h \ - SOCC_Prs.h \ - SOCC_ViewWindow.h - -dist_libSOCC_la_SOURCES= \ - SOCC_ViewModel.cxx \ - SOCC_Prs.cxx \ - SOCC_ViewWindow.cxx - -MOC_FILES= \ - SOCC_ViewModel_moc.cxx \ - SOCC_ViewWindow_moc.cxx -nodist_libSOCC_la_SOURCES= $(MOC_FILES) - -libSOCC_la_CPPFLAGS=$(QT_INCLUDES) $(CAS_CPPFLAGS) $(BOOST_CPPFLAGS) \ - -I$(srcdir)/../SUIT -I$(srcdir)/../OBJECT -I$(srcdir)/../Prs \ - -I$(srcdir)/../OCCViewer -I$(srcdir)/../Qtx - -libSOCC_la_LDFLAGS=$(QT_MT_LIBS) -libSOCC_la_LIBADD=../Qtx/libqtx.la ../SUIT/libsuit.la ../OBJECT/libSalomeObject.la \ - ../Prs/libSalomePrs.la ../OCCViewer/libOCCViewer.la diff --git a/src/SOCC/SOCC.h b/src/SOCC/SOCC.h deleted file mode 100755 index 40d28ff8a..000000000 --- a/src/SOCC/SOCC.h +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 -// -#ifdef WIN32 -#ifdef SOCC_EXPORTS -#define SOCC_EXPORT __declspec(dllexport) -#else -#define SOCC_EXPORT __declspec(dllimport) -#endif -#else -#define SOCC_EXPORT -#endif - -#if defined WIN32 -#pragma warning ( disable: 4251 ) -#endif diff --git a/src/SOCC/SOCC.pro b/src/SOCC/SOCC.pro deleted file mode 100644 index 488f9f37c..000000000 --- a/src/SOCC/SOCC.pro +++ /dev/null @@ -1,33 +0,0 @@ -TEMPLATE = lib -TARGET = SOCC -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -BOOST_CPPFLAGS = $$(BOOSTDIR)/include - -INCLUDEPATH += ../../include $${CAS_CPPFLAGS} $${BOOST_CPPFLAGS} ../Qtx ../SUIT ../OBJECT ../Prs ../OCCViewer -LIBS += -L../../lib -lqtx -lsuit -lSalomeObject -lSalomePrs -lOCCViewer - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += SOCC_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS - -HEADERS = SOCC.h -HEADERS += SOCC_ViewModel.h -HEADERS += SOCC_Prs.h -HEADERS += SOCC_ViewWindow.h - -SOURCES = SOCC_ViewModel.cxx -SOURCES += SOCC_Prs.cxx -SOURCES += SOCC_ViewWindow.cxx - -includes.files = $$HEADERS -includes.path = ../../include - -INSTALLS += includes diff --git a/src/SOCC/SOCC_Prs.cxx b/src/SOCC/SOCC_Prs.cxx deleted file mode 100644 index 850c52a3b..000000000 --- a/src/SOCC/SOCC_Prs.cxx +++ /dev/null @@ -1,103 +0,0 @@ -// SALOME OCCViewer : build OCC Viewer into Salome desktop -// -// 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 : SOCC_Prs.cxx -// Author : Sergey ANIKIN -// Module : SALOME -// $Header$ - -#include "SOCC_Prs.h" - -#include - -using namespace std; - -/*! - Default constructor -*/ -SOCC_Prs::SOCC_Prs() -{ - myToActivate = true; -} - -/*! - Standard constructor -*/ -SOCC_Prs::SOCC_Prs( const Handle(AIS_InteractiveObject)& obj ) -{ - AddObject( obj ); -} - -/*! - Destructor -*/ -SOCC_Prs::~SOCC_Prs() -{ - myObjects.Clear(); -} - -/*! - Get interactive objects list -*/ -void SOCC_Prs::GetObjects( AIS_ListOfInteractive& list ) const -{ - list = myObjects; -} - -/*! - Add interactive object -*/ -void SOCC_Prs::AddObject( const Handle(AIS_InteractiveObject)& obj ) -{ - myObjects.Append( obj ); -} - -/*! - Remove all interactive objects -*/ -void SOCC_Prs::Clear() -{ - myObjects.Clear(); -} - -/*! - \return 0 if list of the interactive objects is empty [ Reimplemented from SALOME_Prs ] -*/ -bool SOCC_Prs::IsNull() const -{ - return myObjects.IsEmpty() == Standard_True; -} - -/*! - This method is used for activisation/deactivisation of - objects in the moment of displaying -*/ -void SOCC_Prs::SetToActivate( const bool toActivate ) -{ - myToActivate = toActivate; -} - -bool SOCC_Prs::ToActivate() const -{ - return myToActivate; -} diff --git a/src/SOCC/SOCC_Prs.h b/src/SOCC/SOCC_Prs.h deleted file mode 100644 index 36435ae33..000000000 --- a/src/SOCC/SOCC_Prs.h +++ /dev/null @@ -1,75 +0,0 @@ -// SALOME OCCViewer : build OCC Viewer into Salome desktop -// -// 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 : SOCC_Prs.h -// Author : Sergey ANIKIN -// Module : SALOME -// $Header$ - -#ifndef SOCC_Prs_H -#define SOCC_Prs_H - -#include "SOCC.h" - -#include - -#include - -class Handle(AIS_InteractiveObject); - -class SOCC_EXPORT SOCC_Prs : public SALOME_OCCPrs -{ -public: - SOCC_Prs(); - // Default constructor - SOCC_Prs( const Handle(AIS_InteractiveObject)& obj ); - // Standard constructor - ~SOCC_Prs(); - // Destructor - - void GetObjects( AIS_ListOfInteractive& list ) const; - // Get interactive objects list - void AddObject( const Handle(AIS_InteractiveObject)& obj ); - // Add interactive object - - void Clear(); - // Remove all interactive objects - - bool IsNull() const; - // Reimplemented from SALOME_Prs - - /* This method is used for activisation/deactivisation of - objects in the moment of displaying */ - void SetToActivate( const bool ); - bool ToActivate() const; - -private: - AIS_ListOfInteractive myObjects; // list of interactive objects - bool myToActivate; -}; - -#endif - - - - diff --git a/src/SOCC/SOCC_ViewModel.cxx b/src/SOCC/SOCC_ViewModel.cxx deleted file mode 100755 index de439dbcf..000000000 --- a/src/SOCC/SOCC_ViewModel.cxx +++ /dev/null @@ -1,702 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 "SOCC_ViewModel.h" - -#include "SOCC_Prs.h" -#include "SOCC_ViewWindow.h" - -#include "OCCViewer_Trihedron.h" - -#include "SUIT_Session.h" -#include "SUIT_ResourceMgr.h" -//#include "SUIT_Application.h" - -//#include "ToolsGUI.h" - -// Temporarily commented to avoid awful dependecy on SALOMEDS -// TODO: better mechanism of storing display/erse status in a study -// should be provided... -//#include -//#include CORBA_CLIENT_HEADER(SALOMEDS) - -#include -#include - -#include -#include -#include - -// Temporarily commented to avoid awful dependecy on SALOMEDS -// TODO: better mechanism of storing display/erse status in a study -// should be provided... -//#include -//#include -//#include -//#include - -//#include "SALOMEDSClient.hxx" -//#include "SALOMEDS_StudyManager.hxx" - -#include - -// in order NOT TO link with SalomeApp, here the code returns SALOMEDS_Study. -// SalomeApp_Study::studyDS() does it as well, but -- here it is retrieved from -// SALOMEDS::StudyManager - no linkage with SalomeApp. - -// Temporarily commented to avoid awful dependecy on SALOMEDS -// TODO: better mechanism of storing display/erse status in a study -// should be provided... -//static _PTR(Study) getStudyDS() -//{ -// SALOMEDSClient_Study* aStudy = NULL; -// _PTR(StudyManager) aMgr( new SALOMEDS_StudyManager() ); - - // get id of SUIT_Study, if it's a SalomeApp_Study, it will return - // id of its underlying SALOMEDS::Study -// SUIT_Application* app = SUIT_Session::session()->activeApplication(); -// if ( !app ) return _PTR(Study)(aStudy); -// SUIT_Study* stud = app->activeStudy(); -// if ( !stud ) return _PTR(Study)(aStudy); -// const int id = stud->id(); // virtual method, must return SALOMEDS_Study id - // get SALOMEDS_Study with this id from StudyMgr -// return aMgr->GetStudyByID( id ); -//} - -/*! - Constructor - \param DisplayTrihedron - is trihedron displayed -*/ -SOCC_Viewer::SOCC_Viewer( bool DisplayTrihedron ) -: OCCViewer_Viewer( DisplayTrihedron ) -{ -} - -/*! - Destructor -*/ -SOCC_Viewer::~SOCC_Viewer() -{ -} - -/*! - Hilights/unhilights object in viewer - \param obj - object to be updated - \param hilight - if it is true, object will be hilighted, otherwise it will be unhilighted - \param update - update current viewer -*/ -bool SOCC_Viewer::highlight( const Handle(SALOME_InteractiveObject)& obj, - bool hilight, bool upd ) -{ - bool isInLocal = getAISContext()->HasOpenedContext(); - //SUIT_Study* ActiveStudy = SUIT_Application::getDesktop()->getActiveStudy(); - //SALOME_Selection* Sel = SALOME_Selection::Selection( ActiveStudy->getSelection() ); - - AIS_ListOfInteractive List; - getAISContext()->DisplayedObjects(List); - - AIS_ListIteratorOfListOfInteractive ite(List); - for ( ; ite.More(); ite.Next() ) - { - Handle(SALOME_InteractiveObject) anObj = - Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() ); - - if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( obj ) ) - { - if ( !isInLocal ) - OCCViewer_Viewer::highlight( ite.Value(), hilight, false ); - // highlight subshapes only when local selection is active - else - { - /*if ( ite.Value()->IsKind( STANDARD_TYPE( SALOME_AISShape ) ) ) - { - Handle(SALOME_AISShape) aSh = Handle(SALOME_AISShape)::DownCast( ite.Value() ); - TColStd_IndexedMapOfInteger MapIndex; - Sel->GetIndex( IObject, MapIndex ); - aSh->highlightSubShapes( MapIndex, highlight ); - }*/ - } - break; - } - } - - if( upd ) - update(); - - return false; -} - -/*! - \return true if object is in viewer or in collector - \param obj - object to be checked - \param onlyInViewer - search object only in viewer (so object must be displayed) -*/ -bool SOCC_Viewer::isInViewer( const Handle(SALOME_InteractiveObject)& obj, - bool onlyInViewer ) -{ - AIS_ListOfInteractive List; - getAISContext()->DisplayedObjects(List); - - if( !onlyInViewer ) { - AIS_ListOfInteractive List1; - getAISContext()->ObjectsInCollector(List1); - List.Append(List1); - } - - AIS_ListIteratorOfListOfInteractive ite(List); - for ( ; ite.More(); ite.Next() ) - { - Handle(SALOME_InteractiveObject) anObj = - Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() ); - - if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( obj ) ) - return true; - } - return false; -} - -/*! - \return true if object is displayed in viewer - \param obj - object to be checked -*/ -bool SOCC_Viewer::isVisible( const Handle(SALOME_InteractiveObject)& obj ) -{ - AIS_ListOfInteractive List; - getAISContext()->DisplayedObjects( List ); - - AIS_ListIteratorOfListOfInteractive ite( List ); - for ( ; ite.More(); ite.Next() ) - { - Handle(SALOME_InteractiveObject) anObj = - Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() ); - - if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( obj ) ) - return getAISContext()->IsDisplayed( ite.Value() ); - } - - return false; -} - -/*! - Sets color of object - \param obj - object to be updated - \param color - new color - \param update - update current viewer -*/ -void SOCC_Viewer::setColor( const Handle(SALOME_InteractiveObject)& obj, - const QColor& color, bool update ) -{ - AIS_ListOfInteractive List; - getAISContext()->DisplayedObjects(List); - - AIS_ListIteratorOfListOfInteractive ite(List); - for ( ; ite.More(); ite.Next() ) - { - Handle(SALOME_InteractiveObject) anObj = - Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() ); - - if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( obj ) ) - { - OCCViewer_Viewer::setColor( ite.Value(), color, update ); - return; - } - } -} - -/*! - Changes display mode of object - \param obj - object to be processed - \param mode - new display mode - \param update - update current viewer -*/ -void SOCC_Viewer::switchRepresentation( const Handle(SALOME_InteractiveObject)& obj, - int mode, bool update ) -{ - AIS_ListOfInteractive List; - getAISContext()->DisplayedObjects(List); - - AIS_ListIteratorOfListOfInteractive ite(List); - for ( ; ite.More(); ite.Next() ) - { - Handle(SALOME_InteractiveObject) anObj = - Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() ); - - if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( obj ) ) - { - OCCViewer_Viewer::switchRepresentation( ite.Value(), mode, update ); - return; - } - } -} - -/*! - Changes transparency of object - \param obj - object to be processed - \param trans - new transparency - \param update - update current viewer -*/ -void SOCC_Viewer::setTransparency( const Handle(SALOME_InteractiveObject)& obj, - float trans, bool update ) -{ - AIS_ListOfInteractive List; - getAISContext()->DisplayedObjects( List ); - - AIS_ListIteratorOfListOfInteractive ite( List ); - for ( ; ite.More(); ite.Next() ) - { - Handle(SALOME_InteractiveObject) anObj = - Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() ); - - if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( obj ) ) - { - OCCViewer_Viewer::setTransparency( ite.Value(), trans, update ); - return; - } - } -} - -/*! - Changes name of object - \param obj - object to be renamed - \param name - new name -*/ -void SOCC_Viewer::rename( const Handle(SALOME_InteractiveObject)& obj, - const QString& name ) -{ - AIS_ListOfInteractive List; - getAISContext()->DisplayedObjects(List); - - AIS_ListIteratorOfListOfInteractive ite(List); - while (ite.More()) - { - if (ite.Value()->IsKind(STANDARD_TYPE(SALOME_AISShape))) - { - Handle(SALOME_AISShape) aSh = Handle(SALOME_AISShape)::DownCast(ite.Value()); - - if ( aSh->hasIO() ) - { - Handle(SALOME_InteractiveObject) IO = aSh->getIO(); - if ( IO->isSame( obj ) ) - { - aSh->setName( name.toLatin1().data() ); - break; - } - } - } - else if ( ite.Value()->IsKind( STANDARD_TYPE( SALOME_AISObject ) ) ) - { - Handle(SALOME_AISObject) aSh = Handle(SALOME_AISObject)::DownCast( ite.Value() ); - - // Add code here, if someone create a MODULE_AISObject. - } - ite.Next(); - } -} - - -/*! - Display presentation - \param prs - presentation -*/ -void SOCC_Viewer::Display( const SALOME_OCCPrs* prs ) -{ - // try do downcast object - const SOCC_Prs* anOCCPrs = dynamic_cast( prs ); - if ( !anOCCPrs || anOCCPrs->IsNull() ) - return; - - // get SALOMEDS Study - // Temporarily commented to avoid awful dependecy on SALOMEDS - // TODO: better mechanism of storing display/erse status in a study - // should be provided... - // _PTR(Study) study(getStudyDS()); - - // get context - Handle (AIS_InteractiveContext) ic = getAISContext(); - - // get all displayed objects - AIS_ListOfInteractive List; - ic->DisplayedObjects( List ); - // get objects in the collector - AIS_ListOfInteractive ListCollector; - ic->ObjectsInCollector( ListCollector ); - - // get objects to be displayed - AIS_ListOfInteractive anAISObjects; - anOCCPrs->GetObjects( anAISObjects ); - - AIS_ListIteratorOfListOfInteractive aIter( anAISObjects ); - for ( ; aIter.More(); aIter.Next() ) - { - Handle(AIS_InteractiveObject) anAIS = aIter.Value(); - if ( !anAIS.IsNull() ) - { - // try to find presentation in the viewer - bool bDisplayed = false; - AIS_ListIteratorOfListOfInteractive ite( List ); - for ( ; ite.More(); ite.Next() ) - { - // compare presentations by handles - // if the object is already displayed - nothing to do more - if ( ite.Value() == anAIS ) - { - // Deactivate object if necessary - if ( !anOCCPrs->ToActivate() ) - ic->Deactivate( anAIS ); - bDisplayed = true; - break; - } - } - - if ( bDisplayed ) - continue; - - // then try to find presentation in the collector - bDisplayed = false; - ite.Initialize( ListCollector ); - for ( ; ite.More(); ite.Next() ) - { - // compare presentations by handles - // if the object is in collector - display it - if ( ite.Value() == anAIS ) - { - ic->DisplayFromCollector( anAIS, false ); - - // Deactivate object if necessary - if ( !anOCCPrs->ToActivate() ) - ic->Deactivate( anAIS ); - bDisplayed = true; - - // Set visibility flag - // Temporarily commented to avoid awful dependecy on SALOMEDS - // TODO: better mechanism of storing display/erse status in a study - // should be provided... - //Handle(SALOME_InteractiveObject) anObj = - // Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() ); - //if ( !anObj.IsNull() && anObj->hasEntry() ) - //{ - // if ( study ) - // ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this ); - //} - break; - } - } - if ( bDisplayed ) - continue; - - // if object is not displayed and not found in the collector - display it - if ( anAIS->IsKind( STANDARD_TYPE(AIS_Trihedron) ) ) - { - Handle(AIS_Trihedron) aTrh = Handle(AIS_Trihedron)::DownCast( anAIS ); - double aNewSize = 100, aSize = 100; - getTrihedronSize( aNewSize, aSize ); - aTrh->SetSize( aTrh == getTrihedron() ? aNewSize : 0.5 * aNewSize ); - } - - ic->Display( anAIS, false ); - - // Set visibility flag - // Temporarily commented to avoid awful dependecy on SALOMEDS - // TODO: better mechanism of storing display/erse status in a study - // should be provided... - //Handle(SALOME_InteractiveObject) anObj = - // Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() ); - //if ( !anObj.IsNull() && anObj->hasEntry() ) - //{ - // if ( study ) - // ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this ); - //} - - // Deactivate object if necessary - if ( !anOCCPrs->ToActivate() ) - ic->Deactivate( anAIS ); - } - } -} - - -/*! - Erase presentation - \param prs - presentation - \param forced - removes object from context -*/ -void SOCC_Viewer::Erase( const SALOME_OCCPrs* prs, const bool forced ) -{ - // try do downcast object - const SOCC_Prs* anOCCPrs = dynamic_cast( prs ); - if ( !anOCCPrs || anOCCPrs->IsNull() ) - return; - - // get SALOMEDS Study - // Temporarily commented to avoid awful dependecy on SALOMEDS - // TODO: better mechanism of storing display/erse status in a study - // should be provided... - // _PTR(Study) study(getStudyDS()); - - // get context - Handle(AIS_InteractiveContext) ic = getAISContext(); - - // get objects to be erased - AIS_ListOfInteractive anAISObjects; - anOCCPrs->GetObjects( anAISObjects ); - - AIS_ListIteratorOfListOfInteractive aIter( anAISObjects ); - for ( ; aIter.More(); aIter.Next() ) { - Handle(AIS_InteractiveObject) anAIS = aIter.Value(); - if ( !anAIS.IsNull() ) { - // erase the object from context : move it to collector - ic->Erase( anAIS, false, forced ? false : true ); - - // Set visibility flag if necessary - // Temporarily commented to avoid awful dependecy on SALOMEDS - // TODO: better mechanism of storing display/erse status in a study - // should be provided... - //if ( !forced ) - //{ - // Handle(SALOME_InteractiveObject) anObj = - // Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() ); - // if ( !anObj.IsNull() && anObj->hasEntry() ) - // { - // if ( study ) - // ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this ); - // } - //} - } - } -} - - -/*! - Erase all presentations - \param forced - removes all objects from context -*/ -void SOCC_Viewer::EraseAll( const bool forced ) -{ - // get SALOMEDS Study - // Temporarily commented to avoid awful dependecy on SALOMEDS - // TODO: better mechanism of storing display/erse status in a study - // should be provided... - // _PTR(Study) study(getStudyDS()); - - // get context - Handle(AIS_InteractiveContext) ic = getAISContext(); - - // check if trihedron is displayed - Standard_Boolean isTrihedronDisplayed = ic->IsDisplayed( getTrihedron() ); - - // get objects to be erased (all currently displayed objects) - AIS_ListOfInteractive aList; - ic->DisplayedObjects( aList ); - AIS_ListIteratorOfListOfInteractive anIter( aList ); - for ( ; anIter.More(); anIter.Next() ) { - if ( isTrihedronDisplayed && anIter.Value()->DynamicType() == STANDARD_TYPE( AIS_Trihedron ) || - anIter.Value()->DynamicType() == STANDARD_TYPE( OCCViewer_Trihedron )) - continue; - - // erase an object - Handle(AIS_InteractiveObject) anIO = anIter.Value(); - ic->Erase( anIO, false, forced ? false : true ); - - // Set visibility flag if necessary - // Temporarily commented to avoid awful dependecy on SALOMEDS - // TODO: better mechanism of storing display/erse status in a study - // should be provided... - //if ( !forced ) { - // Handle(SALOME_InteractiveObject) anObj = - // Handle(SALOME_InteractiveObject)::DownCast( anIO->GetOwner() ); - - // if ( !anObj.IsNull() && anObj->hasEntry() ) { - // if ( study ) - // ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this ); - // } - //} - } - - Repaint(); -} - -/*! - Create presentation corresponding to the entry - \param entry - entry -*/ -SALOME_Prs* SOCC_Viewer::CreatePrs( const char* entry ) -{ - SOCC_Prs* prs = new SOCC_Prs(); - if ( entry ) - { - // get context - Handle(AIS_InteractiveContext) ic = getAISContext(); - - // get displayed objects - AIS_ListOfInteractive List; - ic->DisplayedObjects( List ); - // get objects in the collector - AIS_ListOfInteractive ListCollector; - ic->ObjectsInCollector( ListCollector ); - List.Append( ListCollector ); - - AIS_ListIteratorOfListOfInteractive ite( List ); - for ( ; ite.More(); ite.Next() ) - { - Handle(SALOME_InteractiveObject) anObj = - Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() ); - - if ( !anObj.IsNull() && anObj->hasEntry() && strcmp( anObj->getEntry(), entry ) == 0 ) - prs->AddObject( ite.Value() ); - } - } - return prs; -} - -/*! - Activates selection of sub shapes -*/ -void SOCC_Viewer::LocalSelection( const SALOME_OCCPrs* thePrs, const int theMode ) -{ - Handle(AIS_InteractiveContext) ic = getAISContext(); - - const SOCC_Prs* anOCCPrs = dynamic_cast( thePrs ); - if ( ic.IsNull() ) - return; - - // Open local context if there is no one - bool allObjects = thePrs == 0 || thePrs->IsNull(); - if ( !ic->HasOpenedContext() ) { - ic->ClearCurrents( false ); - ic->OpenLocalContext( allObjects, true, true ); - } - - AIS_ListOfInteractive anObjs; - // Get objects to be activated - if ( allObjects ) - ic->DisplayedObjects( anObjs ); - else - anOCCPrs->GetObjects( anObjs ); - - // Activate selection of objects from prs - AIS_ListIteratorOfListOfInteractive aIter( anObjs ); - for ( ; aIter.More(); aIter.Next() ) { - Handle(AIS_InteractiveObject) anAIS = aIter.Value(); - if ( !anAIS.IsNull() ) - { - if ( anAIS->IsKind( STANDARD_TYPE( AIS_Shape ) ) ) - { - ic->Load( anAIS, -1, false ); - ic->Activate( anAIS, AIS_Shape::SelectionMode( (TopAbs_ShapeEnum)theMode ) ); - } - else if ( anAIS->DynamicType() != STANDARD_TYPE(AIS_Trihedron) ) - { - ic->Load( anAIS, -1, false ); - ic->Activate( anAIS, theMode ); - } - } - } -} - -/*! - Deactivates selection of sub shapes -*/ -void SOCC_Viewer::GlobalSelection( const bool update ) const -{ - Handle(AIS_InteractiveContext) ic = getAISContext(); - if ( !ic.IsNull() ) - { - ic->CloseAllContexts( false ); - if ( update ) - ic->CurrentViewer()->Redraw(); - } -} - -/*! - Auxiliary method called before displaying of objects -*/ -void SOCC_Viewer::BeforeDisplay( SALOME_Displayer* d ) -{ - d->BeforeDisplay( this, SALOME_OCCViewType() ); -} - -/*! - Auxiliary method called after displaying of objects -*/ -void SOCC_Viewer::AfterDisplay( SALOME_Displayer* d ) -{ - d->AfterDisplay( this, SALOME_OCCViewType() ); -} - -/*! - Get new and current trihedron size corresponding to the current model size -*/ -bool SOCC_Viewer::getTrihedronSize( double& theNewSize, double& theSize ) -{ - theNewSize = 100; - theSize = 100; - - //SRN: BUG IPAL8996, a usage of method ActiveView without an initialization - Handle(V3d_Viewer) viewer = getViewer3d(); - viewer->InitActiveViews(); - if(!viewer->MoreActiveViews()) return false; - - Handle(V3d_View) view3d = viewer->ActiveView(); - //SRN: END of fix - - if ( view3d.IsNull() ) - return false; - - double Xmin = 0, Ymin = 0, Zmin = 0, Xmax = 0, Ymax = 0, Zmax = 0; - double aMaxSide; - - view3d->View()->MinMaxValues( Xmin, Ymin, Zmin, Xmax, Ymax, Zmax ); - - if ( Xmin == RealFirst() || Ymin == RealFirst() || Zmin == RealFirst() || - Xmax == RealLast() || Ymax == RealLast() || Zmax == RealLast() ) - return false; - - aMaxSide = Xmax - Xmin; - if ( aMaxSide < Ymax -Ymin ) aMaxSide = Ymax -Ymin; - if ( aMaxSide < Zmax -Zmin ) aMaxSide = Zmax -Zmin; - - float aSizeInPercents = SUIT_Session::session()->resourceMgr()->doubleValue("Viewer","TrihedronSize", 105.); - - static float EPS = 5.0E-3; - theSize = getTrihedron()->Size(); - theNewSize = aMaxSide*aSizeInPercents / 100.0; - - return fabs( theNewSize - theSize ) > theSize * EPS || - fabs( theNewSize - theSize) > theNewSize * EPS; -} - - -/*! - Updates current viewer -*/ -void SOCC_Viewer::Repaint() -{ -// onAdjustTrihedron(); - getViewer3d()->Update(); -} - - -/*! - create SOCC_ViewWindow -*/ -SUIT_ViewWindow* SOCC_Viewer::createView( SUIT_Desktop* theDesktop ) -{ - SOCC_ViewWindow* view = new SOCC_ViewWindow(theDesktop, this); - initView( view ); - return view; -} diff --git a/src/SOCC/SOCC_ViewModel.h b/src/SOCC/SOCC_ViewModel.h deleted file mode 100755 index 792616a62..000000000 --- a/src/SOCC/SOCC_ViewModel.h +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 SOCC_VIEWMODEL_H -#define SOCC_VIEWMODEL_H - -#ifdef WIN32 -#pragma warning( disable:4251 ) -#endif - -#include "SOCC.h" -#include "SALOME_Prs.h" -#include "OCCViewer_ViewModel.h" - -class Handle(SALOME_InteractiveObject); - -class SOCC_EXPORT SOCC_Viewer: public OCCViewer_Viewer, public SALOME_View -{ - Q_OBJECT - -public: - SOCC_Viewer( bool DisplayTrihedron = true ); - virtual ~SOCC_Viewer(); - - /* Selection management */ - bool highlight( const Handle(SALOME_InteractiveObject)&, bool, bool=true ); - bool isInViewer( const Handle(SALOME_InteractiveObject)&, bool=false ); - - void setColor( const Handle(SALOME_InteractiveObject)&, const QColor&, bool=true ); - void switchRepresentation( const Handle(SALOME_InteractiveObject)&, int, bool=true ); - void setTransparency( const Handle(SALOME_InteractiveObject)&, float, bool=true ); - - void rename( const Handle(SALOME_InteractiveObject)&, const QString& ); - - virtual SUIT_ViewWindow* createView(SUIT_Desktop* theDesktop); - - /* Reimplemented from SALOME_View */ - virtual void Display( const SALOME_OCCPrs* ); - virtual void Erase( const SALOME_OCCPrs*, const bool = false ); - virtual void EraseAll( const bool = false ); - virtual SALOME_Prs* CreatePrs( const char* entry = 0 ); - virtual void BeforeDisplay( SALOME_Displayer* d ); - virtual void AfterDisplay ( SALOME_Displayer* d ); - virtual void LocalSelection( const SALOME_OCCPrs*, const int ); - virtual void GlobalSelection( const bool = false ) const; - virtual bool isVisible( const Handle(SALOME_InteractiveObject)& ); - virtual void Repaint(); - - // a utility function, used by SALOME_View_s methods - bool getTrihedronSize( double& theNewSize, double& theSize ); - -}; - -#ifdef WIN32 -#pragma warning( default:4251 ) -#endif - -#endif diff --git a/src/SOCC/SOCC_ViewWindow.cxx b/src/SOCC/SOCC_ViewWindow.cxx deleted file mode 100644 index d7c4edb81..000000000 --- a/src/SOCC/SOCC_ViewWindow.cxx +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 "SOCC_ViewWindow.h" - -#include "OCCViewer_ViewPort3d.h" - -#include "SUIT_Accel.h" - -/*! - Constructor -*/ -SOCC_ViewWindow -::SOCC_ViewWindow( SUIT_Desktop* theDesktop, - OCCViewer_Viewer* theModel) - : OCCViewer_ViewWindow( theDesktop, theModel ) -{ -} - -/*! - Destructor -*/ -SOCC_ViewWindow -::~SOCC_ViewWindow() -{ -} - -/*! - Performs action - \param theAction - type of action -*/ -bool -SOCC_ViewWindow -::action( const int theAction ) -{ - const int inc = 10; - int cx, cy; - if ( theAction == SUIT_Accel::ZoomIn || theAction == SUIT_Accel::ZoomOut || - theAction == SUIT_Accel::RotateLeft || theAction == SUIT_Accel::RotateRight || - theAction == SUIT_Accel::RotateUp || theAction == SUIT_Accel::RotateDown ) { - cx = myViewPort->width() / 2; - cy = myViewPort->height() / 2; - } - switch ( theAction ) { - case SUIT_Accel::PanLeft : - myViewPort->pan( -inc, 0 ); - break; - case SUIT_Accel::PanRight : - myViewPort->pan( inc, 0 ); - break; - case SUIT_Accel::PanUp : - myViewPort->pan( 0, inc ); - break; - case SUIT_Accel::PanDown : - myViewPort->pan( 0, -inc ); - break; - case SUIT_Accel::ZoomIn : - myViewPort->zoom( cx, cy, cx + inc, cy + inc ); - break; - case SUIT_Accel::ZoomOut : - myViewPort->zoom( cx, cy, cx - inc, cy - inc ); - break; - case SUIT_Accel::ZoomFit : - myViewPort->fitAll(); - break; - case SUIT_Accel::RotateLeft : - myViewPort->startRotation( cx, cy, myCurrPointType, mySelectedPoint ); - myViewPort->rotate( cx - inc, cy, myCurrPointType, mySelectedPoint ); - myViewPort->endRotation(); - break; - case SUIT_Accel::RotateRight : - myViewPort->startRotation( cx, cy, myCurrPointType, mySelectedPoint ); - myViewPort->rotate( cx + inc, cy, myCurrPointType, mySelectedPoint ); - myViewPort->endRotation(); - break; - case SUIT_Accel::RotateUp : - myViewPort->startRotation( cx, cy, myCurrPointType, mySelectedPoint ); - myViewPort->rotate( cx, cy - inc, myCurrPointType, mySelectedPoint ); - myViewPort->endRotation(); - break; - case SUIT_Accel::RotateDown : - myViewPort->startRotation( cx, cy, myCurrPointType, mySelectedPoint ); - myViewPort->rotate( cx, cy + inc, myCurrPointType, mySelectedPoint ); - myViewPort->endRotation(); - break; - } - return true; -} diff --git a/src/SOCC/SOCC_ViewWindow.h b/src/SOCC/SOCC_ViewWindow.h deleted file mode 100644 index e30afe511..000000000 --- a/src/SOCC/SOCC_ViewWindow.h +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 SOCC_VIEWWINDOW_H -#define SOCC_VIEWWINDOW_H - -#ifdef WIN32 -#pragma warning( disable:4251 ) -#endif - -#include "SOCC.h" -#include "OCCViewer_ViewWindow.h" - -class SOCC_EXPORT SOCC_ViewWindow : public OCCViewer_ViewWindow -{ - Q_OBJECT; - -public: - SOCC_ViewWindow( SUIT_Desktop*, OCCViewer_Viewer* ); - virtual ~SOCC_ViewWindow(); - -protected: - virtual bool action( const int ); - -}; - -#ifdef WIN32 -#pragma warning( default:4251 ) -#endif - -#endif diff --git a/src/SUPERVGraph/Makefile.am b/src/SUPERVGraph/Makefile.am deleted file mode 100755 index 0ed26687b..000000000 --- a/src/SUPERVGraph/Makefile.am +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms 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 $(top_srcdir)/adm_local/unix/make_common_starter.am - -lib_LTLIBRARIES = libSUPERVGraph.la - -salomeinclude_HEADERS= \ - SUPERVGraph_ViewFrame.h \ - SUPERVGraph_ViewManager.h \ - SUPERVGraph_ViewModel.h \ - SUPERVGraph.h - -dist_libSUPERVGraph_la_SOURCES= \ - SUPERVGraph.cxx \ - SUPERVGraph_ViewFrame.cxx \ - SUPERVGraph_ViewManager.cxx \ - SUPERVGraph_ViewModel.cxx - -MOC_FILES= \ - SUPERVGraph_moc.cxx \ - SUPERVGraph_ViewFrame_moc.cxx \ - SUPERVGraph_ViewManager_moc.cxx \ - SUPERVGraph_ViewModel_moc.cxx -nodist_libSUPERVGraph_la_SOURCES= $(MOC_FILES) - -dist_salomeres_DATA= \ - resources/superv_view_pan.png \ - resources/superv_view_reset.png - -nodist_salomeres_DATA= \ - SUPERVGraph_images.qm \ - SUPERVGraph_msg_en.qm - -libSUPERVGraph_la_CPPFLAGS=$(QT_INCLUDES) $(CAS_CPPFLAGS) $(PYTHON_INCLUDES) $(BOOST_CPPFLAGS) \ - -I$(srcdir)/../Qtx -I$(srcdir)/../SUIT -I$(srcdir)/../OBJECT -libSUPERVGraph_la_LDFLAGS=$(QT_MT_LIBS) ../SUIT/libsuit.la diff --git a/src/SUPERVGraph/SUPERVGraph.cxx b/src/SUPERVGraph/SUPERVGraph.cxx deleted file mode 100755 index 041a680cd..000000000 --- a/src/SUPERVGraph/SUPERVGraph.cxx +++ /dev/null @@ -1,54 +0,0 @@ -// SALOME SUPERVGraph : build Supervisor viewer into desktop -// -// 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 : SUPERVGraph.cxx -// Author : Nicolas REJNERI -// Module : SALOME -// $Header$ - -#include "SUPERVGraph.h" -#include "SUPERVGraph_ViewFrame.h" - -#include "SUIT_Desktop.h" -#include "SUIT_ViewWindow.h" - -using namespace std; - -/*! - Creates view -*/ -SUIT_ViewWindow* SUPERVGraph::createView(SUIT_Desktop* parent) -{ - return new SUPERVGraph_ViewFrame( parent ); -} - -extern "C" -{ - /*! - Creates view - */ - SUIT_ViewWindow* createView(SUIT_Desktop* parent) - { - return SUPERVGraph::createView(parent); - } -} diff --git a/src/SUPERVGraph/SUPERVGraph.h b/src/SUPERVGraph/SUPERVGraph.h deleted file mode 100755 index 1aebcc100..000000000 --- a/src/SUPERVGraph/SUPERVGraph.h +++ /dev/null @@ -1,61 +0,0 @@ -// SALOME SUPERVGraph : build Supervisor viewer into desktop -// -// 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 : SUPERVGraph.h -// Author : Nicolas REJNERI -// Module : SALOME -// $Header$ - -#ifndef SUPERVGraph_HeaderFile -#define SUPERVGraph_HeaderFile - -#ifdef WIN32 -#ifdef SUPERVGRAPH_EXPORTS -#define SUPERVGRAPH_EXPORT __declspec(dllexport) -#else -#define SUPERVGRAPH_EXPORT __declspec(dllimport) -#endif -#else -#define SUPERVGRAPH_EXPORT -#endif - -#if defined WIN32 -#pragma warning ( disable: 4251 ) -#endif - -#include - -class SUIT_Desktop; -class SUIT_ViewWindow; - -class SUPERVGRAPH_EXPORT SUPERVGraph : public QObject -{ - Q_OBJECT - -public : - - static SUIT_ViewWindow* createView ( SUIT_Desktop* parent); - -}; - -#endif diff --git a/src/SUPERVGraph/SUPERVGraph.pro b/src/SUPERVGraph/SUPERVGraph.pro deleted file mode 100644 index a83a0451a..000000000 --- a/src/SUPERVGraph/SUPERVGraph.pro +++ /dev/null @@ -1,49 +0,0 @@ -TEMPLATE = lib -TARGET = SUPERVGraph -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -QT_INCLUDES = $$(QTDIR)/include $$(QTDIR)/include/QtCore $$(QTDIR)/include/QtGui $$(QTDIR)/include/QtOpenGL $$(QTDIR)/include/QtXml - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -PYTHON_INCLUDES = $$(PYTHONHOME)/include/python2.4 - -BOOST_CPPFLAGS = $$(BOOSTDIR)/include - -QT_MT_LIBS = -L$$(QTDIR)/lib -lQtCore -lQtXml -lQtGui -lQtOpenGL - -INCLUDEPATH += $${QT_INCLUDES} $${CAS_CPPFLAGS} $${PYTHON_INCLUDES} $${BOOST_CPPFLAGS} ../Qtx ../SUIT ../OBJECT - -LIBS += $${QT_MT_LIBS} -L../../lib -lsuit - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += SUPERVGRAPH_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS - -HEADERS = SUPERVGraph_ViewFrame.h -HEADERS += SUPERVGraph_ViewManager.h -HEADERS += SUPERVGraph_ViewModel.h -HEADERS += SUPERVGraph.h - -SOURCES = SUPERVGraph.cxx -SOURCES += SUPERVGraph_ViewFrame.cxx -SOURCES += SUPERVGraph_ViewManager.cxx -SOURCES += SUPERVGraph_ViewModel.cxx - -TRANSLATIONS = resources/SUPERVGraph_images.ts \ - resources/SUPERVGraph_msg_en.ts - -ICONS = resources/*.png - -includes.files = $$HEADERS -includes.path = ../../include - -resources.files = $$ICONS resources/*.qm -resources.path = ../../resources - -INSTALLS += includes resources diff --git a/src/SUPERVGraph/SUPERVGraph_ViewFrame.cxx b/src/SUPERVGraph/SUPERVGraph_ViewFrame.cxx deleted file mode 100755 index d61e9e5d4..000000000 --- a/src/SUPERVGraph/SUPERVGraph_ViewFrame.cxx +++ /dev/null @@ -1,365 +0,0 @@ -// SALOME SUPERVGraph : build Supervisor viewer into desktop -// -// 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 : SUPERVGraph_ViewFrame.cxx -// Author : Nicolas REJNERI -// Module : SALOME -// $Header$ - -#include "SUPERVGraph_ViewFrame.h" - -#include -#include - -//QT Include -#include -#include - -using namespace std; - - -/*! - Constructor -*/ -SUPERVGraph_View::SUPERVGraph_View( QWidget* theParent ): QWidget( theParent ) -{ - init(theParent); -} - -/*! - Constructor -*/ -SUPERVGraph_View::SUPERVGraph_View( SUPERVGraph_View* theParent ): QWidget( theParent ) -{ - init(theParent); -} - -/*! - Builds popup for SUPERVGraph viewer -*/ -void SUPERVGraph_View::contextMenuPopup( QMenu* ) -{ - // to be implemented -} - -/*! - Initialization -*/ -void SUPERVGraph_View::init( QWidget* theParent ) -{ - if ( theParent->inherits( "QMainWindow" ) ) { - ( ( QMainWindow* )theParent )->setCentralWidget( this ); - } - else { - QBoxLayout* layout = new QVBoxLayout( theParent ); - layout->addWidget( this ); - } - -} - -/*! - Constructor -*/ -SUPERVGraph_ViewFrame::SUPERVGraph_ViewFrame( SUIT_Desktop* theDesktop ) - : SUIT_ViewWindow( theDesktop ) -{ - myView = 0; - - //myView = new SUPERVGraph_View(this); - // Set BackgroundColor - /* - int R = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorRed").toInt(); - int G = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorGreen").toInt(); - int B = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorBlue").toInt(); - setBackgroundColor(QColor(R,G,B));*/ - - myToolBar = new QToolBar(this); - //myToolBar->setCloseMode(QDockWindow::Undocked); - myToolBar->setWindowTitle(tr("LBL_TOOLBAR_LABEL")); - createActions(); - createToolBar(); -} - -/*! - Creates actions of SUPERVGraph view window -*/ -void SUPERVGraph_ViewFrame::createActions() -{ - if (!myActionsMap.isEmpty()) return; - SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); - QtxAction* aAction; - - // Panning - aAction = new QtxAction(tr("MNU_PAN_VIEW"), aResMgr->loadPixmap( "SUPERVGraph", tr( "ICON_SUPERVGraph_PAN" ) ), - tr( "MNU_PAN_VIEW" ), 0, this); - aAction->setStatusTip(tr("DSC_PAN_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onViewPan())); - myActionsMap[ PanId ] = aAction; - - // Reset - aAction = new QtxAction(tr("MNU_RESET_VIEW"), aResMgr->loadPixmap( "SUPERVGraph", tr( "ICON_SUPERVGraph_RESET" ) ), - tr( "MNU_RESET_VIEW" ), 0, this); - aAction->setStatusTip(tr("DSC_RESET_VIEW")); - connect(aAction, SIGNAL(activated()), this, SLOT(onViewReset())); - myActionsMap[ ResetId ] = aAction; -} - -/*! - Creates toolbar of SUPERVGraph view window -*/ -void SUPERVGraph_ViewFrame::createToolBar() -{ - myToolBar->addAction( myActionsMap[PanId] ); - myToolBar->addAction( myActionsMap[ResetId] ); -} - -/*! - Destructor -*/ -SUPERVGraph_ViewFrame::~SUPERVGraph_ViewFrame() {} - -/*! - Returns widget containing 3D-Viewer -*/ -SUPERVGraph_View* SUPERVGraph_ViewFrame::getViewWidget() -{ - return myView; -} - - -/*! - Sets new view widget - \param theView - new view widget -*/ -void SUPERVGraph_ViewFrame::setViewWidget( SUPERVGraph_View* theView ) -{ - myView = theView; -} - - -/*! - Display/hide Trihedron -*/ -void SUPERVGraph_ViewFrame::onViewTrihedron() -{ -// MESSAGE ( "SUPERVGraph_ViewFrame::onViewTrihedron" ) -} - -/*! - Provides top projection of the active view -*/ -void SUPERVGraph_ViewFrame::onViewTop() -{ -// MESSAGE ( "SUPERVGraph_ViewFrame::onViewTop" ) -} - -/*! - Provides bottom projection of the active view -*/ -void SUPERVGraph_ViewFrame::onViewBottom() -{ -// MESSAGE ( "SUPERVGraph_ViewFrame::onViewBottom" ) -} - -/*! - Provides left projection of the active view -*/ -void SUPERVGraph_ViewFrame::onViewLeft() -{ -// MESSAGE ( "SUPERVGraph_ViewFrame::onViewLeft" ) -} - -/*! - Provides right projection of the active view -*/ -void SUPERVGraph_ViewFrame::onViewRight() -{ -// MESSAGE ( "SUPERVGraph_ViewFrame::onViewRight" ) -} - -/*! - Provides back projection of the active view -*/ -void SUPERVGraph_ViewFrame::onViewBack() -{ -// MESSAGE ( "SUPERVGraph_ViewFrame::onViewBack" ) -} - -/*! - Provides front projection of the active view -*/ -void SUPERVGraph_ViewFrame::onViewFront() -{ -// MESSAGE ( "SUPERVGraph_ViewFrame::onViewFront" ) -} - -/*! - Reset the active view -*/ -void SUPERVGraph_ViewFrame::onViewReset() -{ -// MESSAGE ( "SUPERVGraph_ViewFrame::onViewReset" ) - if (myView) - myView->ResetView(); -} - -/*! - Rotates the active view -*/ -void SUPERVGraph_ViewFrame::onViewRotate() -{ -// MESSAGE ( "SUPERVGraph_ViewFrame::onViewRotate" ) -} - -/*! - Sets a new center of the active view -*/ -void SUPERVGraph_ViewFrame::onViewGlobalPan() -{ -// MESSAGE ( "SUPERVGraph_ViewFrame::onViewGlobalPan" ) -} - -/*! - Zooms the active view -*/ -void SUPERVGraph_ViewFrame::onViewZoom() -{ -// MESSAGE ( "SUPERVGraph_ViewFrame::onViewZoom" ) -} - -/*! - Moves the active view -*/ -void SUPERVGraph_ViewFrame::onViewPan() -{ -// MESSAGE ( "SUPERVGraph_ViewFrame::onViewPan" ) - if (myView != NULL) - myView->ActivatePanning(); -} - -/*! - Fits all obejcts within a rectangular area of the active view -*/ -void SUPERVGraph_ViewFrame::onViewFitArea() -{ -// MESSAGE ( "SUPERVGraph_ViewFrame::onViewFitArea" ) -} - -/*! - Fits all objects in the active view -*/ -void SUPERVGraph_ViewFrame::onViewFitAll() -{ -// MESSAGE ( "SUPERVGraph_ViewFrame::onViewFitAll" ) -} - -/*! - Set background of the viewport -*/ -void SUPERVGraph_ViewFrame::setBackgroundColor( const QColor& color ) -{ - if (myView) { - QPalette palette; - palette.setColor(myView->backgroundRole(), color); - myView->setPalette(palette); - } -} - -/*! - Returns background of the viewport -*/ -QColor SUPERVGraph_ViewFrame::backgroundColor() const -{ - if (myView) - return myView->palette().color( myView->backgroundRole() ); - return palette().color( backgroundRole() ); -} - -/*! -*/ -void SUPERVGraph_ViewFrame::onAdjustTrihedron() -{ -// MESSAGE ( "SUPERVGraph_ViewFrame::onAdjustTrihedron" ) -} - -/*! - Changes name of object - \param obj - object to be renamed - \param name - new name -*/ -void SUPERVGraph_ViewFrame::rename( const Handle(SALOME_InteractiveObject)& IObject, - QString newName ) -{ -// MESSAGE ( "SUPERVGraph_ViewFrame::rename" ) -} - -/*! - Unhilights all object in viewer - \param updateviewer - update current viewer -*/ -void SUPERVGraph_ViewFrame::unHighlightAll() -{ -// MESSAGE ( "SUPERVGraph_ViewFrame::unHighlightAll" ) -} - -/*! - Hilights/unhilights object in viewer - \param obj - object to be updated - \param hilight - if it is true, object will be hilighted, otherwise it will be unhilighted - \param update - update current viewer -*/ -void SUPERVGraph_ViewFrame::highlight( const Handle(SALOME_InteractiveObject)& IObject, - bool highlight, bool immediatly ) -{ -// MESSAGE ( "SUPERVGraph_ViewFrame::highlight" ) -} - -/*! - \return true if object is in viewer or in collector - \param obj - object to be checked - \param onlyInViewer - search object only in viewer (so object must be displayed) -*/ -bool SUPERVGraph_ViewFrame::isInViewer( const Handle(SALOME_InteractiveObject)& IObject ) -{ -// MESSAGE ( "SUPERVGraph_ViewFrame::isInViewer" ) - return false; -} - -/*! - \return true if object is displayed in viewer - \param obj - object to be checked -*/ -bool SUPERVGraph_ViewFrame::isVisible( const Handle(SALOME_InteractiveObject)& IObject ) -{ -// MESSAGE ( "SUPERVGraph_ViewFrame::isVisible" ) - return false; -} - -/*! - Custom resize event handler -*/ -void SUPERVGraph_ViewFrame::resizeEvent( QResizeEvent* theEvent ) -{ - QMainWindow::resizeEvent( theEvent ); - if ( myView ) myView->resizeView( theEvent ); -} diff --git a/src/SUPERVGraph/SUPERVGraph_ViewFrame.h b/src/SUPERVGraph/SUPERVGraph_ViewFrame.h deleted file mode 100755 index be33df74d..000000000 --- a/src/SUPERVGraph/SUPERVGraph_ViewFrame.h +++ /dev/null @@ -1,140 +0,0 @@ -// SALOME SUPERVGraph : build Supervisor viewer into desktop -// -// 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 : SUPERVGraph_ViewFrame.h -// Author : Nicolas REJNERI -// Module : SALOME -// $Header$ - -#ifndef SUPERVGraph_ViewFrame_H -#define SUPERVGraph_ViewFrame_H - -#include "SUPERVGraph.h" - -#include "SALOME_InteractiveObject.hxx" -#include "SUIT_PopupClient.h" -#include "SUIT_ViewWindow.h" - -#include - -#ifdef WIN32 -#pragma warning ( disable:4251 ) -#endif - -class SUPERVGRAPH_EXPORT SUPERVGraph_View: public QWidget, public SUIT_PopupClient { - Q_OBJECT; - public: - static QString Type() { return "SUPERVGraphViewer"; } - - SUPERVGraph_View(QWidget* theParent); - SUPERVGraph_View(SUPERVGraph_View* theParent); - - virtual void ActivatePanning() = 0; - virtual void ResetView() = 0; - - /* redefine functions from SUIT_PopupClient */ - virtual QString popupClientType() const { return Type(); } - virtual void contextMenuPopup( QMenu* ); - - virtual void resizeView( QResizeEvent* theEvent ) {}; - - protected: - void init(QWidget* theParent); - -}; - -class SUPERVGRAPH_EXPORT SUPERVGraph_ViewFrame : public SUIT_ViewWindow { - Q_OBJECT - - public: - SUPERVGraph_ViewFrame(SUIT_Desktop* theDesktop ); - ~SUPERVGraph_ViewFrame(); - - SUPERVGraph_View* getViewWidget(); - void setViewWidget(SUPERVGraph_View* theView); - - void setBackgroundColor( const QColor& ); - QColor backgroundColor() const; - - void onAdjustTrihedron( ); - - /* interactive object management */ - void highlight( const Handle(SALOME_InteractiveObject)& IObject, - bool highlight, bool immediatly = true ); - void unHighlightAll(); - void rename( const Handle(SALOME_InteractiveObject)& IObject, - QString newName ); - bool isInViewer( const Handle(SALOME_InteractiveObject)& IObject ); - bool isVisible( const Handle(SALOME_InteractiveObject)& IObject ); - - /* selection */ - Handle(SALOME_InteractiveObject) FindIObject(const char* Entry) { Handle(SALOME_InteractiveObject) o; return o; }; - - /* display */ - void Display(const Handle(SALOME_InteractiveObject)& IObject, bool immediatly = true){}; - void DisplayOnly(const Handle(SALOME_InteractiveObject)& IObject){}; - void Erase(const Handle(SALOME_InteractiveObject)& IObject, bool immediatly = true){}; - void DisplayAll(){}; - void EraseAll(){}; - void Repaint() {}; - - QToolBar* getToolBar() { return myToolBar; } - - public slots: - void onViewPan(); - void onViewZoom(); - void onViewFitAll(); - void onViewFitArea(); - void onViewGlobalPan(); - void onViewRotate(); - void onViewReset(); - void onViewFront(); - void onViewBack(); - void onViewRight(); - void onViewLeft(); - void onViewBottom(); - void onViewTop(); - void onViewTrihedron(); - - protected: - void resizeEvent( QResizeEvent* theEvent ); - - private: - void createActions(); - void createToolBar(); - - //! Actions ID - enum { PanId, ResetId }; - typedef QMap ActionsMap; - - ActionsMap myActionsMap; - QToolBar* myToolBar; - - SUPERVGraph_View* myView; -}; - -#ifdef WIN32 -#pragma warning ( default:4251 ) -#endif - -#endif diff --git a/src/SUPERVGraph/SUPERVGraph_ViewManager.cxx b/src/SUPERVGraph/SUPERVGraph_ViewManager.cxx deleted file mode 100644 index e2ae70d27..000000000 --- a/src/SUPERVGraph/SUPERVGraph_ViewManager.cxx +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 "SUPERVGraph_ViewManager.h" - -#include "SUIT_ViewWindow.h" - -int SUPERVGraph_ViewManager::myMaxId = 0; - -/*! - Constructor -*/ -SUPERVGraph_ViewManager::SUPERVGraph_ViewManager( SUIT_Study* theStudy, - SUIT_Desktop* theDesktop, - SUIT_ViewModel* theViewModel ) - : SUIT_ViewManager( theStudy, theDesktop, theViewModel ) -{ - myId = ++myMaxId; -} - -/*! - Destructor -*/ -SUPERVGraph_ViewManager::~SUPERVGraph_ViewManager() -{ -} - -/*! - Sets view name - \param theView - view to assign name -*/ -void SUPERVGraph_ViewManager::setViewName(SUIT_ViewWindow* theView) -{ - int aPos = myViews.indexOf(theView); - theView->setWindowTitle( QString( "SUPERVISION scene:%1 - viewer:%2" ).arg( myId ).arg(aPos+1)); -} - -/*! - Fills popup menu with custom actions - \param popup - popup menu to be filled with -*/ -void SUPERVGraph_ViewManager::contextMenuPopup( QMenu* thePopup) -{ - SUIT_ViewManager::contextMenuPopup( thePopup ); - // to be implemented -} diff --git a/src/SUPERVGraph/SUPERVGraph_ViewManager.h b/src/SUPERVGraph/SUPERVGraph_ViewManager.h deleted file mode 100644 index 313beca3b..000000000 --- a/src/SUPERVGraph/SUPERVGraph_ViewManager.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 SUPERVGRAPH_VIEWMANAGER_H -#define SUPERVGRAPH_VIEWMANAGER_H - -#include "SUPERVGraph.h" - -#include "SUIT_ViewManager.h" - -class SUIT_Desktop; - -class SUPERVGRAPH_EXPORT SUPERVGraph_ViewManager : public SUIT_ViewManager -{ - Q_OBJECT - -public: - SUPERVGraph_ViewManager( SUIT_Study* theStudy, SUIT_Desktop* theDesktop, SUIT_ViewModel* theViewModel = 0 ); - ~SUPERVGraph_ViewManager(); - - virtual void contextMenuPopup( QMenu* thePopup ); - -protected: - void setViewName(SUIT_ViewWindow* theView); - -private: - static int myMaxId; - int myId; - -}; - -#endif diff --git a/src/SUPERVGraph/SUPERVGraph_ViewModel.cxx b/src/SUPERVGraph/SUPERVGraph_ViewModel.cxx deleted file mode 100644 index a9911da3e..000000000 --- a/src/SUPERVGraph/SUPERVGraph_ViewModel.cxx +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 "SUPERVGraph_ViewModel.h" -#include "SUPERVGraph_ViewFrame.h" -#include "SUIT_Desktop.h" -#include "SUIT_ViewWindow.h" - -/*! - Constructor -*/ -SUPERVGraph_Viewer::SUPERVGraph_Viewer() -:SUIT_ViewModel() -{ -} - -/*! - Destructor -*/ -SUPERVGraph_Viewer::~SUPERVGraph_Viewer() -{ -} - -/*! - Creates new view window - \param theDesktop - main window of application -*/ -SUIT_ViewWindow* SUPERVGraph_Viewer::createView(SUIT_Desktop* theDesktop) -{ - SUPERVGraph_ViewFrame* aRes = new SUPERVGraph_ViewFrame( theDesktop ); - return aRes; -} diff --git a/src/SUPERVGraph/SUPERVGraph_ViewModel.h b/src/SUPERVGraph/SUPERVGraph_ViewModel.h deleted file mode 100644 index 9de2ffa50..000000000 --- a/src/SUPERVGraph/SUPERVGraph_ViewModel.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 SUPERVGRAPH_VIEWMODEL_H -#define SUPERVGRAPH_VIEWMODEL_H - -#include "SUPERVGraph.h" - -#include "SUIT_ViewModel.h" - -class SUPERVGRAPH_EXPORT SUPERVGraph_Viewer: public SUIT_ViewModel -{ - Q_OBJECT - -public: - static QString Type() { return "SUPERVGraphViewer"; } - - SUPERVGraph_Viewer(); - virtual ~SUPERVGraph_Viewer(); - - virtual SUIT_ViewWindow* createView(SUIT_Desktop* theDesktop); - virtual QString getType() const { return Type(); } - -}; - -#endif diff --git a/src/SUPERVGraph/resources/SUPERVGraph_images.po b/src/SUPERVGraph/resources/SUPERVGraph_images.po deleted file mode 100644 index 97cab3fd6..000000000 --- a/src/SUPERVGraph/resources/SUPERVGraph_images.po +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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: SUPERVGraph_images.po -// Created: 11/22/2005 10:52:37 PM -// Author: Margarita Karpunina -// Copyright (C) CEA 2005 - -msgid "ICON_SUPERVGraph_PAN" -msgstr "view_pan.png" - -msgid "ICON_SUPERVGraph_RESET" -msgstr "view_reset.png" - diff --git a/src/SUPERVGraph/resources/SUPERVGraph_images.ts b/src/SUPERVGraph/resources/SUPERVGraph_images.ts deleted file mode 100644 index 898af1ea7..000000000 --- a/src/SUPERVGraph/resources/SUPERVGraph_images.ts +++ /dev/null @@ -1,13 +0,0 @@ - - - @default - - ICON_SUPERVGraph_PAN - superv_view_pan.png - - - ICON_SUPERVGraph_RESET - superv_view_reset.png - - - diff --git a/src/SUPERVGraph/resources/SUPERVGraph_msg_en.po b/src/SUPERVGraph/resources/SUPERVGraph_msg_en.po deleted file mode 100644 index 1bad63bd6..000000000 --- a/src/SUPERVGraph/resources/SUPERVGraph_msg_en.po +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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: SUPERVGraph_msg_en.po -// Created: 11/22/2005 10:55:36 PM -// Author: Margarita Karpunina -// Copyright (C) CEA 2005 - -msgid "LBL_TOOLBAR_LABEL" -msgstr "View Operations" - -msgid "DSC_RESET_VIEW" -msgstr "Reset View Point" - -msgid "MNU_RESET_VIEW" -msgstr "Reset" - -msgid "DSC_PAN_VIEW" -msgstr "Panning the view" - -msgid "MNU_PAN_VIEW" -msgstr "Panning" diff --git a/src/SUPERVGraph/resources/SUPERVGraph_msg_en.ts b/src/SUPERVGraph/resources/SUPERVGraph_msg_en.ts deleted file mode 100644 index 082ad5efc..000000000 --- a/src/SUPERVGraph/resources/SUPERVGraph_msg_en.ts +++ /dev/null @@ -1,25 +0,0 @@ - - - @default - - MNU_PAN_VIEW - Panning - - - DSC_PAN_VIEW - Panning the view - - - MNU_RESET_VIEW - Reset - - - DSC_RESET_VIEW - Reset View Point - - - LBL_TOOLBAR_LABEL - View Operations - - - diff --git a/src/SUPERVGraph/resources/superv_view_pan.png b/src/SUPERVGraph/resources/superv_view_pan.png deleted file mode 100644 index ec56cacc779342a978f183ecf747860c8b6dafb4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 982 zcmV;{11bE8P)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZb!otG-18H_3W&!c>DFz52f`;Yh z=KlYG@Zf(vJw1@2;y}!e&rpB>!e<*(Vq)UoNnv3OZ?0TnIIE=v5_imOsnQ(>_Q@}D9Q|HpzmfY=u#@9*!A5&HlE#0WDiKR^HPSD@Ek zzkbaCa@oa;7a4y4{_O{p(+6UCAm#(&Px|`$DQaqJ3~X#{4Da5(V|e)RA;Yz6*FdiR z0t!=r00NsF6BF}yLQoI`!>?Zq4Bx&nFns>Zz!(z)vWNqS-$A_va>-9lVB{=URRycP zpsdWG&(6-kdhOZ^SVRE?5Q~nE&fmqMp$spM9AUWs@+E@^Q1mI#KqwFe;@8la1=_~I z2J*$jJ9ilVe*DOA?ZXF#7k~dU%-7RnNW63j9QyzP#B$}z6$wUv{}&HSOBrrFdBPyW z&(HAr=TDe{d{D#gLnA=o6)=Lf|NhPJ2I#_XKyN<>8oU@7aj@722p~`x$^o%15O2W} zQ4K(R5QwirT?%sXD=g|(05K?CodF0SP#A)o^9gFhL?B)Zjj^{zMn(Vgg6j zxpU_jK79D#4wN$jVr3vsfvN|&{yoSXfB<5F#?CWnLd}P!GmwE_`1tr3R)vHxJUVoU z;RMiI;U7Ty82F(McnHLu(3}E_l-nS400M{wntfhCo&E)yX#avZ-#{@A45MF<9x;Hz z4lSY{BV~fOP)EH02p|@y4KPE$Kyv_tjEu~^`}glN965WI;l_&>3~!m4VFpeGVn3)0 zVaeeeEFA&_5G?D#4E+fW52hzio+tt7dm^Ah;l~e#JMZ4X4D5u`pP`QU2lWw%{s$01 zxUwNTH0uR`vRkc+3M|{L0pd2OxFS>?3IGToW*i2Bk`pV``xg$qd*=yF8X#vr0J$9M zy07T20tg^xJOwPwRUpGpK{Y>y#^wX4;lH73-~b@N0A_|Q{Wj4Xb^rhX07*qoM6N<$ Ef)-GsSpWb4 diff --git a/src/SUPERVGraph/resources/superv_view_reset.png b/src/SUPERVGraph/resources/superv_view_reset.png deleted file mode 100644 index 66f81e60471b7b587c37166a4e206b45f74e7fc2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 918 zcmV;H18Mw;P)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ<3`s;mRCwBA`2YVu0}KO!sHi9>h~bSaP6`GHAOZXQ009Iu ztVK?a_y6WCKL3CH$@>5IfA;^Iw`2aBnTdlW&7exTp@zi+u{AD30Ro7Lk&#hUNQk5Q z?D;STpjR1~nHj+nii&(-KGfwPzyqZXfLH~Ij{*P!hzW=@vvYJAfQEtvwrzdL@b~Y3 zhTx#>3=Q?CrT~SeL)CtP(l4O+3pN7*0*D2Ojg5^(!JOKflMHLu++jF%N|j;rru$QX z!I2B}0Zi>zGy}h4GY}wvKrZ|XauEp3n0^K5WhREsj&mSx69e%89{T_R1ajfcn>Rmz zIq%;60AXz)^A6B;zi?=K-}sfC-?tzTH62r z+1dZM`}+RpVPyp=a)o&VAb=Q=3jlDg;ox}n@#jy5zyJSR0p*SZ#Xz=e0L9NFXlO8m zC@V8qN=Sg!-~8}_;lk_J40EqvXW0Gtu^UimH$VWPmo_{g8)rH={0C|R3ET$aE+9^W z#_sAO0|T(@KsZfX8>D6hvI_wMh!MSr0=mcm=$i9OU0oSe`1u*u-@C_f=i^5PHYO$p zdueHgKqVyxW?=4l`t>V=_OfLRAAkK40Gja;rXL`H7_pRjAVWa`o#`Ya<56K`#Na9` ziz0vj( -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -// temporary commented -//#include - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -#include -#include - -#include - -/*!Internal class that updates object browser item properties */ -// temporary commented -/*class SalomeApp_Updater : public OB_Updater -{ -public: - SalomeApp_Updater() : OB_Updater(){}; - virtual ~SalomeApp_Updater(){}; - virtual void update( SUIT_DataObject* theObj, OB_ListItem* theItem ); -}; - -void SalomeApp_Updater::update( SUIT_DataObject* theObj, OB_ListItem* theItem ) -{ - if( !theObj || !theItem ) - return; - - SalomeApp_DataObject* SAObj = dynamic_cast( theObj ); - if( !SAObj ) - return; - - _PTR(SObject) SObj = SAObj->object(); - if( !SObj ) - return; - _PTR( GenericAttribute ) anAttr; - - // Selectable - if ( SObj->FindAttribute( anAttr, "AttributeSelectable" ) ) - { - _PTR(AttributeSelectable) aAttrSel = anAttr; - theItem->setSelectable( aAttrSel->IsSelectable() ); - } - // Expandable - if ( SObj->FindAttribute(anAttr, "AttributeExpandable") ) - { - _PTR(AttributeExpandable) aAttrExpand = anAttr; - theItem->setExpandable( aAttrExpand->IsExpandable() ); - } - // Opened - //this attribute is not supported in the version of SALOME 3.x - //if ( SObj->FindAttribute(anAttr, "AttributeOpened") ) - //{ - // _PTR(AttributeOpened) aAttrOpen = anAttr; - // theItem->setOpen( aAttrOpen->IsOpened() ); - //} -}*/ - -/*!Create new instance of SalomeApp_Application.*/ -extern "C" SALOMEAPP_EXPORT SUIT_Application* createApplication() -{ - return new SalomeApp_Application(); -} - -/*!Constructor.*/ -SalomeApp_Application::SalomeApp_Application() -: LightApp_Application() -{ - connect( desktop(), SIGNAL( message( const QString& ) ), - this, SLOT( onDesktopMessage( const QString& ) ) ); -} - -/*!Destructor. - *\li Destroy event filter. - */ -SalomeApp_Application::~SalomeApp_Application() -{ - // Do not destroy. It's a singleton ! - //SalomeApp_EventFilter::Destroy(); -} - -/*!Start application.*/ -void SalomeApp_Application::start() -{ - LightApp_Application::start(); - - SalomeApp_EventFilter::Init(); - - static bool isFirst = true; - if ( isFirst ) { - isFirst = false; - - QString hdffile; - QStringList pyfiles; - - for (int i = 1; i < qApp->argc(); i++) { - QRegExp rxs ("--study-hdf=(.+)"); - if ( rxs.indexIn( QString(qApp->argv()[i]) ) >= 0 && rxs.capturedTexts().count() > 1 ) { - QString file = rxs.capturedTexts()[1]; - QFileInfo fi ( file ); - QString extension = fi.suffix().toLower(); - if ( extension == "hdf" && fi.exists() ) - hdffile = fi.absoluteFilePath(); - } - else { - QRegExp rxp ("--pyscript=(.+)"); - if ( rxp.indexIn( QString(qApp->argv()[i]) ) >= 0 && rxp.capturedTexts().count() > 1 ) { - QStringList files = rxp.capturedTexts()[1].split(",",QString::SkipEmptyParts); - pyfiles += files; - } - } - } - - if ( !hdffile.isEmpty() ) // open hdf file given as parameter - onOpenDoc( hdffile ); - else if ( pyfiles.count() > 0 ) // create new study - onNewDoc(); - - // import/execute python scripts - if ( pyfiles.count() > 0 && activeStudy() ) { - SalomeApp_Study* appStudy = dynamic_cast( activeStudy() ); - if ( appStudy ) { - _PTR(Study) aStudy = appStudy->studyDS(); - if ( !aStudy->GetProperties()->IsLocked() ) { - for (uint j = 0; j < pyfiles.count(); j++ ) { - QFileInfo fi ( pyfiles[j] ); - PyConsole_Console* pyConsole = pythonConsole(); - if ( pyConsole ) { - QString extension = fi.suffix().toLower(); - if ( fi.exists() ) { - // execute python script - QString command = QString( "execfile(\"%1\")" ).arg( fi.absoluteFilePath() ); - pyConsole->exec( command ); - } - else { - // import python module - QString command = QString( "import %1" ).arg( pyfiles[j] ); - if ( extension == "py" ) - command = QString( "import %1" ).arg( fi.completeBaseName() ); - pyConsole->exec( command ); - } - } - } - } - } - } - } -} - -/*!Create actions:*/ -void SalomeApp_Application::createActions() -{ - LightApp_Application::createActions(); - - SUIT_Desktop* desk = desktop(); - - //! Save GUI state - // "Save GUI State" command is moved to VISU module - // createAction( SaveGUIStateId, tr( "TOT_DESK_FILE_SAVE_GUI_STATE" ), QIcon(), - // tr( "MEN_DESK_FILE_SAVE_GUI_STATE" ), tr( "PRP_DESK_FILE_SAVE_GUI_STATE" ), - // 0, desk, false, this, SLOT( onSaveGUIState() ) ); - - //! Dump study - createAction( DumpStudyId, tr( "TOT_DESK_FILE_DUMP_STUDY" ), QIcon(), - tr( "MEN_DESK_FILE_DUMP_STUDY" ), tr( "PRP_DESK_FILE_DUMP_STUDY" ), - Qt::CTRL+Qt::Key_D, desk, false, this, SLOT( onDumpStudy() ) ); - - //! Load script - createAction( LoadScriptId, tr( "TOT_DESK_FILE_LOAD_SCRIPT" ), QIcon(), - tr( "MEN_DESK_FILE_LOAD_SCRIPT" ), tr( "PRP_DESK_FILE_LOAD_SCRIPT" ), - Qt::CTRL+Qt::Key_T, desk, false, this, SLOT( onLoadScript() ) ); - - //! Properties - createAction( PropertiesId, tr( "TOT_DESK_PROPERTIES" ), QIcon(), - tr( "MEN_DESK_PROPERTIES" ), tr( "PRP_DESK_PROPERTIES" ), - Qt::CTRL+Qt::Key_P, desk, false, this, SLOT( onProperties() ) ); - - //! Catalog Generator - createAction( CatalogGenId, tr( "TOT_DESK_CATALOG_GENERATOR" ), QIcon(), - tr( "MEN_DESK_CATALOG_GENERATOR" ), tr( "PRP_DESK_CATALOG_GENERATOR" ), - Qt::SHIFT+Qt::Key_G, desk, false, this, SLOT( onCatalogGen() ) ); - - //! Registry Display - createAction( RegDisplayId, tr( "TOT_DESK_REGISTRY_DISPLAY" ), QIcon(), - tr( "MEN_DESK_REGISTRY_DISPLAY" ), tr( "PRP_DESK_REGISTRY_DISPLAY" ), - /*Qt::SHIFT+Qt::Key_D*/0, desk, false, this, SLOT( onRegDisplay() ) ); - - //SRN: BugID IPAL9021, add an action "Load" - createAction( FileLoadId, tr( "TOT_DESK_FILE_LOAD" ), - resourceMgr()->loadPixmap( "STD", tr( "ICON_FILE_OPEN" ) ), - tr( "MEN_DESK_FILE_LOAD" ), tr( "PRP_DESK_FILE_LOAD" ), - Qt::CTRL+Qt::Key_L, desk, false, this, SLOT( onLoadDoc() ) ); - //SRN: BugID IPAL9021: End - - - int fileMenu = createMenu( tr( "MEN_DESK_FILE" ), -1 ); - - // "Save GUI State" command is renamed to "Save VISU State" and - // creation of menu item is moved to VISU - // createMenu( SaveGUIStateId, fileMenu, 10, -1 ); - - createMenu( FileLoadId, fileMenu, 0 ); //SRN: BugID IPAL9021, add a menu item "Load" - - createMenu( DumpStudyId, fileMenu, 10, -1 ); - createMenu( separator(), fileMenu, -1, 10, -1 ); - createMenu( LoadScriptId, fileMenu, 10, -1 ); - createMenu( separator(), fileMenu, -1, 10, -1 ); - createMenu( PropertiesId, fileMenu, 10, -1 ); - createMenu( separator(), fileMenu, -1, 10, -1 ); - - int toolsMenu = createMenu( tr( "MEN_DESK_TOOLS" ), -1, MenuToolsId, 50 ); - createMenu( CatalogGenId, toolsMenu, 10, -1 ); - createMenu( RegDisplayId, toolsMenu, 10, -1 ); - createMenu( separator(), toolsMenu, -1, 15, -1 ); -} - -/*! - \brief Close application. -*/ -void SalomeApp_Application::onExit() -{ - bool killServers = false; - bool result = true; - - if ( exitConfirmation() ) { - SalomeApp_ExitDlg dlg( desktop() ); - result = dlg.exec() == QDialog::Accepted; - killServers = dlg.isServersShutdown(); - } - - if ( result ) - SUIT_Session::session()->closeSession( SUIT_Session::ASK, killServers ); -} - -/*!SLOT. Load document.*/ -void SalomeApp_Application::onLoadDoc() -{ - QString studyName; - - std::vector List = studyMgr()->GetOpenStudies(); - - SUIT_Session* aSession = SUIT_Session::session(); - QList aAppList = aSession->applications(); - - QStringList unloadedStudies; - - for ( unsigned int ind = 0; ind < List.size(); ind++ ) { - studyName = List[ind].c_str(); - // Add to list only unloaded studies - bool isAlreadyOpen = false; - QListIterator it( aAppList ); - while ( it.hasNext() && !isAlreadyOpen ) { - SUIT_Application* aApp = it.next(); - if( !aApp || !aApp->activeStudy() ) - continue; - if ( aApp->activeStudy()->studyName() == studyName ) - isAlreadyOpen = true; - } - - if ( !isAlreadyOpen ) - unloadedStudies << studyName; - } - - studyName = SalomeApp_LoadStudiesDlg::selectStudy( desktop(), unloadedStudies ); - if ( studyName.isEmpty() ) - return; - -#ifndef WIN32 - // this code replaces marker of windows drive and path become invalid therefore - // defines placed there - studyName.replace( QRegExp(":"), "/" ); -#endif - - if ( onLoadDoc( studyName ) ) { - updateWindows(); - updateViewManagers(); - updateObjectBrowser( true ); - } -} - -/*!SLOT. Load document with \a aName.*/ -bool SalomeApp_Application::onLoadDoc( const QString& aName ) -{ - bool res = true; - if ( !activeStudy() ) { - // if no study - load in current desktop - res = useStudy( aName ); - } - else { - // if study exists - load in new desktop. Check: is the same file is loaded? - SUIT_Session* aSession = SUIT_Session::session(); - QList aAppList = aSession->applications(); - bool isAlreadyOpen = false; - SalomeApp_Application* aApp = 0; - for ( QList::iterator it = aAppList.begin(); - it != aAppList.end() && !isAlreadyOpen; ++it ) { - aApp = dynamic_cast( *it ); - if ( aApp && aApp->activeStudy()->studyName() == aName ) - isAlreadyOpen = true; - } - if ( !isAlreadyOpen ) { - aApp = dynamic_cast( startApplication( 0, 0 ) ); - if ( aApp ) - res = aApp->useStudy( aName ); - } - else { - aApp->desktop()->activateWindow(); - } - } - - return res; -} - -/*!SLOT. Copy objects to study maneger from selection maneger..*/ -void SalomeApp_Application::onCopy() -{ - SALOME_ListIO list; - LightApp_SelectionMgr* mgr = selectionMgr(); - mgr->selectedObjects(list); - - SalomeApp_Study* study = dynamic_cast(activeStudy()); - if(study == NULL) return; - - _PTR(Study) stdDS = study->studyDS(); - if(!stdDS) return; - - SALOME_ListIteratorOfListIO it( list ); - if(it.More()) - { - _PTR(SObject) so = stdDS->FindObjectID(it.Value()->getEntry()); - try { - studyMgr()->Copy(so); - onSelectionChanged(); - } - catch(...) { - } - } -} - -/*!SLOT. Paste objects to study maneger from selection manager.*/ -void SalomeApp_Application::onPaste() -{ - SALOME_ListIO list; - LightApp_SelectionMgr* mgr = selectionMgr(); - mgr->selectedObjects(list); - - SalomeApp_Study* study = dynamic_cast(activeStudy()); - if(study == NULL) return; - - _PTR(Study) stdDS = study->studyDS(); - if(!stdDS) return; - - if ( stdDS->GetProperties()->IsLocked() ) { - SUIT_MessageBox::warning( desktop(), - QObject::tr("WRN_WARNING"), - QObject::tr("WRN_STUDY_LOCKED") ); - return; - } - - SALOME_ListIteratorOfListIO it( list ); - if(it.More()) - { - _PTR(SObject) so = stdDS->FindObjectID(it.Value()->getEntry()); - try { - studyMgr()->Paste(so); - updateObjectBrowser( true ); - updateActions(); //SRN: BugID IPAL9377, case 3 - } - catch(...) { - } - } -} - -/*!Check the application on closing. - * \retval true if possible, else false - */ -bool SalomeApp_Application::isPossibleToClose( bool& closePermanently ) -{ - return LightApp_Application::isPossibleToClose( closePermanently ); -} - -/*! Check if the study is locked */ -void SalomeApp_Application::onCloseDoc( bool ask ) -{ - SalomeApp_Study* study = dynamic_cast(activeStudy()); - - if (study != NULL) { - _PTR(Study) stdDS = study->studyDS(); - if(stdDS && stdDS->IsStudyLocked()) { - if ( SUIT_MessageBox::question( desktop(), - QObject::tr( "WRN_WARNING" ), - QObject::tr( "CLOSE_LOCKED_STUDY" ), - SUIT_MessageBox::Yes | SUIT_MessageBox::No, - SUIT_MessageBox::No) == SUIT_MessageBox::No ) return; - - } - } - - LightApp_Application::onCloseDoc( ask ); -} - -/*!Sets enable or disable some actions on selection changed.*/ -void SalomeApp_Application::onSelectionChanged() -{ - SALOME_ListIO list; - LightApp_SelectionMgr* mgr = selectionMgr(); - mgr->selectedObjects(list); - - bool canCopy = false; - bool canPaste = false; - - SalomeApp_Study* study = dynamic_cast(activeStudy()); - if (study != NULL) { - _PTR(Study) stdDS = study->studyDS(); - - if (stdDS) { - SALOME_ListIteratorOfListIO it ( list ); - - if (it.More() && list.Extent() == 1) { - _PTR(SObject) so = stdDS->FindObjectID(it.Value()->getEntry()); - - if ( so ) { - canCopy = studyMgr()->CanCopy(so); - canPaste = studyMgr()->CanPaste(so); - } - } - } - } - - action(EditCopyId)->setEnabled(canCopy); - action(EditPasteId)->setEnabled(canPaste); -} - -/*!Delete references.*/ -void SalomeApp_Application::onDeleteInvalidReferences() -{ - SALOME_ListIO aList; - LightApp_SelectionMgr* mgr = selectionMgr(); - mgr->selectedObjects( aList, QString(), false ); - - if( aList.IsEmpty() ) - return; - - SalomeApp_Study* aStudy = dynamic_cast(activeStudy()); - _PTR(Study) aStudyDS = aStudy->studyDS(); - _PTR(StudyBuilder) aStudyBuilder = aStudyDS->NewBuilder(); - _PTR(SObject) anObj; - - for( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) - if ( it.Value()->hasEntry() ) - { - _PTR(SObject) aSObject = aStudyDS->FindObjectID( it.Value()->getEntry() ), aRefObj = aSObject; - while( aRefObj && aRefObj->ReferencedObject( anObj ) ) - aRefObj = anObj; - - if( aRefObj && aRefObj!=aSObject && QString( aRefObj->GetName().c_str() ).isEmpty() ) - aStudyBuilder->RemoveReference( aSObject ); - } - updateObjectBrowser(); -} - -/*!Private SLOT. */ -void SalomeApp_Application::onOpenWith() -{ - QApplication::setOverrideCursor( Qt::WaitCursor ); - SALOME_ListIO aList; - LightApp_SelectionMgr* mgr = selectionMgr(); - mgr->selectedObjects(aList); - if (aList.Extent() != 1) - { - QApplication::restoreOverrideCursor(); - return; - } - Handle(SALOME_InteractiveObject) aIObj = aList.First(); - QString aModuleName(aIObj->getComponentDataType()); - QString aModuleTitle = moduleTitle(aModuleName); - activateModule(aModuleTitle); - QApplication::restoreOverrideCursor(); -} - -/*! - Creates new study -*/ -SUIT_Study* SalomeApp_Application::createNewStudy() -{ - SalomeApp_Study* aStudy = new SalomeApp_Study( this ); - - // Set up processing of major study-related events - connect( aStudy, SIGNAL( created( SUIT_Study* ) ), this, SLOT( onStudyCreated( SUIT_Study* ) ) ); - connect( aStudy, SIGNAL( opened ( SUIT_Study* ) ), this, SLOT( onStudyOpened ( SUIT_Study* ) ) ); - connect( aStudy, SIGNAL( saved ( SUIT_Study* ) ), this, SLOT( onStudySaved ( SUIT_Study* ) ) ); - connect( aStudy, SIGNAL( closed ( SUIT_Study* ) ), this, SLOT( onStudyClosed ( SUIT_Study* ) ) ); - - return aStudy; -} - -/*! - Enable/Disable menu items and toolbar buttons. Rebuild menu -*/ -void SalomeApp_Application::updateCommandsStatus() -{ - LightApp_Application::updateCommandsStatus(); - - // Dump study menu - QAction* a = action( DumpStudyId ); - if ( a ) - a->setEnabled( activeStudy() ); - - // Load script menu - a = action( LoadScriptId ); - if ( a ) - a->setEnabled( activeStudy() ); - - // Properties menu - a = action( PropertiesId ); - if( a ) - a->setEnabled( activeStudy() ); - - // Save GUI state menu - a = action( SaveGUIStateId ); - if( a ) - a->setEnabled( activeStudy() ); - - // update state of Copy/Paste menu items - onSelectionChanged(); -} - -/*! - \class DumpStudyFileDlg - Private class used in Dump Study operation. Consists 2 check boxes: - "Publish in study" and "Save GUI parameters" -*/ -class DumpStudyFileDlg : public SUIT_FileDlg -{ -public: - DumpStudyFileDlg( QWidget* parent ) : SUIT_FileDlg( parent, false, true, true ) - { - QGridLayout* grid = ::qobject_cast( layout() ); - if ( grid ) - { - QWidget *hB = new QWidget( this ); - myPublishChk = new QCheckBox( tr("PUBLISH_IN_STUDY") ); - mySaveGUIChk = new QCheckBox( tr("SAVE_GUI_STATE") ); - - QHBoxLayout *layout = new QHBoxLayout; - layout->addWidget(myPublishChk); - layout->addWidget(mySaveGUIChk); - hB->setLayout(layout); - - QPushButton* pb = new QPushButton(this); - - int row = grid->rowCount(); - grid->addWidget( new QLabel("", this), row, 0 ); - grid->addWidget( hB, row, 1, 1, 3 ); - grid->addWidget( pb, row, 5 ); - - pb->hide(); - } - } - QCheckBox* myPublishChk; - QCheckBox* mySaveGUIChk; -}; - -class DumpStudyFileValidator : public SUIT_FileValidator -{ - public: - DumpStudyFileValidator( QWidget* parent) : SUIT_FileValidator ( parent ) {}; - virtual ~DumpStudyFileValidator() {}; - virtual bool canSave( const QString& file, bool permissions ); -}; - -bool DumpStudyFileValidator::canSave(const QString& file, bool permissions) -{ - QFileInfo fi( file ); - QString name = fi.fileName(); - - if ( name.indexOf( QRegExp("[-!?#*&]") ) >= 0 ) { - SUIT_MessageBox::critical( parent(), - QObject::tr("WRN_WARNING"), - QObject::tr("WRN_FILE_NAME_BAD") ); - return false; - } - return SUIT_FileValidator::canSave( file, permissions); -} - -/*!Private SLOT. On dump study.*/ -void SalomeApp_Application::onDumpStudy( ) -{ - SalomeApp_Study* appStudy = dynamic_cast( activeStudy() ); - if ( !appStudy ) return; - _PTR(Study) aStudy = appStudy->studyDS(); - - QStringList aFilters; - aFilters.append( tr( "PYTHON_FILES_FILTER" ) ); - - DumpStudyFileDlg fd( desktop() ); - fd.setValidator( new DumpStudyFileValidator( &fd ) ); - fd.setWindowTitle( tr( "TOT_DESK_FILE_DUMP_STUDY" ) ); - fd.setFilters( aFilters ); - fd.myPublishChk->setChecked( true ); - fd.mySaveGUIChk->setChecked( true ); - if ( fd.exec() == QDialog::Accepted ) - { - QString aFileName = fd.selectedFile(); - - bool toPublish = fd.myPublishChk->isChecked(); - bool toSaveGUI = fd.mySaveGUIChk->isChecked(); - - if ( !aFileName.isEmpty() ) { - QFileInfo aFileInfo(aFileName); - if( aFileInfo.isDir() ) // IPAL19257 - return; - - int savePoint; - _PTR(AttributeParameter) ap; - _PTR(IParameters) ip = ClientFactory::getIParameters(ap); - if(ip->isDumpPython(appStudy->studyDS())) ip->setDumpPython(appStudy->studyDS()); //Unset DumpPython flag. - if ( toSaveGUI ) { //SRN: Store a visual state of the study at the save point for DumpStudy method - ip->setDumpPython(appStudy->studyDS()); - savePoint = SalomeApp_VisualState( this ).storeState(); //SRN: create a temporary save point - } - bool res = aStudy->DumpStudy( aFileInfo.absolutePath().toStdString(), - aFileInfo.baseName().toStdString(), toPublish); - if ( toSaveGUI ) - appStudy->removeSavePoint(savePoint); //SRN: remove the created temporary save point. - if ( !res ) - SUIT_MessageBox::warning( desktop(), - QObject::tr("WRN_WARNING"), - tr("WRN_DUMP_STUDY_FAILED") ); - } - } -} - -/*!Private SLOT. On load script.*/ -void SalomeApp_Application::onLoadScript( ) -{ - SalomeApp_Study* appStudy = dynamic_cast( activeStudy() ); - if ( !appStudy ) return; - _PTR(Study) aStudy = appStudy->studyDS(); - - if ( aStudy->GetProperties()->IsLocked() ) { - SUIT_MessageBox::warning( desktop(), - QObject::tr("WRN_WARNING"), - QObject::tr("WRN_STUDY_LOCKED") ); - return; - } - - QStringList filtersList; - filtersList.append(tr("PYTHON_FILES_FILTER")); - filtersList.append(tr("ALL_FILES_FILTER")); - - QString anInitialPath = ""; - if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() ) - anInitialPath = QDir::currentPath(); - - QString aFile = SUIT_FileDlg::getFileName( desktop(), anInitialPath, filtersList, tr( "TOT_DESK_FILE_LOAD_SCRIPT" ), true, true ); - - if ( !aFile.isEmpty() ) - { - QString command = QString("execfile(\"%1\")").arg(aFile); - - PyConsole_Console* pyConsole = pythonConsole(); - - if ( pyConsole ) - pyConsole->exec( command ); - } -} - -/*!Private SLOT. On save GUI state.*/ -void SalomeApp_Application::onSaveGUIState() -{ - SalomeApp_Study* study = dynamic_cast( activeStudy() ); - if ( study ) { - SalomeApp_VisualState( this ).storeState(); - updateSavePointDataObjects( study ); - // temporary commented - //objectBrowser()->updateTree( study->root() ); - } - updateActions(); -} - -/*!Gets file filter. - *\retval QString "(*.hdf)" - */ -QString SalomeApp_Application::getFileFilter() const -{ - return "(*.hdf)"; -} - -/*!Create window.*/ -QWidget* SalomeApp_Application::createWindow( const int flag ) -{ - QWidget* wid = 0; - if ( flag != WT_PyConsole ) wid = LightApp_Application::createWindow(flag); - - SUIT_ResourceMgr* resMgr = resourceMgr(); - - if ( flag == WT_ObjectBrowser ) - { - SUIT_DataBrowser* ob = qobject_cast( wid ); - if ( ob ) { - // temporary commented - //ob->setUpdater( new SalomeApp_Updater() ); - - connect( ob, SIGNAL( doubleClicked( SUIT_DataObject* ) ), this, SLOT( onDblClick( SUIT_DataObject* ) ) ); - - bool autoSize = resMgr->booleanValue( "ObjectBrowser", "auto_size", false ); - bool autoSizeFirst = resMgr->booleanValue( "ObjectBrowser", "auto_size_first", true ); - bool resizeOnExpandItem = resMgr->booleanValue( "ObjectBrowser", "resize_on_expand_item", true ); - - ob->setAutoSizeFirstColumn(autoSizeFirst); - ob->setAutoSizeColumns(autoSize); - ob->setResizeOnExpandItem(resizeOnExpandItem); - - // temporary commented - /* - for ( int i = SalomeApp_DataObject::ValueIdx; i <= SalomeApp_DataObject::RefEntryIdx; i++ ) - { - ob->addColumn( tr( QString().sprintf( "OBJ_BROWSER_COLUMN_%d", i ) ), i ); - ob->setColumnShown( i, resMgr->booleanValue( "ObjectBrowser", - QString().sprintf( "visibility_column_%d", i ), true ) ); - } - */ - - // temporary commented - /* - ob->setWidthMode( autoSize ? QListView::Maximum : QListView::Manual ); - ob->listView()->setColumnWidthMode( 0, autoSizeFirst ? QListView::Maximum : QListView::Manual ); - ob->resize( desktop()->width()/3, ob->height() ); - */ - } - } - else if ( flag == WT_PyConsole ) - { - PyConsole_Console* pyCons = new PyConsole_Console( desktop(), new SalomeApp_PyInterp() ); - pyCons->setWindowTitle( tr( "PYTHON_CONSOLE" ) ); - wid = pyCons; - pyCons->resize( pyCons->width(), desktop()->height()/4 ); - pyCons->connectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) ); - } - return wid; -} - -/*!Create preferences.*/ -void SalomeApp_Application::createPreferences( LightApp_Preferences* pref ) -{ - LightApp_Application::createPreferences(pref); - - if ( !pref ) - return; - - int salomeCat = pref->addPreference( tr( "PREF_CATEGORY_SALOME" ) ); - int obTab = pref->addPreference( tr( "PREF_TAB_OBJBROWSER" ), salomeCat ); - int defCols = pref->addPreference( tr( "PREF_GROUP_DEF_COLUMNS" ), obTab ); - for ( int i = SalomeApp_DataObject::EntryIdx; i <= SalomeApp_DataObject::RefEntryIdx; i++ ) - { - pref->addPreference( tr( QString().sprintf( "OBJ_BROWSER_COLUMN_%d", i-1 ).toLatin1() ), defCols, - LightApp_Preferences::Bool, "ObjectBrowser", QString().sprintf( "visibility_column_%d", i-1 ) ); - } - pref->setItemProperty( "orientation", Qt::Vertical, defCols ); - - // adding preference to LightApp_Application handled preferences.. a bit of hacking with resources.. - int genTab = pref->addPreference( LightApp_Application::tr( "PREF_TAB_GENERAL" ), salomeCat ); - int studyGroup = pref->addPreference( LightApp_Application::tr( "PREF_GROUP_STUDY" ), genTab ); - pref->addPreference( tr( "PREF_STORE_VISUAL_STATE" ), studyGroup, LightApp_Preferences::Bool, "Study", "store_visual_state" ); -} - -/*!Update desktop title.*/ -void SalomeApp_Application::updateDesktopTitle() { - QString aTitle = applicationName(); - QString aVer = applicationVersion(); - if ( !aVer.isEmpty() ) - aTitle += QString( " " ) + aVer; - - if ( activeStudy() ) - { - QString sName = SUIT_Tools::file( activeStudy()->studyName().trimmed(), false ); - if ( !sName.isEmpty() ) { - SalomeApp_Study* study = dynamic_cast(activeStudy()); - if ( study ) { - _PTR(Study) stdDS = study->studyDS(); - if(stdDS) { - if ( stdDS->GetProperties()->IsLocked() ) { - aTitle += QString( " - [%1 (%2)]").arg( sName ).arg( tr( "STUDY_LOCKED" ) ); - } else { - aTitle += QString( " - [%1]" ).arg( sName ); - } - } - } - } - } - - desktop()->setWindowTitle( aTitle ); -} - -int SalomeApp_Application::closeChoice( const QString& docName ) -{ - int answer = SUIT_MessageBox::question( desktop(), tr( "APPCLOSE_CAPTION" ), tr( "APPCLOSE_DESCRIPTION" ).arg( docName ), - tr ("APPCLOSE_SAVE"), tr ("APPCLOSE_CLOSE"), - tr ("APPCLOSE_UNLOAD"), tr ("APPCLOSE_CANCEL"), 0 ); - - int res = CloseCancel; - if ( answer == 0 ) - res = CloseSave; - else if ( answer == 1 ) - res = CloseDiscard; - else if ( answer == 2 ) - res = CloseUnload; - - return res; -} - -bool SalomeApp_Application::closeAction( const int choice, bool& closePermanently ) -{ - bool res = true; - switch( choice ) - { - case CloseSave: - if ( activeStudy()->isSaved() ) - onSaveDoc(); - else if ( !onSaveAsDoc() ) - res = false; - break; - case CloseDiscard: - break; - case CloseUnload: - closePermanently = false; - break; - case CloseCancel: - default: - res = false; - } - - return res; -} - -int SalomeApp_Application::openChoice( const QString& aName ) -{ - int choice = LightApp_Application::openChoice( aName ); - - if ( choice == OpenNew ) // The document isn't already open. - { - bool exist = false; - std::vector lst = studyMgr()->GetOpenStudies(); - for ( uint i = 0; i < lst.size() && !exist; i++ ) - { - if ( aName == QString( lst[i].c_str() ) ) - exist = true; - } - - // The document already exists in the study manager. - // Do you want to reload it? - if ( exist ) - { - int answer = SUIT_MessageBox::question( desktop(), tr( "WRN_WARNING" ), tr( "QUE_DOC_ALREADYEXIST" ).arg( aName ), - SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::No ); - if ( answer == SUIT_MessageBox::Yes ) - choice = OpenRefresh; - else - choice = OpenCancel; - } - } - - return choice; -} - -bool SalomeApp_Application::openAction( const int aChoice, const QString& aName ) -{ - bool res = false; - int choice = aChoice; - switch ( choice ) - { - case OpenRefresh: - { - _PTR(Study) aStudy = studyMgr()->GetStudyByName( aName.toStdString() ); - if ( aStudy ) - { - studyMgr()->Close( aStudy ); - choice = OpenNew; - } - } - default: - res = LightApp_Application::openAction( choice, aName ); - break; - } - - return res; -} - -/*! - \brief Get map of the operations which can be performed - on the module activation. - - The method should return the map of the kind \c {:} - where \c is an integer identifier of the operation and - \c is a title for the button to be added to the - dialog box. After user selects the required operation by the - clicking the corresponding button in the dialog box, its identifier - is passed to the moduleActionSelected() method to process - the made choice. - - \return map of the operations - \sa moduleActionSelected() -*/ -QMap SalomeApp_Application::activateModuleActions() const -{ - QMap opmap = LightApp_Application::activateModuleActions(); - opmap.insert( LoadStudyId, tr( "ACTIVATE_MODULE_OP_LOAD" ) ); - return opmap; -} - -/*! - \brief Called when the used selectes required operation chosen - from "Activate module" dialog box. - - Performs the required operation according to the user choice. - - \param id operation identifier - \sa activateModuleActions() -*/ -void SalomeApp_Application::moduleActionSelected( const int id ) -{ - if ( id == LoadStudyId ) - onLoadDoc(); - else - LightApp_Application::moduleActionSelected( id ); -} - -/*!Gets CORBA::ORB_var*/ -CORBA::ORB_var SalomeApp_Application::orb() -{ - ORB_INIT& init = *SINGLETON_::Instance(); - static CORBA::ORB_var _orb = init( qApp->argc(), qApp->argv() ); - return _orb; -} - -/*!Create and return SALOMEDS_StudyManager.*/ -SALOMEDSClient_StudyManager* SalomeApp_Application::studyMgr() -{ - static _PTR(StudyManager) _sm; - if(!_sm) _sm = ClientFactory::StudyManager(); - return _sm.get(); -} - -/*!Create and return SALOME_NamingService.*/ -SALOME_NamingService* SalomeApp_Application::namingService() -{ - static SALOME_NamingService* _ns = new SALOME_NamingService( orb() ); - return _ns; -} - -/*!Create and return SALOME_LifeCycleCORBA.*/ -SALOME_LifeCycleCORBA* SalomeApp_Application::lcc() -{ - static SALOME_LifeCycleCORBA* _lcc = new SALOME_LifeCycleCORBA( namingService() ); - return _lcc; -} - -/*!Return default engine IOR for light modules*/ -QString SalomeApp_Application::defaultEngineIOR() -{ - /// Look for a default module engine (needed for CORBAless modules to use SALOMEDS persistence) - QString anIOR( "" ); - CORBA::Object_ptr anEngine = namingService()->Resolve( "/SalomeAppEngine" ); - if ( !CORBA::is_nil( anEngine ) ) - { - CORBA::String_var objStr = orb()->object_to_string( anEngine ); - anIOR = QString( objStr.in() ); - } - return anIOR; -} - -/*!Private SLOT. On preferences.*/ -void SalomeApp_Application::onProperties() -{ - SalomeApp_Study* study = dynamic_cast( activeStudy() ); - if( !study ) - return; - - _PTR(StudyBuilder) SB = study->studyDS()->NewBuilder(); - SB->NewCommand(); - - SalomeApp_StudyPropertiesDlg aDlg( desktop() ); - int res = aDlg.exec(); - if( res==QDialog::Accepted && aDlg.isChanged() ) - SB->CommitCommand(); - else - SB->AbortCommand(); - - //study->updateCaptions(); - updateDesktopTitle(); - updateActions(); -} - -/*!Insert items in popup, which necessary for current application*/ -void SalomeApp_Application::contextMenuPopup( const QString& type, QMenu* thePopup, QString& title ) -{ - LightApp_Application::contextMenuPopup( type, thePopup, title ); - - // temporary commented - /*OB_Browser* ob = objectBrowser(); - if ( !ob || type != ob->popupClientType() ) - return;*/ - - // Get selected objects - SALOME_ListIO aList; - LightApp_SelectionMgr* mgr = selectionMgr(); - mgr->selectedObjects( aList, QString(), false ); - - // add GUI state commands: restore, rename - if ( aList.Extent() == 1 && aList.First()->hasEntry() && - QString( aList.First()->getEntry() ).startsWith( tr( "SAVE_POINT_DEF_NAME" ) ) ) { - thePopup->addSeparator(); - thePopup->addAction( tr( "MEN_RESTORE_VS" ), this, SLOT( onRestoreGUIState() ) ); - thePopup->addAction( tr( "MEN_RENAME_VS" ), this, SLOT( onRenameGUIState() ) ); - thePopup->addAction( tr( "MEN_DELETE_VS" ), this, SLOT( onDeleteGUIState() ) ); - } - - // "Delete reference" item should appear only for invalid references - - // isInvalidRefs will be true, if at least one of selected objects is invalid reference - bool isInvalidRefs = false; - SalomeApp_Study* aStudy = dynamic_cast(activeStudy()); - _PTR(Study) aStudyDS = aStudy->studyDS(); - _PTR(SObject) anObj; - - for( SALOME_ListIteratorOfListIO it( aList ); it.More() && !isInvalidRefs; it.Next() ) - if( it.Value()->hasEntry() ) - { - _PTR(SObject) aSObject = aStudyDS->FindObjectID( it.Value()->getEntry() ), aRefObj = aSObject; - while( aRefObj && aRefObj->ReferencedObject( anObj ) ) - aRefObj = anObj; - - if( aRefObj && aRefObj!=aSObject && QString( aRefObj->GetName().c_str() ).isEmpty() ) - isInvalidRefs = true; - } - - // Add "Delete reference" item to popup - if ( isInvalidRefs ) - { - thePopup->addSeparator(); - thePopup->addAction( tr( "MEN_DELETE_INVALID_REFERENCE" ), this, SLOT( onDeleteInvalidReferences() ) ); - return; - } - - aList.Clear(); - mgr->selectedObjects( aList ); - - // "Activate module" item should appear only if it's necessary - if (aList.Extent() != 1) - return; - Handle(SALOME_InteractiveObject) aIObj = aList.First(); - // check if item is a "GUI state" item (also a first level object) - QString entry( aIObj->getEntry() ); - if ( entry.startsWith( tr( "SAVE_POINT_DEF_NAME" ) ) ) - return; - QString aModuleName(aIObj->getComponentDataType()); - QString aModuleTitle = moduleTitle(aModuleName); - CAM_Module* currentModule = activeModule(); - if (currentModule && currentModule->moduleName() == aModuleTitle) - return; - if ( !aModuleTitle.isEmpty() ) - thePopup->addAction( tr( "MEN_OPENWITH" ).arg( aModuleTitle ), this, SLOT( onOpenWith() ) ); -} - -/*!Update obect browser: - 1.if 'updateModels' true, update existing data models; - 2. update "non-existing" (not loaded yet) data models; - 3. update object browser if it exists */ -void SalomeApp_Application::updateObjectBrowser( const bool updateModels ) -{ - // update "non-existing" (not loaded yet) data models - SalomeApp_Study* study = dynamic_cast(activeStudy()); - if ( study ) - { - _PTR(Study) stdDS = study->studyDS(); - if( stdDS ) - { - for ( _PTR(SComponentIterator) it ( stdDS->NewComponentIterator() ); it->More(); it->Next() ) - { - _PTR(SComponent) aComponent ( it->Value() ); - - if ( aComponent->ComponentDataType() == "Interface Applicative" ) - continue; // skip the magic "Interface Applicative" component - - getWindow( WT_ObjectBrowser ); - const bool isAutoUpdate = objectBrowser()->autoUpdate(); - objectBrowser()->setAutoUpdate( false ); - SalomeApp_DataModel::synchronize( aComponent, study ); - objectBrowser()->setAutoUpdate( isAutoUpdate ); - } - } - } - - // create data objects that correspond to GUI state save points - if ( study ) updateSavePointDataObjects( study ); - - // update existing data models (already loaded SComponents) - LightApp_Application::updateObjectBrowser( updateModels ); -} - -/*!Display Catalog Genenerator dialog */ -void SalomeApp_Application::onCatalogGen() -{ - ToolsGUI_CatalogGeneratorDlg aDlg( desktop() ); - aDlg.exec(); -} - -/*!Display Registry Display dialog */ -void SalomeApp_Application::onRegDisplay() -{ - CORBA::ORB_var anOrb = orb(); - ToolsGUI_RegWidget* regWnd = ToolsGUI_RegWidget::GetRegWidget( anOrb, desktop() ); - regWnd->show(); - regWnd->raise(); - regWnd->activateWindow(); -} - -/*!find original object by double click on item */ -void SalomeApp_Application::onDblClick( SUIT_DataObject* theObj ) -{ - SalomeApp_DataObject* obj = dynamic_cast( theObj ); - SalomeApp_Study* study = dynamic_cast( activeStudy() ); - - if( study && obj ) - { - QString entry = obj->entry(); - _PTR(SObject) sobj = study->studyDS()->FindObjectID( entry.toStdString() ), ref; - - if( sobj && sobj->ReferencedObject( ref ) ) - { - entry = ref->GetID().c_str(); - - SUIT_DataOwnerPtrList aList; - aList.append( new LightApp_DataOwner( entry ) ); - selectionMgr()->setSelected( aList, false ); - - SUIT_DataBrowser* ob = objectBrowser(); - - QModelIndexList aSelectedIndexes = ob->selectedIndexes(); - if ( !aSelectedIndexes.isEmpty() ) - ob->treeView()->scrollTo( aSelectedIndexes.first() ); - } - } -} - -/*! - Creates new view manager - \param type - type of view manager -*/ -SUIT_ViewManager* SalomeApp_Application::newViewManager(const QString& type) -{ - return createViewManager(type); -} - - -/*!Global utility funciton, returns selected GUI Save point object's ID */ -int getSelectedSavePoint( const LightApp_SelectionMgr* selMgr ) -{ - SALOME_ListIO aList; - selMgr->selectedObjects( aList ); - Handle(SALOME_InteractiveObject) aIObj = aList.First(); - QString entry( aIObj->getEntry() ); - QString startStr = QObject::tr( "SAVE_POINT_DEF_NAME" ); - if ( !entry.startsWith( startStr ) ) // it's a "GUI state" object - return -1; - bool ok; // conversion to integer is ok? - int savePoint = entry.right( entry.length() - startStr.length() ).toInt( &ok ); - return ok ? savePoint : -1; -} - -/*!Called on Restore GUI State popup command*/ -void SalomeApp_Application::onRestoreGUIState() -{ - int savePoint = ::getSelectedSavePoint( selectionMgr() ); - if ( savePoint == -1 ) - return; - SalomeApp_VisualState( this ).restoreState( savePoint ); -} - -/*!Called on Rename GUI State popup command*/ -void SalomeApp_Application::onRenameGUIState() -{ - int savePoint = ::getSelectedSavePoint( selectionMgr() ); - if ( savePoint == -1 ) - return; - SalomeApp_Study* study = dynamic_cast( activeStudy() ); - if ( !study ) - return; - - QString newName = LightApp_NameDlg::getName( desktop(), study->getNameOfSavePoint( savePoint ) ); - if ( !newName.isNull() && !newName.isEmpty() ) { - study->setNameOfSavePoint( savePoint, newName ); - updateSavePointDataObjects( study ); - // temporary commented - //objectBrowser()->updateTree( study->root() ); - } -} - - -/*!Called on Delete GUI State popup command*/ -void SalomeApp_Application::onDeleteGUIState() -{ - int savePoint = ::getSelectedSavePoint( selectionMgr() ); - if ( savePoint == -1 ) - return; - SalomeApp_Study* study = dynamic_cast( activeStudy() ); - if ( !study ) - return; - - study->removeSavePoint( savePoint ); - updateSavePointDataObjects( study ); -} - -/*!Called on New study operation*/ -void SalomeApp_Application::onStudyCreated( SUIT_Study* study ) -{ - LightApp_Application::onStudyCreated( study ); - - objectBrowserColumnsVisibility(); -} - -/*!Called on Save study operation*/ -void SalomeApp_Application::onStudySaved( SUIT_Study* study ) -{ - LightApp_Application::onStudySaved( study ); - - // temporary commented - /*if ( objectBrowser() ) { - updateSavePointDataObjects( dynamic_cast( study ) ); - objectBrowser()->updateTree( study->root() ); - }*/ -} - -/*!Called on Open study operation*/ -void SalomeApp_Application::onStudyOpened( SUIT_Study* study ) -{ - LightApp_Application::onStudyOpened( study ); - - objectBrowserColumnsVisibility(); - - // temporary commented - /*if ( objectBrowser() ) { - updateSavePointDataObjects( dynamic_cast( study ) ); - objectBrowser()->updateTree( study->root() ); - }*/ -} - -/*! updateSavePointDataObjects: syncronize data objects that correspond to save points (gui states)*/ -void SalomeApp_Application::updateSavePointDataObjects( SalomeApp_Study* study ) -{ - // temporary commented - //OB_Browser* ob = objectBrowser(); - - if ( !study /*|| !ob */) // temporary commented - return; - - // find GUI states root object - SUIT_DataObject* guiRootObj = 0; - DataObjectList ch; - study->root()->children( ch ); - DataObjectList::const_iterator it = ch.begin(), last = ch.end(); - for ( ; it != last ; ++it ) { - if ( dynamic_cast( *it ) ) { - guiRootObj = *it; - break; - } - } - std::vector savePoints = study->getSavePoints(); - // case 1: no more save points but they existed in study's tree - if ( savePoints.empty() && guiRootObj ) { - delete guiRootObj; - return; - } - // case 2: no more save points but root does not exist either - if ( savePoints.empty() && !guiRootObj ) - return; - // case 3: save points but no root for them - create it - if ( !savePoints.empty() && !guiRootObj ) - guiRootObj = new SalomeApp_SavePointRootObject( study->root() ); - // case 4: everything already exists.. here may be a problem: we want "GUI states" root object - // to be always the last one in the tree. Here we check - if it is not the last one - remove and - // re-create it. - if ( guiRootObj->nextBrother() ) { - study->root()->removeChild(guiRootObj); - study->root()->appendChild(guiRootObj); - //study->root()->dump(); - } - - // store data objects in a map id-to-DataObject - QMap mapDO; - ch.clear(); - guiRootObj->children( ch ); - for( it = ch.begin(), last = ch.end(); it != last ; ++it ) { - SalomeApp_SavePointObject* dobj = dynamic_cast( *it ); - if ( dobj ) - mapDO[dobj->getId()] = dobj; - } - - // iterate new save points. if DataObject with such ID not found in map - create DataObject - // if in the map - remove it from map. - for ( int i = 0; i < savePoints.size(); i++ ) - if ( !mapDO.contains( savePoints[i] ) ) - new SalomeApp_SavePointObject( guiRootObj, savePoints[i], study ); - else - mapDO.remove( savePoints[i] ); - - // delete DataObjects that are still in the map -- their IDs were not found in data model - for ( QMap::Iterator it = mapDO.begin(); it != mapDO.end(); ++it ) - delete it.value(); -} - -/*! Check data object */ -bool SalomeApp_Application::checkDataObject(LightApp_DataObject* theObj) -{ - if (theObj) - return true; - - return false; -} - -/*! Process standard messages from desktop */ -void SalomeApp_Application::onDesktopMessage( const QString& message ) -{ - // update object browser - if ( message.toLower() == "updateobjectbrowser" || - message.toLower() == "updateobjbrowser" ) - updateObjectBrowser(); -} - -/*! - Opens other study into active Study. If Study is empty - creates it. - \param theName - name of study -*/ -bool SalomeApp_Application::useStudy( const QString& theName ) -{ - createEmptyStudy(); - SalomeApp_Study* aStudy = dynamic_cast( activeStudy() ); - bool res = false; - if (aStudy) - res = aStudy->loadDocument( theName ); - updateDesktopTitle(); - updateCommandsStatus(); - return res; -} - -/*! Show/hide object browser colums according to preferences */ -void SalomeApp_Application::objectBrowserColumnsVisibility() -{ - if ( objectBrowser() ) - for ( int i = SalomeApp_DataObject::EntryIdx; i <= SalomeApp_DataObject::RefEntryIdx; i++ ) - objectBrowser()->treeView()->setColumnHidden( i, - !(resourceMgr()->booleanValue( "ObjectBrowser", - QString().sprintf( "visibility_column_%d", i-1 ), - true )) ); -} diff --git a/src/SalomeApp/SalomeApp_Application.h b/src/SalomeApp/SalomeApp_Application.h deleted file mode 100644 index c7c01846e..000000000 --- a/src/SalomeApp/SalomeApp_Application.h +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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: SalomeApp_Application.h -// Created: 10/22/2004 3:37:25 PM -// Author: Sergey LITONIN -// Copyright (C) CEA 2004 - -#ifndef SALOMEAPP_APPLICATION_H -#define SALOMEAPP_APPLICATION_H - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#include "SalomeApp.h" -#include - -#include - -//#include -//#include CORBA_CLIENT_HEADER(SALOMEDS) -#include - -#include "SALOMEDSClient.hxx" - -class LightApp_Preferences; -class SalomeApp_Study; -class SUIT_DataObject; - -class SALOME_LifeCycleCORBA; - - -#ifdef WIN32 -#pragma warning( disable:4251 ) -#endif - -/*! - \class SalomeApp_Application - \brief Application containing SalomeApp module or LightApp module -*/ - -class SALOMEAPP_EXPORT SalomeApp_Application : public LightApp_Application -{ - Q_OBJECT - -public: - enum { MenuToolsId = 5 }; - enum { DumpStudyId = LightApp_Application::UserID, LoadScriptId, PropertiesId, - CatalogGenId, RegDisplayId, SaveGUIStateId, FileLoadId, UserID }; - -protected: - enum { OpenRefresh = LightApp_Application::OpenReload + 1 }; - enum { CloseUnload = LightApp_Application::CloseDiscard + 1 }; - enum { LoadStudyId = LightApp_Application::OpenStudyId + 1 }; - -public: - SalomeApp_Application(); - virtual ~SalomeApp_Application(); - - virtual void updateObjectBrowser( const bool = true ); - - virtual QString getFileFilter() const; - - virtual void start(); - - virtual void contextMenuPopup( const QString&, QMenu*, QString& ); - - virtual bool checkDataObject(LightApp_DataObject* theObj); - - static CORBA::ORB_var orb(); - static SALOMEDSClient_StudyManager* studyMgr(); - static SALOME_NamingService* namingService(); - static SALOME_LifeCycleCORBA* lcc(); - static QString defaultEngineIOR(); - - SUIT_ViewManager* newViewManager(const QString&); - void updateSavePointDataObjects( SalomeApp_Study* ); - - virtual bool isPossibleToClose( bool& ); - - virtual bool useStudy( const QString& ); - -public slots: - virtual void onLoadDoc(); - virtual bool onLoadDoc( const QString& ); - virtual void onCloseDoc( bool ask = true); - - virtual void onExit(); - virtual void onCopy(); - virtual void onPaste(); - void onSaveGUIState();// called from VISU - -protected slots: - void onStudyCreated( SUIT_Study* ); - void onStudySaved( SUIT_Study* ); - void onStudyOpened( SUIT_Study* ); - void onDesktopMessage( const QString& ); - -protected: - virtual void createActions(); - virtual SUIT_Study* createNewStudy(); - virtual QWidget* createWindow( const int ); - - virtual void updateCommandsStatus(); - virtual void onSelectionChanged(); - - virtual void createPreferences( LightApp_Preferences* ); - virtual void updateDesktopTitle(); - - virtual bool closeAction( const int, bool& ); - virtual int closeChoice( const QString& ); - - virtual int openChoice( const QString& ); - virtual bool openAction( const int, const QString& ); - - virtual QMap activateModuleActions() const; - virtual void moduleActionSelected( const int ); - - void objectBrowserColumnsVisibility(); - -private slots: - void onDeleteInvalidReferences(); - void onDblClick( SUIT_DataObject* ); - void onProperties(); - void onDumpStudy(); - void onLoadScript(); - - void onDeleteGUIState(); - void onRestoreGUIState(); - void onRenameGUIState(); - - void onCatalogGen(); - void onRegDisplay(); - void onOpenWith(); -}; - -#ifdef WIN32 -#pragma warning( default:4251 ) -#endif - -#endif diff --git a/src/SalomeApp/SalomeApp_CheckFileDlg.cxx b/src/SalomeApp/SalomeApp_CheckFileDlg.cxx deleted file mode 100644 index 866e06fbb..000000000 --- a/src/SalomeApp/SalomeApp_CheckFileDlg.cxx +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 "SalomeApp_CheckFileDlg.h" - -#include -#include -#include -#include - -/*! -Constructor -*/ -SalomeApp_CheckFileDlg::SalomeApp_CheckFileDlg( QWidget* parent, bool open, const QString& theCheckBoxName, bool showQuickDir, bool modal) : -SUIT_FileDlg( parent, open, showQuickDir, modal ) -{ - QGridLayout* grid = ::qobject_cast( layout() ); - if ( grid ) - { - myCheckBox = new QCheckBox( theCheckBoxName, this ); - QLabel* label = new QLabel("", this); - QPushButton* pb = new QPushButton(this); - - int row = grid->rowCount(); - grid->addWidget( label, row, 0 ); - grid->addWidget( myCheckBox, row, 1 ); - grid->addWidget( pb, row, 2 ); - - pb->hide(); - } -} - -/*! -Destructor -*/ -SalomeApp_CheckFileDlg::~SalomeApp_CheckFileDlg() -{ - -} - -/*!Sets checked.*/ -void SalomeApp_CheckFileDlg::SetChecked( bool check ) -{ - myCheckBox->setChecked(check); -} - -/*!Is checked? - *\retval boolean - true, check box is checked, else false. - */ -bool SalomeApp_CheckFileDlg::IsChecked() const -{ - return myCheckBox->isChecked(); -} diff --git a/src/SalomeApp/SalomeApp_CheckFileDlg.h b/src/SalomeApp/SalomeApp_CheckFileDlg.h deleted file mode 100644 index 53e56683c..000000000 --- a/src/SalomeApp/SalomeApp_CheckFileDlg.h +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 SALOMEAPP_CHECKFILEDIALOG_H -#define SALOMEAPP_CHECKFILEDIALOG_H - -#include - -#include - -class QCheckBox; - -class SALOMEAPP_EXPORT SalomeApp_CheckFileDlg : public SUIT_FileDlg -{ - Q_OBJECT - -public: - SalomeApp_CheckFileDlg( QWidget*, bool open, const QString& theCheckBoxName, bool showQuickDir = true, bool modal = true ); - virtual ~SalomeApp_CheckFileDlg(); - -public: - void SetChecked( bool check ); - bool IsChecked() const; - -protected: - QCheckBox* myCheckBox; -}; - -#endif diff --git a/src/SalomeApp/SalomeApp_DataModel.cxx b/src/SalomeApp/SalomeApp_DataModel.cxx deleted file mode 100644 index 20886c233..000000000 --- a/src/SalomeApp/SalomeApp_DataModel.cxx +++ /dev/null @@ -1,399 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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: SalomeApp_DataModel.cxx -// Created: 10/25/2004 10:36:06 AM -// Author: Sergey LITONIN -// Copyright (C) CEA 2004 - -#include "SalomeApp_DataModel.h" -#include "SalomeApp_Study.h" -#include "SalomeApp_DataObject.h" -#include "SalomeApp_Module.h" -#include "SalomeApp_Application.h" - -#include - -#include -#include - -#include -#include CORBA_SERVER_HEADER(SALOME_Exception) - -typedef _PTR(SObject) kerPtr; -typedef SUIT_DataObject* suitPtr; - -/*! - \class SalomeApp_DataModelSync - Auxiliary class for synchronizing tree of kernel objects and SUIT_DataObjects -*/ -class SalomeApp_DataModelSync -{ -public: - SalomeApp_DataModelSync( _PTR( Study ), SUIT_DataObject* ); - - bool isEqual( const kerPtr&, const suitPtr& ) const; - kerPtr nullSrc() const; - suitPtr nullTrg() const; - suitPtr createItem( const kerPtr&, const suitPtr&, const suitPtr& ) const; - void updateItem( const kerPtr&, const suitPtr& ) const; - void deleteItemWithChildren( const suitPtr& ) const; - QList children( const kerPtr& ) const; - QList children( const suitPtr& ) const; - suitPtr parent( const suitPtr& ) const; - -private: - bool isCorrect( const kerPtr& ) const; - -private: - _PTR( Study ) myStudy; - SUIT_DataObject* myRoot; -}; - -/*! - Constructor -*/ -SalomeApp_DataModelSync::SalomeApp_DataModelSync( _PTR( Study ) aStudy, SUIT_DataObject* aRoot ) -: myStudy( aStudy ), - myRoot( aRoot ) -{ -} - -/*! - \return true if kernel object is correct (has non empty name or is reference) -*/ -bool SalomeApp_DataModelSync::isCorrect( const kerPtr& so ) const -{ - kerPtr refObj; - QString name = so->GetName().c_str(); - _PTR( GenericAttribute ) anAttr; - bool isDraw = true; - if ( so->FindAttribute(anAttr, "AttributeDrawable") ) - { - _PTR(AttributeDrawable) aAttrDraw = anAttr; - isDraw = aAttrDraw->IsDrawable(); - } - bool res = so && ( so->GetName().size() || so->ReferencedObject( refObj ) ) && isDraw; - return res; -} - -/*! - Creates SUIT object by KERNEL object - \param so - corresponding KERNEL object - \param parent - parent for SUIT object - \param after - previous sibling for SUIT object - \param prepend - SUIT object must be added to start of children list -*/ -suitPtr SalomeApp_DataModelSync::createItem( const kerPtr& so, - const suitPtr& parent, - const suitPtr& after ) const -{ - if( !isCorrect( so ) ) - return 0; - - _PTR(SComponent) aSComp( so ); - suitPtr nitem = aSComp ? new SalomeApp_ModuleObject( aSComp, 0 ) : - new SalomeApp_DataObject( so, 0 ); - if( parent ) { - int pos = after ? parent->childPos( after ) : 0; - parent->insertChild( nitem, pos+1 ); - } - else if( myRoot ) { - myRoot->appendChild( nitem ); - } - return nitem; -} - -/*! - Deletes object with all children - \param p - SUIT object -*/ -void SalomeApp_DataModelSync::deleteItemWithChildren( const suitPtr& p ) const -{ - if( !p ) - return; - - DataObjectList ch; - p->children( ch ); - DataObjectList::const_iterator anIt = ch.begin(), aLast = ch.end(); - for( ; anIt!=aLast; anIt++ ) - deleteItemWithChildren( *anIt ); - delete p; -} - -/*! - \return true if objects correspond each other at all - \param p - kernel object - \param q - suit object -*/ -bool SalomeApp_DataModelSync::isEqual( const kerPtr& p, const suitPtr& q ) const -{ - LightApp_ModuleObject* lobj = dynamic_cast( q ); - SalomeApp_DataObject* sobj = dynamic_cast( q ); - _PTR( SComponent ) aComp( p ); - bool res = ( !p && !q ) || - ( lobj && !sobj && aComp ) || - ( sobj && isCorrect( p ) && p->GetID().c_str()==sobj->entry() ); - return res; -} - -/*! - \return null kernel object -*/ -kerPtr SalomeApp_DataModelSync::nullSrc() const -{ - return kerPtr(); -} - -/*! - \return null suit object -*/ -suitPtr SalomeApp_DataModelSync::nullTrg() const -{ - return 0; -} - -/*! - Fills list with children of kernel object - \param obj - kernel object - \param ch - list to be filled -*/ -QList SalomeApp_DataModelSync::children( const kerPtr& obj ) const -{ - QList ch; - - _PTR(ChildIterator) it ( myStudy->NewChildIterator( obj ) ); - for( ; it->More(); it->Next() ) - ch.append( it->Value() ); - return ch; -} - -/*! - Fills list with children of SUIT object - \param p - SUIT object - \param ch - list to be filled -*/ -QList SalomeApp_DataModelSync::children( const suitPtr& p ) const -{ - QList ch; - if ( p ) - ch = p->children(); - return ch; -} - -/*! - \return parent of SUIT object - \param p - SUIT object -*/ -suitPtr SalomeApp_DataModelSync::parent( const suitPtr& p ) const -{ - return p ? p->parent(): 0; -} - -/*! - Updates SUIT object - \param p - SUIT object -*/ -void SalomeApp_DataModelSync::updateItem( const kerPtr& obj, const suitPtr& ) const -{ -} - -/*! - Auxiliary function, shows SUIT tree -*/ -void showTree( SUIT_DataObject* root ) -{ - qDebug( root ? "" : "" ); - if( !root ) - return; - - SUIT_DataObjectIterator it( root, SUIT_DataObjectIterator::DepthLeft ); - for( ; it.current(); ++it ) - { - QString marg; marg.fill( ' ', 3*it.depth() ); - QString nnn = "%1 '%2'"; - qDebug( nnn.arg( marg ).arg( it.current()->name() ).toLatin1() ); - } -} - -/*! - Constructor -*/ -SalomeApp_DataModel::SalomeApp_DataModel( CAM_Module* theModule ) -: LightApp_DataModel( theModule ) -{ -} - -/*! - Destructor -*/ -SalomeApp_DataModel::~SalomeApp_DataModel() -{ -} - -/*! - Opens data model -*/ -bool SalomeApp_DataModel::open( const QString& name, CAM_Study* study, QStringList ) -{ - SalomeApp_Study* aDoc = dynamic_cast( study ); - if ( !aDoc ) - return false; - - QString anId = getRootEntry( aDoc ); - if ( anId.isEmpty() ) - return true; // Probably nothing to load - - _PTR(Study) aStudy ( aDoc->studyDS() ); // shared_ptr cannot be used here - _PTR(SComponent) aSComp ( aStudy->FindComponentID( std::string( anId.toLatin1() ) ) ); - if ( aSComp ) - updateTree( aSComp, aDoc ); - - QStringList listOfFiles; - LightApp_DataModel::open(name, study, listOfFiles); - return true; -} - -/*! - Creates data model -*/ -bool SalomeApp_DataModel::create( CAM_Study* theStudy ) -{ - update(NULL, (LightApp_Study*)theStudy); - return true; -} - -/*! - Updates application. -*/ -void SalomeApp_DataModel::update( LightApp_DataObject*, LightApp_Study* study ) -{ - SalomeApp_Study* aSStudy = dynamic_cast(study); - LightApp_RootObject* studyRoot = 0; - _PTR(SComponent) sobj; - SalomeApp_DataObject* modelRoot = dynamic_cast( root() ); - if ( !modelRoot ){ // not yet connected to a study -> try using argument - if ( !aSStudy ) - aSStudy = dynamic_cast( getModule()->getApp()->activeStudy() ); - if ( aSStudy ){ - studyRoot = dynamic_cast( aSStudy->root() ); - QString anId = getRootEntry( aSStudy ); - if ( !anId.isEmpty() ){ // if nothing is published in the study for this module -> do nothing - _PTR(Study) aStudy ( aSStudy->studyDS() ); - sobj = aStudy->FindComponentID( std::string( anId.toLatin1() ) ); - } - } - } - else{ - studyRoot = dynamic_cast( modelRoot->root() ); - if ( studyRoot ) { - aSStudy = dynamic_cast( studyRoot->study() ); // value should not change here theoretically, but just to make sure - if ( aSStudy ) { - _PTR(Study) aStudy ( aSStudy->studyDS() ); - // modelRoot->object() cannot be reused here: it is about to be deleted by buildTree() soon - sobj = aStudy->FindComponentID( std::string( modelRoot->entry().toLatin1() ) ); - } - } - } - if ( sobj && aSStudy ) - updateTree( sobj, aSStudy ); -} - -/*! - Synchronizes kernel tree and suit data tree starting from component 'sobj' -*/ -SUIT_DataObject* SalomeApp_DataModel::synchronize( const _PTR( SComponent )& sobj, SalomeApp_Study* study ) -{ - if( !study || !study->root() || !sobj ) - return 0; - - DataObjectList ch; study->root()->children( ch ); - DataObjectList::const_iterator anIt = ch.begin(), aLast = ch.end(); - SUIT_DataObject* suitObj = 0; - for( ; anIt!=aLast; anIt++ ) - { - LightApp_DataObject* dobj = dynamic_cast( *anIt ); - if( dobj && dobj->name() == sobj->GetName().c_str() ) - { - suitObj = dobj; - break; - } - } - - SalomeApp_DataModelSync sync( study->studyDS(), study->root() ); - - if( !suitObj || dynamic_cast( suitObj ) ) - return ::synchronize( sobj, suitObj, sync ); - else - return 0; -} - -/*! - Updates tree. -*/ -void SalomeApp_DataModel::updateTree( const _PTR( SComponent )& comp, SalomeApp_Study* study ) -{ - SalomeApp_ModuleObject* aNewRoot = dynamic_cast( synchronize( comp, study ) ); - if( aNewRoot ) - { - aNewRoot->setDataModel( this ); - setRoot( aNewRoot ); - } -} - -/*! - \return module -*/ -SalomeApp_Module* SalomeApp_DataModel::getModule() const -{ - return dynamic_cast( module() ); -} - -/*! - \return study -*/ -SalomeApp_Study* SalomeApp_DataModel::getStudy() const -{ - if(!root()) return 0; - LightApp_RootObject* aRoot = dynamic_cast( root()->root() ); - if ( !aRoot ) - return 0; - SalomeApp_Study* aStudy = dynamic_cast( aRoot->study() ); - if ( !aStudy ) - return 0; - return aStudy; -} - -/*! - \return study entry corresponding to this data model -*/ -QString SalomeApp_DataModel::getRootEntry( SalomeApp_Study* study ) const -{ - QString anEntry; - if ( root() && root()->root() ) { // data model already in a study - SalomeApp_DataObject* anObj = dynamic_cast( root() ); - if ( anObj ) - anEntry = anObj->entry(); - } - else if ( study && study->studyDS() ) { // this works even if is null - _PTR(SComponent) aSComp( study->studyDS()->FindComponent( module()->name().toStdString() ) ); - if ( aSComp ) - anEntry = aSComp->GetID().c_str(); - } - return anEntry; -} diff --git a/src/SalomeApp/SalomeApp_DataModel.h b/src/SalomeApp/SalomeApp_DataModel.h deleted file mode 100644 index bccc327e6..000000000 --- a/src/SalomeApp/SalomeApp_DataModel.h +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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: SalomeApp_DataModel.h -// Created: 10/25/2004 10:32:33 AM -// Author: Sergey LITONIN -// Copyright (C) CEA 2004 - -#ifndef SALOMEAPP_DATAMODEL_H -#define SALOMEAPP_DATAMODEL_H - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#include "SalomeApp.h" -#include "LightApp_DataModel.h" - -#include "SALOMEDSClient.hxx" - -class SalomeApp_Module; -class SalomeApp_Study; -class SUIT_DataObject; -class LightApp_DataObject; - -// Class : SalomeApp_DataModel -/// Description : Base class of data model -class SALOMEAPP_EXPORT SalomeApp_DataModel : public LightApp_DataModel -{ - Q_OBJECT - -public: - static SUIT_DataObject* synchronize( const _PTR( SComponent )&, SalomeApp_Study* ); - - SalomeApp_DataModel ( CAM_Module* theModule ); - virtual ~SalomeApp_DataModel(); - - virtual bool open( const QString&, CAM_Study*, QStringList ); - virtual bool create( CAM_Study* ); - virtual void update( LightApp_DataObject* = 0, LightApp_Study* = 0 ); - - QString getRootEntry( SalomeApp_Study* ) const; - SalomeApp_Module* getModule() const; - -protected: - SalomeApp_Study* getStudy() const; - virtual void updateTree( const _PTR( SComponent )&, SalomeApp_Study* ); -}; - - -#endif diff --git a/src/SalomeApp/SalomeApp_DataObject.cxx b/src/SalomeApp/SalomeApp_DataObject.cxx deleted file mode 100644 index 4ba451631..000000000 --- a/src/SalomeApp/SalomeApp_DataObject.cxx +++ /dev/null @@ -1,766 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 : SalomeApp_DataObject.cxx -// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// - -#include "SalomeApp_DataObject.h" - -#include "SalomeApp_Study.h" - -#include - -#include -#include - -#include -#include - -/*! - \class SalomeApp_DataObject - \brief Implementation of the data object for use in CORBA-based - SALOME modules. -*/ - -/*! - \brief Constructor. - \param parent parent data object -*/ -SalomeApp_DataObject::SalomeApp_DataObject( SUIT_DataObject* parent ) -: CAM_DataObject( parent ), - LightApp_DataObject( parent ) -{ -} - -/*! - \brief Constructor. - \param sobj SALOMEDS object - \param parent parent data object -*/ -SalomeApp_DataObject::SalomeApp_DataObject( const _PTR(SObject)& sobj, - SUIT_DataObject* parent ) -: CAM_DataObject( parent ), - LightApp_DataObject( parent ) -{ - myObject = sobj; -} - -/*! - \brief Destructor. -*/ -SalomeApp_DataObject::~SalomeApp_DataObject() -{ -} - -/*! - \brief Get the number of the columns provided by the data tree. - \return number of the columns -*/ -int SalomeApp_DataObject::columnCount() const -{ - // add "Value", "IOR", and "Reference Entry" columns - return LightApp_DataObject::columnCount() + 3; -} - -/*! - \brief Get column title. - \param index column index - \return title of the specified column -*/ -QString SalomeApp_DataObject::columnTitle( const int index ) const -{ - // add "Value", "IOR", and "Reference Entry" columns - switch ( index ) { - case ValueIdx: - return QObject::tr( "VALUE_COLUMN" ) ; - case IORIdx: - return QObject::tr( "IOR_COLUMN" ) ; - case RefEntryIdx: - return QObject::tr( "REFENTRY_COLUMN" ) ; - default: - break; - } - return LightApp_DataObject::columnTitle( index ); -} - -/*! - \brief Check if the column should appear in the tree view header popup menu - (to show/hide the column). - \param index column index - \return \c true if the column can be shown/hidden -*/ -bool SalomeApp_DataObject::appropriate( const int index ) const -{ - // add "Value", "IOR", and "Reference Entry" columns - return index > EntryIdx && index <= RefEntryIdx ? true : - LightApp_DataObject::appropriate( index ); -} - -/*! - \brief Get data object name. - \return object name -*/ -QString SalomeApp_DataObject::name() const -{ - QString str; - if ( myObject ) - str = myObject->GetName().c_str(); - - if ( str.isEmpty() ) { - _PTR(SObject) refObj = referencedObject(); - if ( refObj ) - str = refObj->GetName().c_str(); - } - - if ( isReference() ) { - if ( !(QString(referencedObject()->GetName().c_str()).isEmpty()) ) - str = QString( "* " ) + str; - else - str = QString( "" ); - } - return str; -} - -/*! - \brief Get object string identifier. - \return object ID -*/ -QString SalomeApp_DataObject::entry() const -{ - return entry( myObject ); -} - -/*! - \brief Get object text data for the specified column. - - This method returns the data according to the specufied column \a index: - - NameIdx : object name (by calling name() method) - - EntryIdx : object entry (by calling entry() method) - - ValueIdx : object value - - IORIdx : object IOR - - RefEntryIdx : object reference entry - - \param index column index - \return object text data -*/ -QString SalomeApp_DataObject::text( const int index ) const -{ - QString txt; - - // add "Value", "IOR", and "Reference Entry" columns - switch ( index ) - { - case ValueIdx: -#ifndef WIN32 - if ( componentObject() != this ) -#else - if ( componentObject() != (SUIT_DataObject*)this ) -#endif - txt = value( object() ); - if ( txt.isEmpty() ) - txt = value( referencedObject() ); - break; - case IORIdx: - txt = ior( referencedObject() ); - break; - case RefEntryIdx: - if ( isReference() ) - txt = entry( referencedObject() ); - break; - default: - txt = LightApp_DataObject::text( index ); - break; - } - return txt; -} - -/*! - \brief Get data object icon for the specified column. - \param index column index - \return object icon for the specified column -*/ -QPixmap SalomeApp_DataObject::icon( const int index ) const -{ - // we display icon only for the first (NameIdx) column - if ( index == NameIdx ) { - _PTR(GenericAttribute) anAttr; - if ( myObject && myObject->FindAttribute( anAttr, "AttributePixMap" ) ){ - _PTR(AttributePixMap) aPixAttr ( anAttr ); - if ( aPixAttr->HasPixMap() ) { - QString componentType = componentDataType(); - QString pixmapID = aPixAttr->GetPixMap().c_str(); - // select a plugin within a component - QStringList plugin_pixmap = pixmapID.split( "::", QString::KeepEmptyParts ); - if ( plugin_pixmap.size() == 2 ) { - componentType = plugin_pixmap.front(); - pixmapID = plugin_pixmap.back(); - } - QString pixmapName = QObject::tr( pixmapID.toLatin1().constData() ); - LightApp_RootObject* aRoot = dynamic_cast( root() ); - if ( aRoot && aRoot->study() ) { - SUIT_ResourceMgr* mgr = aRoot->study()->application()->resourceMgr(); - return mgr->loadPixmap( componentType, pixmapName, false ); - } - } - } - } - return LightApp_DataObject::icon( index ); -} - -/*! - \brief Get data object color for the specified column. - \param role color role - \param index column index (not used) - \return object color for the specified column -*/ -QColor SalomeApp_DataObject::color( const ColorRole role, const int index ) const -{ - // we ignore parameter in order to use the same colors for - // all columns - QColor c; - switch ( role ) - { - case Text: - case Foreground: - // text color (not selected item) - if ( isReference() ) { - if ( !(QString(referencedObject()->GetName().c_str()).isEmpty()) ) - c = QColor( 255, 0, 0 ); // valid reference (red) - else - c = QColor( 200, 200, 200 ); // invalid reference (grayed) - } - else if ( myObject ) { - // get color atrtribute value - _PTR(GenericAttribute) anAttr; - if ( myObject->FindAttribute( anAttr, "AttributeTextColor" ) ) { - _PTR(AttributeTextColor) aColAttr = anAttr; - c = QColor( (int)aColAttr->TextColor().R, (int)aColAttr->TextColor().G, (int)aColAttr->TextColor().B ); - } - } - break; - case Highlight: - // background color for the highlighted item - if ( isReference() ) { - if ( !(QString(referencedObject()->GetName().c_str()).isEmpty()) ) - c = QColor( 255, 0, 0 ); // valid reference (red) - else - c = QColor( 200, 200, 200 ); // invalid reference (grayed) - } - else if ( myObject ) { - // get color atrtribute value - _PTR(GenericAttribute) anAttr; - if( myObject->FindAttribute ( anAttr, "AttributeTextHighlightColor") ) { - _PTR(AttributeTextHighlightColor) aHighColAttr = anAttr; - c = QColor( (int)(aHighColAttr->TextHighlightColor().R), - (int)(aHighColAttr->TextHighlightColor().G), - (int)(aHighColAttr->TextHighlightColor().B)); - } - } - break; - case HighlightedText: - // text color for the highlighted item - if ( isReference() ) - c = QColor( 255, 255, 255 ); // white - break; - } - if ( !c.isValid() ) - c = LightApp_DataObject::color( role, index ); - return c; -} - -/*! - \brief Get data object tooltip for the specified column. - \param index column index (not used) - \return object tooltip for the specified column -*/ -QString SalomeApp_DataObject::toolTip( const int /*index*/ ) const -{ - // we ignore parameter in order to use the same tooltip for - // all columns - return QString( "Object \'%1\', module \'%2\', ID=%3" ).arg( name() ).arg( componentDataType() ).arg( entry() ); -} - -/*! - \brief Get component type. - \return component type -*/ -QString SalomeApp_DataObject::componentDataType() const -{ - // if ( myCompDataType.isEmpty() ) { - const SalomeApp_DataObject* compObj = dynamic_cast( componentObject() ); - if ( compObj && compObj->object() ) - { - _PTR(SComponent) aComp( compObj->object() ); - if ( aComp ) { - SalomeApp_DataObject* that = (SalomeApp_DataObject*)this; - that->myCompDataType = aComp->ComponentDataType().c_str(); - } - } - // } - return myCompDataType; -} - -/*! - \brief Get SALOMEDS object. - \return SALOMEDS object -*/ -_PTR(SObject) SalomeApp_DataObject::object() const -{ - return myObject; -} - -/*! - \brief Check if the data object is a reference. - \return \c true if this data object actually refers to another one -*/ -bool SalomeApp_DataObject::isReference() const -{ - bool isRef = false; - if ( myObject ) - { - _PTR(SObject) refObj; - isRef = myObject->ReferencedObject( refObj ); - } - return isRef; -} - -/*! - \brief Get the object referenced by this one. - \return referenced object -*/ -_PTR(SObject) SalomeApp_DataObject::referencedObject() const -{ - _PTR(SObject) refObj; - _PTR(SObject) obj = myObject; - while ( obj && obj->ReferencedObject( refObj ) ) - obj = refObj; - - return obj; -} - -/*! - \brief Check if the specified column supports custom sorting. - \param index column index - \return \c true if column sorting should be customized - \sa compare() -*/ -bool SalomeApp_DataObject::customSorting( const int index ) const -{ - // perform custom sorting for the "Entry" and "Reference Entry" columns - return index == EntryIdx || index == RefEntryIdx ? true - : LightApp_DataObject::customSorting( index ); -} - -/*! - \brief Compares data from two items for sorting purposes. - - This method is called only for those columns for which customSorting() - method returns \c true. - - \param left first data to compare - \param right second data to compare - \param index column index - \return result of the comparison - \sa customSorting() -*/ -bool SalomeApp_DataObject::compare( const QVariant& left, const QVariant& right, - const int index ) const -{ - // use the same custom sorting for the "Reference Entry" column as for the - // "Entry" column (call base implementation) - return LightApp_DataObject::compare( left, right, index == RefEntryIdx ? EntryIdx : index ); -} - -/*! - \brief Get data object IOR. - \param obj data object - \return data object IOR or null string if IOR is empty -*/ -QString SalomeApp_DataObject::ior( const _PTR(SObject)& obj ) const -{ - QString txt; - if ( obj ) - { - _PTR(GenericAttribute) attr; - if ( obj->FindAttribute( attr, "AttributeIOR" ) ) - { - _PTR(AttributeIOR) iorAttr = attr; - if ( iorAttr ) - { - std::string str = iorAttr->Value(); - txt = QString( str.c_str() ); - } - } - } - return txt; -} - -/*! - \brief Get data object entry identifier. - \param obj data object - \return data object entry identifier or empty object does not have entry -*/ -QString SalomeApp_DataObject::entry( const _PTR(SObject)& obj ) const -{ - QString txt; - if ( obj ) - { - std::string str = obj->GetID(); - txt = QString( str.c_str() ); - } - return txt; -} - -/*! - \brief Get data object value. - \param obj data object - \return data object value or empty string if there is no - value associated to the object -*/ -QString SalomeApp_DataObject::value( const _PTR(SObject)& obj ) const -{ - if ( !obj ) - return QString(); - - QString val; - _PTR(GenericAttribute) attr; - - if ( obj->FindAttribute( attr, "AttributeInteger" ) ) - { - _PTR(AttributeInteger) intAttr = attr; - if ( intAttr ) - val = QString::number( intAttr->Value() ); - } - else if ( obj->FindAttribute( attr, "AttributeReal" ) ) - { - _PTR(AttributeReal) realAttr = attr; - if ( realAttr ) - val = QString::number( realAttr->Value() ); - } - else if ( obj->FindAttribute( attr, "AttributeTableOfInteger" ) ) - { - _PTR(AttributeTableOfInteger) tableAttr = attr; - std::string title = tableAttr->GetTitle(); - val = QString( title.c_str() ); - if ( !val.isEmpty() ) - val += QString( " " ); - val += QString( "[%1,%2]" ).arg( tableAttr->GetNbRows() ).arg( tableAttr->GetNbColumns() ); - } - else if ( obj->FindAttribute( attr, "AttributeTableOfReal" ) ) - { - _PTR(AttributeTableOfReal) tableAttr = attr; - std::string title = tableAttr->GetTitle(); - val = QString( title.c_str() ); - if ( !val.isEmpty() ) - val += QString( " " ); - val += QString( "[%1,%2]" ).arg( tableAttr->GetNbRows() ).arg( tableAttr->GetNbColumns() ); - } - else if ( obj->FindAttribute( attr, "AttributeComment" ) ) - { - _PTR(AttributeComment) comm = attr; - std::string str = comm->Value(); - val = QString( str.c_str() ); - } - - return val; -} - -/*! - \class SalomeApp_ModuleObject - \brief This class is used for optimized access to the SALOMEDS-based - data model from SalomeApp_DataObject class instances. - \sa CAM_ModuleObject class -*/ - -/*! - \brief Constructor. - \param parent parent data object -*/ -SalomeApp_ModuleObject::SalomeApp_ModuleObject( SUIT_DataObject* parent ) -: CAM_DataObject( parent ), - LightApp_DataObject( parent ), - SalomeApp_DataObject( parent ), - CAM_ModuleObject( parent ) -{ -} - -/*! - \brief Constructor. - \param sobj SALOMEDS object - \param parent parent data object -*/ -SalomeApp_ModuleObject::SalomeApp_ModuleObject( const _PTR(SObject)& sobj, - SUIT_DataObject* parent ) -: CAM_DataObject( parent ), - LightApp_DataObject( parent ), - SalomeApp_DataObject( sobj, parent ), - CAM_ModuleObject( parent ) -{ -} - -/*! - \brief Constructor. - \param dm data model - \param sobj SALOMEDS object - \param parent parent data object -*/ -SalomeApp_ModuleObject::SalomeApp_ModuleObject( CAM_DataModel* dm, - const _PTR(SObject)& sobj, - SUIT_DataObject* parent ) -: CAM_DataObject( parent ), - LightApp_DataObject( parent ), - SalomeApp_DataObject( sobj, parent ), - CAM_ModuleObject( dm, parent ) -{ -} - -/*! - \brief Destructor. -*/ -SalomeApp_ModuleObject::~SalomeApp_ModuleObject() -{ -} - -/*! - \brief Get module name. - \return module name -*/ -QString SalomeApp_ModuleObject::name() const -{ - return SalomeApp_DataObject::name(); -} - -/*! - \brief Get data object icon for the specified column. - \param index column index - \return object icon for the specified column -*/ -QPixmap SalomeApp_ModuleObject::icon( const int index ) const -{ - return SalomeApp_DataObject::icon( index ); -} - -/*! - \brief Get data object tooltip for the specified column. - \param index column index - \return object tooltip for the specified column -*/ -QString SalomeApp_ModuleObject::toolTip( const int index ) const -{ - return SalomeApp_DataObject::toolTip( index ); -} - -/*! - \class SalomeApp_RootObject - \brief Root data object for the CORBA-based SALOME application. - - This class is to be instanciated by only one object - the root object - of the SalomeApp data object tree. This object is not shown in the object browser. - The goal of this class is to provide a unified access to SalomeApp_Study - object from SalomeApp_DataObject instances. -*/ - -/*! - \brief Constructor. - \param study pointer to the study -*/ -SalomeApp_RootObject::SalomeApp_RootObject( LightApp_Study* study ) -: CAM_DataObject( 0 ), - LightApp_DataObject( 0 ), - SalomeApp_DataObject( 0 ), - LightApp_RootObject( study ) -{ -} - -/*! - \brief Destructor. -*/ -SalomeApp_RootObject::~SalomeApp_RootObject() -{ -} - -/*! - \brief Get data object name. - \return object name -*/ -QString SalomeApp_RootObject::name() const -{ - return LightApp_RootObject::name(); -} - -/*! - \brief Get object string identifier. - \return object ID -*/ -QString SalomeApp_RootObject::entry() const -{ - return LightApp_RootObject::entry(); -} - -/*! - \brief Get object text data for the specified column. - \param index column index - \return object text data -*/ -QString SalomeApp_RootObject::text( const int index ) const -{ - return LightApp_RootObject::text( index ); -} - -/*! - \brief Get data object icon for the specified column. - \param index column index - \return object icon for the specified column -*/ -QPixmap SalomeApp_RootObject::icon( const int index ) const -{ - return LightApp_RootObject::icon( index ); -} - -/*! - \brief Get data object color for the specified column. - \param role color role - \param index column index (not used) - \return object color for the specified column -*/ -QColor SalomeApp_RootObject::color( const ColorRole role, const int index ) const -{ - return LightApp_RootObject::color( role, index ); -} - -/*! - \brief Get data object tooltip for the specified column. - \param index column index (not used) - \return object tooltip for the specified column -*/ -QString SalomeApp_RootObject::toolTip( const int index ) const -{ - return LightApp_RootObject::toolTip( index ); -} - -/*! - \class SalomeApp_SavePointObject - \brief Represents persistent visual_state object. - - Save point objects are stored in the data model, but NOT in SObjects - structure, so they are handled separately using this special class -*/ - -/*! - \brief Constructor. - \param parent parent data object - \param id save point ID - \param study study -*/ -SalomeApp_SavePointObject::SalomeApp_SavePointObject( SUIT_DataObject* parent, - const int id, - SalomeApp_Study* study ) -: LightApp_DataObject( parent ), - CAM_DataObject( parent ), - myId( id ), - myStudy( study ) -{ -} - -/*! - \brief Destructor. -*/ -SalomeApp_SavePointObject::~SalomeApp_SavePointObject() -{ -} - -/*! - \brief Get save point unique identifier. - \return save point ID -*/ -int SalomeApp_SavePointObject::getId() const -{ - return myId; -} - -/*! - \brief Get object string identifier. - \return object ID -*/ -QString SalomeApp_SavePointObject::entry() const -{ - return QObject::tr( "SAVE_POINT_DEF_NAME" ) + QString::number( myId ); -} - -/*! - \brief Get data object name. - \return object name -*/ -QString SalomeApp_SavePointObject::name() const -{ - return myStudy->getNameOfSavePoint( myId ); -} - -/*! - \brief Get data object icon for the specified column. - \param index column index - \return object icon for the specified column -*/ -QPixmap SalomeApp_SavePointObject::icon( const int /*index*/ ) const -{ - return QPixmap(); -} - -/*! - \brief Get data object tooltip for the specified column. - \param index column index (not used) - \return object tooltip for the specified column -*/ -QString SalomeApp_SavePointObject::toolTip( const int /*index*/ ) const -{ - return QObject::tr( "SAVE_POINT_OBJECT_TOOLTIP" ).arg( name() ); -} - -/*! - \class SalomeApp_SavePointRootObject - \brief Represents parent object for visual_state objects. -*/ - -/*! - \brief Constructor. - \param parent parent object -*/ -SalomeApp_SavePointRootObject::SalomeApp_SavePointRootObject( SUIT_DataObject* parent ) -: SUIT_DataObject( parent ) -{ -} - -/*! - \brief Get data object name. - \return object name -*/ -QString SalomeApp_SavePointRootObject::name() const -{ - return QObject::tr( "SAVE_POINT_ROOT_NAME" ); -} - -/*! - \brief Get data object tooltip for the specified column. - \param index column index (not used) - \return object tooltip for the specified column -*/ -QString SalomeApp_SavePointRootObject::toolTip( const int /*index*/ ) const -{ - return QObject::tr( "SAVE_POINT_ROOT_TOOLTIP" ); -} diff --git a/src/SalomeApp/SalomeApp_DataObject.h b/src/SalomeApp/SalomeApp_DataObject.h deleted file mode 100644 index dbf8267e7..000000000 --- a/src/SalomeApp/SalomeApp_DataObject.h +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 : SalomeApp_DataObject.h -// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// - -#ifndef SALOMEAPP_DATAOBJECT_H -#define SALOMEAPP_DATAOBJECT_H - -#include "SalomeApp.h" -#include -#include - -class SalomeApp_Study; - -class SALOMEAPP_EXPORT SalomeApp_DataObject : public virtual LightApp_DataObject -{ - -public: - //! Column index - enum { - ValueIdx = EntryIdx + 1, //!< value column - IORIdx, //!< IOR column - RefEntryIdx //!< reference entry column - }; - -public: - SalomeApp_DataObject( SUIT_DataObject* = 0 ); - SalomeApp_DataObject( const _PTR(SObject)&, SUIT_DataObject* = 0 ); - virtual ~SalomeApp_DataObject(); - - virtual int columnCount() const; - virtual QString columnTitle( const int = NameIdx ) const; - virtual bool appropriate( const int = NameIdx ) const; - - virtual QString name() const; - virtual QString entry() const; - - virtual QString text( const int = NameIdx ) const; - virtual QPixmap icon( const int = NameIdx ) const; - virtual QColor color( const ColorRole, const int = NameIdx ) const; - virtual QString toolTip( const int = NameIdx ) const; - - virtual _PTR(SObject) object() const; - - bool isReference() const; - _PTR(SObject) referencedObject() const; - - virtual QString componentDataType() const; - - virtual bool customSorting( const int = NameIdx ) const; - virtual bool compare( const QVariant&, const QVariant&, - const int = NameIdx ) const; -private: - QString ior( const _PTR(SObject)& ) const; - QString entry( const _PTR(SObject)& ) const; - QString value( const _PTR(SObject)& ) const; - -private: - _PTR(SObject) myObject; -}; - -class SALOMEAPP_EXPORT SalomeApp_ModuleObject : public SalomeApp_DataObject, - public CAM_ModuleObject -{ -public: - SalomeApp_ModuleObject( SUIT_DataObject* = 0 ); - SalomeApp_ModuleObject( const _PTR(SObject)&, SUIT_DataObject* = 0 ); - SalomeApp_ModuleObject( CAM_DataModel*, const _PTR(SObject)&, SUIT_DataObject* = 0 ); - virtual ~SalomeApp_ModuleObject(); - - virtual QString name() const; - QPixmap icon( const int = NameIdx ) const; - QString toolTip( const int = NameIdx ) const; -}; - -class SALOMEAPP_EXPORT SalomeApp_RootObject : public SalomeApp_DataObject, - public LightApp_RootObject -{ -public: - SalomeApp_RootObject( LightApp_Study* ); - virtual ~SalomeApp_RootObject(); - - QString name() const; - QString entry() const; - QString text( const int = NameIdx ) const; - QPixmap icon( const int = NameIdx ) const; - QColor color( const ColorRole, const int = NameIdx ) const; - QString toolTip( const int = NameIdx ) const; -}; - -class SALOMEAPP_EXPORT SalomeApp_SavePointObject : public virtual LightApp_DataObject -{ -public: - SalomeApp_SavePointObject( SUIT_DataObject*, const int, SalomeApp_Study* ); - virtual ~SalomeApp_SavePointObject(); - - virtual QString name() const; - virtual QString entry() const; - - virtual QPixmap icon( const int = NameIdx ) const; - virtual QString toolTip( const int = NameIdx ) const; - - int getId() const; - -private: - int myId; - SalomeApp_Study* myStudy; -}; - -class SALOMEAPP_EXPORT SalomeApp_SavePointRootObject : public SUIT_DataObject -{ -public: - SalomeApp_SavePointRootObject( SUIT_DataObject* ); - - virtual QString name() const; - virtual QString toolTip( const int = NameIdx ) const; -}; - -#endif diff --git a/src/SalomeApp/SalomeApp_EventFilter.cxx b/src/SalomeApp/SalomeApp_EventFilter.cxx deleted file mode 100755 index 02af6ce0a..000000000 --- a/src/SalomeApp/SalomeApp_EventFilter.cxx +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 "SalomeApp_EventFilter.h" -#include - -#include - -SalomeApp_EventFilter* SalomeApp_EventFilter::myFilter = NULL; - -/*!Constructor.*/ -SalomeApp_EventFilter::SalomeApp_EventFilter() -: QObject() -{ - /* VSR 13/01/03 : installing global event filter for the application */ - qApp->installEventFilter( this ); -} - -/*!Destructor.*/ -SalomeApp_EventFilter::~SalomeApp_EventFilter() -{ - qApp->removeEventFilter( this ); -} - -/*! - Custom event filter -*/ -bool SalomeApp_EventFilter::eventFilter( QObject* o, QEvent* e ) -{ - if ( e->type() == SALOME_EVENT ) - { - SALOME_Event* aSE = (SALOME_Event*)((SALOME_CustomEvent*)e)->data(); - processEvent(aSE); - ((SALOME_CustomEvent*)e)->setData( 0 ); - return true; - } - return QObject::eventFilter( o, e ); -} - -/*!Process event.*/ -void SalomeApp_EventFilter::processEvent( SALOME_Event* theEvent ) -{ - if(theEvent){ - theEvent->Execute(); - // Signal the calling thread that the event has been processed - theEvent->processed(); - } -} - -/*!Create new instance of SalomeApp_EventFilter*/ -void SalomeApp_EventFilter::Init() -{ - if( myFilter==NULL ) - myFilter = new SalomeApp_EventFilter(); -} - -/*!Destroy filter.*/ -void SalomeApp_EventFilter::Destroy() -{ - if( myFilter ) - { - delete myFilter; - myFilter = NULL; - } -} diff --git a/src/SalomeApp/SalomeApp_EventFilter.h b/src/SalomeApp/SalomeApp_EventFilter.h deleted file mode 100755 index dea5cad73..000000000 --- a/src/SalomeApp/SalomeApp_EventFilter.h +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 SALOMEAPP_EVENTFILTER_H -#define SALOMEAPP_EVENTFILTER_H - -#include "SalomeApp.h" -#include - -#if defined WIN32 -#pragma warning( disable: 4251 ) -#endif - -class SALOME_Event; - -/*! - Class provide event filter. -*/ -class SALOMEAPP_EXPORT SalomeApp_EventFilter: public QObject -{ -public: - static void Init(); - static void Destroy(); - -protected: - SalomeApp_EventFilter(); - virtual ~SalomeApp_EventFilter(); - -private: - /*! global event filter for qapplication */ - virtual bool eventFilter( QObject* o, QEvent* e ); - void processEvent( SALOME_Event* ); - -private: - static SalomeApp_EventFilter* myFilter; -}; - -#if defined WIN32 -#pragma warning( default: 4251 ) -#endif - -#endif diff --git a/src/SalomeApp/SalomeApp_ExceptionHandler.cxx b/src/SalomeApp/SalomeApp_ExceptionHandler.cxx deleted file mode 100644 index 77fd55627..000000000 --- a/src/SalomeApp/SalomeApp_ExceptionHandler.cxx +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 "SalomeApp_ExceptionHandler.h" -#include "CASCatch.hxx" - -#include - -#include -#include - -#include - -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 - #include - #include -#else - #include "CASCatch.hxx" -#endif - -/*!Constructor. Initialize by \a floatSignal.*/ -SalomeApp_ExceptionHandler::SalomeApp_ExceptionHandler( const bool floatSignal ) -: SUIT_ExceptionHandler() -{ - // JFA 2006-09-28: PAL10867: suppress signal catching, - // if environment variable DISABLE_SIGNALS_CATCHING is set to 1. - // Commonly this is used with "noexcepthandler" option. - char* envNoCatchSignals = getenv("NOT_INTERCEPT_SIGNALS"); - if (!envNoCatchSignals || !atoi(envNoCatchSignals)) - { - OSD::SetSignal( floatSignal ); - } -} - -/*!Try to call SUIT_ExceptionHandler::internalHandle(o, e), catch if failure.*/ -bool SalomeApp_ExceptionHandler::handleSignals( QObject* o, QEvent* e ) -{ -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 - try { - OCC_CATCH_SIGNALS; -#else - CASCatch_TRY { -#endif - SUIT_ExceptionHandler::internalHandle( o, e ); - } -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 - catch(Standard_Failure) { -#else - CASCatch_CATCH(Standard_Failure) { -#endif - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - throw Standard_Failure( aFail->GetMessageString() ); - } - - return true; -} - -/*!Try to call handleSignals( o, e ), catch and show error message.*/ -bool SalomeApp_ExceptionHandler::handle( QObject* o, QEvent* e ) -{ - bool res = false; - QString title( "Fatal error" ); - - try { - res = handleSignals( o, e ); - } - catch( std::exception& ex ) - { - showMessage( title, QString( ex.what() ) ); - } - catch( Standard_Failure& e ) - { - showMessage( title, QString( e.GetMessageString() ) ); - } -#ifndef WIN32 - catch(...) - { - showMessage( title, "Unknown Exception" ); - } -#endif - - return res; -} - -/*!Create new SUIT_ExceptionHandler*/ -extern "C" SALOMEAPP_EXPORT SUIT_ExceptionHandler* getExceptionHandler() -{ - // MSV 2006-04-26: work around PAL12004 "VTK window => SIGFPE Arithmetic Exception Detected" - // We disable FPE signal as it was in earlier versions of SALOME. It is enabled - // only in debug mode if the environment variable DISABLE_FPE is not set to 1. - bool raiseFPE; -#if defined(_DEBUG_) | defined(_DEBUG) //the Last for WNT default settings - raiseFPE = true; - char* envDisableFPE = getenv("DISABLE_FPE"); - if (envDisableFPE && atoi(envDisableFPE)) - raiseFPE = false; -#else - raiseFPE = false; -#endif - - return new SalomeApp_ExceptionHandler( raiseFPE ); -} diff --git a/src/SalomeApp/SalomeApp_ExceptionHandler.h b/src/SalomeApp/SalomeApp_ExceptionHandler.h deleted file mode 100644 index 4a4c0bdab..000000000 --- a/src/SalomeApp/SalomeApp_ExceptionHandler.h +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 SALOMEAPP_EXCEPTIONHANDLER_H -#define SALOMEAPP_EXCEPTIONHANDLER_H - -#include "SalomeApp.h" - -#include - -class SALOMEAPP_EXPORT SalomeApp_ExceptionHandler : public SUIT_ExceptionHandler -{ -public: - SalomeApp_ExceptionHandler( const bool ); - virtual bool handle( QObject*, QEvent* ); - -protected: - virtual bool handleSignals( QObject*, QEvent* ); -}; - -#endif diff --git a/src/SalomeApp/SalomeApp_ExitDlg.cxx b/src/SalomeApp/SalomeApp_ExitDlg.cxx deleted file mode 100644 index bac5b2d09..000000000 --- a/src/SalomeApp/SalomeApp_ExitDlg.cxx +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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: SalomeApp_ExitDlg.cxx -// Author: Margarita KARPUNINA, Open CASCADE S.A.S. -// - -#include "SalomeApp_ExitDlg.h" - -#include -#include -#include -#include -#include -#include -#include - -/*! - * \brief creates a Exit dialog box - * \param parent a parent widget - * \param modal bool argument, if true the dialog box is a modal dialog box - * \param f style flags - */ -SalomeApp_ExitDlg::SalomeApp_ExitDlg( QWidget* parent ) - : QDialog( parent ) -{ - setModal( true ); - setWindowTitle( tr( "INF_DESK_EXIT" ) ); - - QVBoxLayout* m_vbL = new QVBoxLayout( this ); - m_vbL->setMargin( 11 ); - m_vbL->setSpacing( 6 ); - - QLabel* m_lIcon = new QLabel( this ); - QPixmap pm = QMessageBox::standardIcon( QMessageBox::Question ); - m_lIcon->setPixmap( pm ); - m_lIcon->setScaledContents( false ); - m_lIcon->setAlignment( Qt::AlignCenter ); - - QLabel* m_lDescr = new QLabel( this ); - m_lDescr->setText( tr( "QUE_DESK_EXIT" ) ); - m_lDescr->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) ); - - myServersShutdown = new QCheckBox( tr( "SHUTDOWN_SERVERS" ), this ); - myServersShutdown->setChecked( true ); - - QVBoxLayout* m_vl1 = new QVBoxLayout(); - m_vl1->setMargin( 10 ); m_vl1->setSpacing( 16 ); - m_vl1->addWidget( m_lDescr ); - m_vl1->addWidget( myServersShutdown ); - - QHBoxLayout* m_hl1 = new QHBoxLayout(); - m_hl1->setMargin( 0 ); m_hl1->setSpacing( 6 ); - m_hl1->addWidget( m_lIcon ); - m_hl1->addStretch(); - m_hl1->addLayout( m_vl1 ); - m_hl1->addStretch(); - - QPushButton* m_pbOk = new QPushButton( tr( "BUT_OK" ), this ); - QPushButton* m_pbCancel = new QPushButton( tr( "BUT_CANCEL" ), this ); - - QGridLayout* m_hl2 = new QGridLayout(); - m_hl2->setMargin( 0 ); m_hl2->setSpacing( 6 ); - m_hl2->addWidget( m_pbOk, 0, 0 ); - m_hl2->setColumnStretch( 1, 5 ); - m_hl2->addWidget( m_pbCancel, 0, 2 ); - - m_vbL->addStretch(); - m_vbL->addLayout( m_hl1 ); - m_vbL->addStretch(); - m_vbL->addLayout( m_hl2 ); - - connect( m_pbOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); - connect( m_pbCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); -} - -/*! - * \brief Destructor - */ -SalomeApp_ExitDlg::~SalomeApp_ExitDlg() -{ -} - -/*! - * \brief get the check box status - */ -bool SalomeApp_ExitDlg::isServersShutdown() -{ - return myServersShutdown->isChecked(); -} - diff --git a/src/SalomeApp/SalomeApp_ExitDlg.h b/src/SalomeApp/SalomeApp_ExitDlg.h deleted file mode 100644 index 3724e83a4..000000000 --- a/src/SalomeApp/SalomeApp_ExitDlg.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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: SalomeApp_ExitDlg.h -// Author: Margarita KARPUNINA, Open CASCADE S.A.S. -// - -#ifndef SALOMEAPP_EXITDLG_H -#define SALOMEAPP_EXITDLG_H - -#include - -class QCheckBox; - -/*!\class SalomeApp_ExitDlg - * \brief Describes a dialog box shown on question about quit application - */ -class SalomeApp_ExitDlg: public QDialog -{ - Q_OBJECT - -public: - SalomeApp_ExitDlg( QWidget* ) ; - ~SalomeApp_ExitDlg(); - - bool isServersShutdown(); - -private: - QCheckBox* myServersShutdown; -}; - -#endif // SALOMEAPP_EXITDLG_H - diff --git a/src/SalomeApp/SalomeApp_Filter.cxx b/src/SalomeApp/SalomeApp_Filter.cxx deleted file mode 100644 index b3214ba00..000000000 --- a/src/SalomeApp/SalomeApp_Filter.cxx +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 "SalomeApp_Filter.h" - -/*!Constructor.Initialize by study.*/ -SalomeApp_Filter::SalomeApp_Filter( SalomeApp_Study* study ) -{ - myStudy = study; -} - -/*!Destructor. Do nothing.*/ -SalomeApp_Filter::~SalomeApp_Filter() -{ -} - -/*!Gets study.*/ -SalomeApp_Study* SalomeApp_Filter::getStudy() const -{ - return myStudy; -} diff --git a/src/SalomeApp/SalomeApp_Filter.h b/src/SalomeApp/SalomeApp_Filter.h deleted file mode 100644 index 8de24ccdd..000000000 --- a/src/SalomeApp/SalomeApp_Filter.h +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 SALOMEAPP_FILTER_H -#define SALOMEAPP_FILTER_H - -#include "SalomeApp.h" -#include "SUIT_SelectionFilter.h" - -class SalomeApp_Study; - -class SALOMEAPP_EXPORT SalomeApp_Filter: public SUIT_SelectionFilter -{ -public: - SalomeApp_Filter(SalomeApp_Study* study); - ~SalomeApp_Filter(); - -protected: - SalomeApp_Study* getStudy() const; - -private: - SalomeApp_Study* myStudy; -}; - -#endif diff --git a/src/SalomeApp/SalomeApp_ImportOperation.cxx b/src/SalomeApp/SalomeApp_ImportOperation.cxx deleted file mode 100644 index 5047ca732..000000000 --- a/src/SalomeApp/SalomeApp_ImportOperation.cxx +++ /dev/null @@ -1,40 +0,0 @@ -// SALOME SALOMEGUI : implementation of desktop and GUI kernel -// -// 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 : SALOMEGUI_ImportOperation.cxx -// Author : Nicolas REJNERI -// Module : SALOME -// $Header$ - -#include "SalomeApp_ImportOperation.h" -#include - -#ifndef WIN32 -using namespace std; -#endif - -/*!Constructor. Do nothing.*/ -SalomeApp_ImportOperation::SalomeApp_ImportOperation( SUIT_Application* app ) : -SUIT_Operation( app ) -{ -} diff --git a/src/SalomeApp/SalomeApp_ImportOperation.h b/src/SalomeApp/SalomeApp_ImportOperation.h deleted file mode 100644 index 56b895584..000000000 --- a/src/SalomeApp/SalomeApp_ImportOperation.h +++ /dev/null @@ -1,46 +0,0 @@ -// SALOME SALOMEAPP : implementation of desktop and GUI kernel -// -// 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 : SalomeApp_ImportOperation.h -// Author : Nicolas REJNERI -// Module : SALOME -// $Header$ - -#if !defined SALOMEAPP_IMPORTOPERATION -#define SALOMEAPP_IMPORTOPERATION - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#include - -class SUIT_Application; - -class SalomeApp_ImportOperation : public SUIT_Operation -{ -public: - SalomeApp_ImportOperation( SUIT_Application* ); -}; - -#endif diff --git a/src/SalomeApp/SalomeApp_ListView.cxx b/src/SalomeApp/SalomeApp_ListView.cxx deleted file mode 100644 index e0a70886b..000000000 --- a/src/SalomeApp/SalomeApp_ListView.cxx +++ /dev/null @@ -1,1393 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 : SalomeApp_ListView.cxx -// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// - -#include "SalomeApp_ListView.h" -#include "SalomeApp_Application.h" - -#include "SUIT_ResourceMgr.h" -#include "SUIT_Session.h" - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -/*! - Used for resizing editing widget -*/ -void computeEditGeometry(SalomeApp_ListViewItem* theItem, - SalomeApp_EntityEdit* theWidget) -{ - if (!theItem) - return; - QTreeWidget* aListView = theItem->treeWidget(); - int anEditColumn = theItem->getEditedColumn(); - if (anEditColumn < 0) - return; - - int aX = 0, aY = 0, aW = 0, aH = 0; - - QRect aRect = aListView->visualItemRect(theItem); - aX = aListView->header()->sectionViewportPosition(anEditColumn); - if (aX < 0) - aX = 0; // THIS CAN BE REMOVED - QSize aSize = theWidget->getControl()->sizeHint(); - aH = qMax(aSize.height() , aRect.height() ); - aY = aRect.y() - ((aH - aRect.height()) / 2); - //aW = aListView->columnWidth(anEditColumn); // CAN SUBSTITUTE NEXT 3 ROWS - aW = aListView->viewport()->width() - aX; - if (aW < 0) - aW = 0; - theWidget->setGeometry(aX, aY, aW, aH); -} - -/*! - Constructor -*/ -SalomeApp_ListView::SalomeApp_ListView( QWidget* parent ) - : QTreeWidget/*QtxListView*/( parent ) -{ - myMouseEnabled = true; - myEditingEnabled = false; - setSelectionMode(QAbstractItemView::SingleSelection); - setRootIsDecorated(false); - setAllColumnsShowFocus(false); -// header()->setClickEnabled(false); - header()->setMovable(false); - - myEditedItem = 0; - myEdit = 0; - - viewport()->installEventFilter(this); - - connect(this, SIGNAL(itemSelectionChanged()), - this, SLOT(onSelectionChanged())); - connect(header(), SIGNAL(sizeChange(int, int, int)), - this, SLOT(onHeaderSizeChange(int, int, int))); -} - -/*! - Destructor -*/ -SalomeApp_ListView::~SalomeApp_ListView() -{ - if (myEdit) { - delete myEdit; - } - myEdit = 0; - myEditedItem = 0; -} - -/*! - Updates all data viewer -*/ -void SalomeApp_ListView::updateViewer() -{ - // temporary disconnecting selection changed SIGNAL - blockSignals(true); - QTreeWidgetItemIterator it( this ); - SalomeApp_ListViewItem* aRoot = (SalomeApp_ListViewItem*)(*it); - if (aRoot) - aRoot->updateAllLevels(); - update( contentsRect() );//updateContents(); - // connecting again selection changed SIGNAL - blockSignals(false); - emit itemSelectionChanged(); -} - -/*! - Updates currently selected item(s) -*/ -void SalomeApp_ListView::updateSelected() -{ - // temporary disconnecting selection changed SIGNAL - blockSignals(true); - SalomeApp_ListViewItem* aChild = (SalomeApp_ListViewItem*)(selectedItems().first()); - if (aChild) - aChild->updateAllLevels(); - update( contentsRect() );//updateContents(); - // connecting again selection changed SIGNAL - blockSignals(false); - emit itemSelectionChanged(); -} - -/*! - Returns popup client type -*/ -QString SalomeApp_ListView::popupClientType() const -{ - return "SalomeApp_ListView"; -} - -/*! - Fills popup menu with items -*/ -void SalomeApp_ListView::contextMenuPopup( QMenu* aPopup ) -{ - if (aPopup) { - // add items here... - } -} - -/*! - Clears view -*/ -void SalomeApp_ListView::clear() -{ - if (myEdit) { - delete myEdit; - myEdit = 0; - myEditedItem = 0; - } - QTreeWidget::clear(); -} - -/*! - \return true if mouse events are enabled -*/ -bool SalomeApp_ListView::isMouseEnabled() -{ - return myMouseEnabled; -} - -/*! - Enables/disables mouse events (excluding MouseMove) -*/ -void SalomeApp_ListView::enableMouse(bool enable) -{ - myMouseEnabled = enable; -} - -/*! - Event filter -*/ -bool SalomeApp_ListView::eventFilter(QObject* object, QEvent* event) -{ - if (object == viewport() && - (event->type() == QEvent::MouseButtonPress || - event->type() == QEvent::MouseButtonRelease || - event->type() == QEvent::MouseButtonDblClick) && - !isMouseEnabled()) - return true; - else - return QTreeWidget::eventFilter(object, event); -} - -/*! - Setting editing of items availbale/not available -*/ -void SalomeApp_ListView::enableEditing(bool theFlag) -{ - myEditingEnabled = theFlag; - if (!myEditingEnabled) { - if (myEdit) { - delete myEdit; - myEdit = 0; - myEditedItem = 0; - } - } -} - -/*! - Says if editing is enabled -*/ -bool SalomeApp_ListView::isEnableEditing() -{ - return myEditingEnabled; -} - -/*! - Calls finishEditing(true)... -*/ -void SalomeApp_ListView::accept() -{ - finishEditing(true); -} - -/*! - Slot, called when selection changed in List Viewer -*/ -void SalomeApp_ListView::onSelectionChanged() -{ - if (myEdit) { - finishEditing(true); - delete myEdit; - myEdit = 0; - if (myEditedItem && !myEditedItem->isAccepted()) { - delete myEditedItem; - update( contentsRect() );//updateContents(); - } - myEditedItem = 0; - } - // editing is allowed in Single Selection Mode only - if (selectionMode() != QAbstractItemView::SingleSelection || !isEnableEditing()) - return; - SalomeApp_ListViewItem* anItem = (SalomeApp_ListViewItem*)(selectedItems().first()); - if (anItem) { - if (!anItem->isEditable()) - return; - myEdit = anItem->startEditing(); - if (myEdit) { - connect(myEdit, SIGNAL(returnPressed()), this, SLOT(onEditOk())); - connect(myEdit, SIGNAL(escapePressed()), this, SLOT(onEditCancel())); - myEditedItem = anItem; - myEdit->show(); - myEdit->setFocus(); - } - } -} - -/*! - Called when Data Viewer is resized -*/ -void SalomeApp_ListView::resizeEvent( QResizeEvent * e) -{ - QTreeWidget::resizeEvent(e); - int aW = columnWidth(columnCount()-1); - int aX = header()->sectionPosition(columnCount()-1); - if (aW < width() - frameWidth() * 2 - aX - 1) - setColumnWidth(columnCount()-1, width() - frameWidth() * 2 - aX - 1); - update( contentsRect() );//updateContents(); -} - -/*! - Slot, called when columns sizes are changed -*/ -void SalomeApp_ListView::onHeaderSizeChange(int, int, int) -{ - int aW = columnWidth(columnCount()-1); - int aX = header()->sectionPosition(columnCount()-1); - if (aW < width() - frameWidth() * 2 - aX - 1) - setColumnWidth(columnCount()-1, width() - frameWidth() * 2 - aX - 1); -} - -/*! - Handler for paint event -*/ -void SalomeApp_ListView::viewportPaintEvent(QPaintEvent* e) -{ - QTreeWidget::paintEvent(e); - if (myEditedItem && myEdit) { - computeEditGeometry(myEditedItem, myEdit); - } -} - -/*! - Called when user finishes in editing of item -*/ -void SalomeApp_ListView::onEditOk() -{ - finishEditing(true); -} - -/*! - Called when user cancels item editing -*/ -void SalomeApp_ListView::onEditCancel() -{ - finishEditing(false); -} - -/*! - Finishes editing of entity -*/ -UpdateType SalomeApp_ListView::finishEditing(bool ok) -{ - UpdateType aNeedsUpdate = utCancel; - if (myEditedItem && myEdit) - { - disconnect(myEdit, SIGNAL(returnPressed()), this, SLOT(onEditOk())); - disconnect(myEdit, SIGNAL(escapePressed()), this, SLOT(onEditCancel())); - myEditedItem->setAccepted(true); - if (ok) { - aNeedsUpdate = myEditedItem->finishEditing(myEdit); - if (aNeedsUpdate == utCancel) { - // something to do here on Cancel... - } - else { - // something to do here on OK... - } - // updating contents - switch (aNeedsUpdate) { - case utUpdateItem: - { - if (myEditedItem) - myEditedItem->updateAllLevels(); - break; - } - case utUpdateParent: - { - if (myEditedItem) { - SalomeApp_ListViewItem* aParent = (SalomeApp_ListViewItem*)(myEditedItem->parent()); - if (aParent) - aParent->updateAllLevels(); - else - myEditedItem->updateAllLevels(); - } - break; - } - case utUpdateViewer: - { - updateViewer(); - break; - } - case utUpdateAll: - { - // doing the same as for utUpdateViewer here - // descendants can add extra processing - updateViewer(); - break; - } - default: - break; - } - } - } - - // hide widget - if (myEdit) { - myEdit->hide(); - } - - return aNeedsUpdate; -} - -/*! - \return current tooltip for list view - \retval valid rect in success -*/ -QRect SalomeApp_ListView::tip(QPoint aPos, - QString& aText, - QRect& dspRect, - QFont& dspFnt) const -{ - QRect result( -1, -1, -1, -1 ); - SalomeApp_ListViewItem* aItem = (SalomeApp_ListViewItem*)itemAt( aPos ); - if ( aItem ) { - for (int i = 0; i < columnCount(); i++) { - QRect aItemRect = aItem->itemRect(i); - QRect aTextRect = aItem->textRect(i); - if ( !aItem->text(i).isEmpty() && - ( aItemRect.width() > header()->sectionSize(i) || - aTextRect.left() < 0 || - aTextRect.top() < 0 || - aTextRect.right() > viewport()->width() || - aTextRect.bottom() > viewport()->height() ) ) { - // calculating tip data - aText = aItem->tipText(); - dspRect = aItem->tipRect(); - dspFnt = font(); - if (dspRect.isValid()) { - result = QRect(QPoint(0, aItemRect.top()), - QSize(viewport()->width(), aItemRect.height())); - } - } - } - } - return result; -} - -/*! - Constructor -*/ -SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent) : -QTreeWidgetItem( parent ) -{ - init(); -} - -/*! - Constructor -*/ -SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent, - SalomeApp_ListViewItem* after) : -QTreeWidgetItem( parent, after ) -{ - init(); -} - -/*! - Constructor -*/ -SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent, - const QStringList& theStrings, - const bool theEditable) : -QTreeWidgetItem(parent, theStrings) -{ - init(); - setEditable(theEditable); -} - -/*! - Constructor -*/ -SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent, - const QStringList& theString, - const bool theEditable) : -QTreeWidgetItem(parent, theString) -{ - init(); - setEditable(theEditable); -} - -/*! - Constructor -*/ -SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent, - SalomeApp_ListViewItem* after, - const QString& theName, - const bool theEditable) : -QTreeWidgetItem(parent, after) -{ - setData(0,Qt::DisplayRole,QVariant(theName)); - init(); - setEditable(theEditable); -} - -/*! - Constructor -*/ -SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent, - SalomeApp_ListViewItem* after, - const QString& theName, - const bool theEditable) : -QTreeWidgetItem(parent, after) -{ - setData(0,Qt::DisplayRole,QVariant(theName)); - init(); - setEditable(theEditable); -} - -/*! - Constructor -*/ -SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent, - SalomeApp_ListViewItem* after, - const QString& theName, - const QString& theValue, - const bool theEditable) : -QTreeWidgetItem(parent, after) -{ - setData(0,Qt::DisplayRole,QVariant(theName)); - setData(1,Qt::DisplayRole,QVariant(theValue)); - init(); - setEditable(theEditable); -} - -/*! - Constructor -*/ -SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent, - SalomeApp_ListViewItem* after, - const QString& theName, - const QString& theValue, - const bool theEditable) : -QTreeWidgetItem(parent, after) -{ - setData(0,Qt::DisplayRole,QVariant(theName)); - setData(1,Qt::DisplayRole,QVariant(theValue)); - init(); - setEditable(theEditable); -} - -/*! - Destructor -*/ -SalomeApp_ListViewItem::~SalomeApp_ListViewItem() -{ -} - -/*! - Initialization -*/ -void SalomeApp_ListViewItem::init() -{ - myEditable = false; - myAccepted = true; - myEditingType = (int)SalomeApp_EntityEdit::etLineEdit; - myValueType = (int)SalomeApp_EntityEdit::vtString; - myButtons = 0; - myUserType = -1; -} - -/*! - Returns the depth of this item -*/ -int SalomeApp_ListViewItem::depth() const -{ - int aDepth = 0; - QTreeWidgetItem* aParent = parent(); - while ( aParent ) { - aParent = aParent->parent(); - aDepth++; - } - return aDepth; -} - -/*! - \return text in the first column -*/ -QString SalomeApp_ListViewItem::getName() const -{ - return ( treeWidget()->columnCount() > 0 ) ? text(0) : QString(""); -} - -/*! - Sets text in the first column -*/ -UpdateType SalomeApp_ListViewItem::setName(const QString& theName) -{ - UpdateType aNeedsUpdate = utCancel; - if (treeWidget()->columnCount() > 0) { - setText(0, theName); - aNeedsUpdate = utNone; - } - return aNeedsUpdate; -} - -/*! - \return text in the second column -*/ -QString SalomeApp_ListViewItem::getValue() const -{ - return ( treeWidget()->columnCount() > 1 ) ? text(1) : QString(""); -} - -/*! - Sets text in the second column -*/ -UpdateType SalomeApp_ListViewItem::setValue(const QString& theValue) -{ - UpdateType aNeedsUpdate = utCancel; - if (treeWidget()->columnCount() > 1) { - setText(1, theValue); - aNeedsUpdate = utNone; - } - return aNeedsUpdate; -} - -/*! - \return full path to the entity from the root -*/ -QString SalomeApp_ListViewItem::fullName() -{ - QString aFullName = getName(); - SalomeApp_ListViewItem* aParent = (SalomeApp_ListViewItem*)parent(); - while(aParent != NULL) { - aFullName = aParent->getName() + QString(".") + aFullName; - aParent = (SalomeApp_ListViewItem*)(aParent->parent()); - } - return aFullName; -} - -/*! - expands all entities beginning from this level -*/ -void SalomeApp_ListViewItem::openAllLevels() -{ - setExpanded(true); - QTreeWidgetItemIterator it( this ); - SalomeApp_ListViewItem* aChild = (SalomeApp_ListViewItem*)(*it); - while( aChild ) { - aChild->openAllLevels(); - ++it; - aChild = (SalomeApp_ListViewItem*)(*it); - } -} - -/*! - update all entites beginning from this level -*/ -void SalomeApp_ListViewItem::updateAllLevels() -{ - QTreeWidgetItemIterator it( this ); - SalomeApp_ListViewItem* aChild = (SalomeApp_ListViewItem*)(*it); - while( aChild ) { - aChild->updateAllLevels(); - ++it; - aChild = (SalomeApp_ListViewItem*)(*it); - } -} - -/*! - \return true if entity is editable -*/ -bool SalomeApp_ListViewItem::isEditable() const -{ - return myEditable; -} - -/*! - Sets editable flag fo the entity -*/ -void SalomeApp_ListViewItem::setEditable(bool theEditable) -{ - myEditable = theEditable; -} - -/*! - \return true if entitiy is accepted after editing -*/ -bool SalomeApp_ListViewItem::isAccepted() const -{ - return myAccepted; -} - -/*! - Sets entitiy accepted or not after editing -*/ -void SalomeApp_ListViewItem::setAccepted(bool theAccepted) -{ - myAccepted = theAccepted; -} - -/*! - \retval type of edit control (default is edit box) - \li 0 - edit box - \li 1 - combo box - \li 2 - editable combo box -*/ -int SalomeApp_ListViewItem::getEditingType() -{ - return myEditingType; -} - -/*! - \retval type of edit control (negative value means none) - \li 0 - edit box - \li 1 - combo box - \li 2 - editable combo box -*/ -void SalomeApp_ListViewItem::setEditingType(const int type) -{ - myEditingType = type; -} - -/*! \retval edited column, default is last column - negative value means there are no editable columns -*/ -int SalomeApp_ListViewItem::getEditedColumn() -{ - return treeWidget()->columnCount()-1; -} - -/*! - \retval type of edited value (string, int, double) - default is string -*/ -int SalomeApp_ListViewItem::getValueType() -{ - return myValueType; -} - -/*! - Sets type of edited value -*/ -void SalomeApp_ListViewItem::setValueType(const int valueType) -{ - myValueType = valueType; -} - -/*! - Sets type of edited value -*/ -int SalomeApp_ListViewItem::getUserType() -{ - return myUserType; -} - -/*! - Sets type of edited value -*/ -void SalomeApp_ListViewItem::setUserType(const int userType) -{ - myUserType = userType; -} - -/*! - \return buttons for editing widget (Apply (V), Cancel (X)) - default is both buttons -*/ -int SalomeApp_ListViewItem::getButtons() -{ - return myButtons; -} - -/*! - Sets buttons for editing widget (Apply (V), Cancel (X)) -*/ -void SalomeApp_ListViewItem::setButtons(const int buttons) -{ - myButtons = buttons; -} - -/*! - Creates control for editing and fills it with values -*/ -SalomeApp_EntityEdit* SalomeApp_ListViewItem::startEditing() -{ - SalomeApp_EntityEdit* aWidget = 0; - QTreeWidget* aListView = treeWidget(); - if (aListView) { - if (!isEditable()) - return 0; - int anEditType = getEditingType(); - int aValueType = getValueType(); - int aButtons = getButtons(); - int anEditColumn = getEditedColumn(); - if (anEditColumn < 0 || anEditType < 0) - return 0; - aWidget = new SalomeApp_EntityEdit(aListView->viewport(), - anEditType, - aValueType, - aButtons & SalomeApp_EntityEdit::btApply, - aButtons & SalomeApp_EntityEdit::btCancel); - computeEditGeometry(this, aWidget); - - fillWidgetWithValues(aWidget); - } - return aWidget; -} - -/*! - Fills widget with initial values (list or single value) -*/ -void SalomeApp_ListViewItem::fillWidgetWithValues(SalomeApp_EntityEdit* theWidget) -{ - int anEditColumn = getEditedColumn(); - if (theWidget && anEditColumn >= 0 && !text(anEditColumn).isEmpty()) - theWidget->insertItem(text(anEditColumn), true); -} - -/*! - Finishes editing of entity -*/ -UpdateType SalomeApp_ListViewItem::finishEditing(SalomeApp_EntityEdit* theWidget) -{ - UpdateType aNeedsUpdate = utCancel; - try { - if (theWidget) { - int anEditColumn = getEditedColumn(); - switch (anEditColumn) { - case 0: - aNeedsUpdate = setName(theWidget->getText()); - break; - case 1: - aNeedsUpdate = setValue(theWidget->getText()); - break; - default: - break; - } - } - } - catch (...) { - MESSAGE( "System error has been caught - SalomeApp_ListViewItem::finishEditing" ) - } - return aNeedsUpdate; -} - -/*! - Calculates rectangle which should contain item's tip -*/ -QRect SalomeApp_ListViewItem::tipRect() -{ - QRect aRect = QRect(-1, -1, -1, -1); - QRect aItemRect = treeWidget()->visualItemRect(this); - if ( !aItemRect.isValid() ) - return aItemRect; - - QString aTip = tipText(); - if (!aTip.isEmpty()) { - QRect aRect0 = textRect(0); - QFont aFont(treeWidget()->font()); - QFontMetrics fm(aFont); - int iw = fm.width(aTip); - aRect = QRect(QPoint(aRect0.x() < 0 ? 0 : aRect0.x(), - aRect0.y()), - QSize (iw, - aRect0.height())); - } - return aRect; -} - -/*! - \return text for tooltip -*/ -QString SalomeApp_ListViewItem::tipText() -{ - QString aText = getName(); - if (!getValue().isEmpty()) - aText += QString(" : ") + getValue(); - return aText; -} - -/*! - Calculates rect of item text in viewport coordinates -*/ -QRect SalomeApp_ListViewItem::textRect(const int column) const -{ - QRect aItemRect = treeWidget()->visualItemRect( this ); - if ( !aItemRect.isValid() ) - return aItemRect; - - QFont aFont(treeWidget()->font()); - QFontMetrics fm(aFont); - - int decorWidth = ( treeWidget()->rootIsDecorated() ) ? - ( treeWidget()->indentation() * (depth() + 1) ) : - ( treeWidget()->indentation() * depth() ); - int pixmapWidth = ( !icon(column).isNull() ) ? - treeWidget()->iconSize().width() + 2 : - 1; - int prevWidth = 0; - for (int i = 0; i < column; i++) - prevWidth += treeWidget()->header()->sectionSize(i); - int ix = prevWidth + - pixmapWidth + - ((column == 0) ? decorWidth : 0); - int iy = aItemRect.y(); - int iw = fm.width(text(column)); - int ih = aItemRect.height(); - if (!icon(column).isNull()) { - iy += 1; - ih -= 2; - } - ix -= treeWidget()->contentsRect().left(); - - QRect theResult(QPoint(ix, iy), QSize(iw, ih)); - return theResult; -} - -/*! - Calculates rect of item data in viewport coordinates -*/ -QRect SalomeApp_ListViewItem::itemRect(const int column) const -{ - QRect aItemRect = treeWidget()->visualItemRect( this ); - if ( !aItemRect.isValid() ) - return aItemRect; - - QFont aFont(treeWidget()->font()); - QFontMetrics fm(aFont); - - int decorWidth = ( treeWidget()->rootIsDecorated() ) ? - ( treeWidget()->indentation() * (depth() + 1) ) : - ( treeWidget()->indentation() * depth() ); - int pixmapWidth = ( !icon(column).isNull() ) ? - treeWidget()->iconSize().width() + 2 : - 0; - int prevWidth = 0; - for (int i = 0; i < column; i++) - prevWidth += treeWidget()->header()->sectionSize(i); - int ix = prevWidth; - int iy = aItemRect.y(); - int iw = pixmapWidth + - 2 + - ((column == 0) ? decorWidth : 0) + - fm.width(text(column)); - int ih = aItemRect.height(); - ix -= treeWidget()->contentsRect().left(); - - QRect theResult(QPoint(ix, iy), QSize(iw, ih)); - return theResult; -} - -/*! - Constructor -*/ -SalomeApp_EditBox::SalomeApp_EditBox(QWidget* parent) : -QLineEdit(parent) -{ -} - -/*! - Event filter for key pressing -*/ -void SalomeApp_EditBox::keyPressEvent( QKeyEvent *e ) -{ - if ( e->key() == Qt::Key_Escape ) - emit escapePressed(); - else - QLineEdit::keyPressEvent( e ); - e->accept(); -} - - -/*! - Constructor -*/ -SalomeApp_ComboBox::SalomeApp_ComboBox(bool rw, QWidget* parent, const char* name) : -QComboBox(parent) -{ - setEditable( rw ); - setObjectName( name ); -} - -/*! - Searches item in list and returns its index -*/ -int SalomeApp_ComboBox::findItem(const QString& theText) -{ - for (int i = 0; i < count(); i++) - if (itemText(i) == theText) - return i; - return -1; -} - -/*! - Adds item in combo box -*/ -void SalomeApp_ComboBox::insertItem(const QString& theValue, - int theIndex) -{ - if (duplicatesEnabled() || findItem(theValue) < 0) - QComboBox::insertItem(theIndex, theValue); -} - -/*! - Adds list of items in combo box -*/ -void SalomeApp_ComboBox::insertList(const QStringList& theList) -{ - for (unsigned i = 0; i < theList.count(); i++) - insertItem(theList[i]); -} - -/*! - Adds item in combo box -*/ -void SalomeApp_ComboBox::insertItem(const int theValue) -{ - int aNum; - bool bOk; - for (int i = 0; i < count(); i++) { - aNum = itemText(i).toInt(&bOk); - if (bOk) { - if (aNum > theValue || (aNum == theValue && duplicatesEnabled())) { - insertItem(QString::number(theValue),i); - return; - } - } - } - insertItem(QString::number(theValue)); -} - -/*! - Adds list of items in combo box -*/ -void SalomeApp_ComboBox::insertList(const TColStd_ListOfInteger& theList) -{ - for (TColStd_ListIteratorOfListOfInteger aIter(theList); aIter.More(); aIter.Next()) - insertItem(aIter.Value()); -} - -/*! - Adds item in combo box -*/ -void SalomeApp_ComboBox::insertItem(const double theValue) -{ - double aNum; - bool bOk; - for (int i = 0; i < count(); i++) { - aNum = itemText(i).toDouble(&bOk); - if (bOk) { - if (aNum > theValue || (aNum == theValue && duplicatesEnabled())) { - insertItem(QString::number(theValue), i); - return; - } - } - } - insertItem(QString::number(theValue)); -} - -/*! - Adds list of items in combo box -*/ -void SalomeApp_ComboBox::insertList(const TColStd_ListOfReal& theList) -{ - for (TColStd_ListIteratorOfListOfReal aIter(theList); aIter.More(); aIter.Next()) - insertItem(aIter.Value()); -} - -#include - -#define MIN_COMBO_WIDTH 1 -#define MIN_EDIT_WIDTH 1 - -/*! - Constructor -*/ -SalomeApp_EntityEdit::SalomeApp_EntityEdit(QWidget* parent, - int controlType, - int valueType, - bool butApply, - bool butCancel) : -QWidget(parent), -myEdit(0), -myCombo(0), -myApplyBtn(0), -myCancelBtn(0) -{ - SalomeApp_Application* app = dynamic_cast( SUIT_Session::session()->activeApplication() ); - SUIT_ResourceMgr* mgr = app ? app->resourceMgr() : NULL; - - QHBoxLayout* aTopLayout = new QHBoxLayout(this); - aTopLayout->setAlignment( Qt::AlignTop ); - aTopLayout->setSpacing( 0 ); - aTopLayout->setMargin( 1 ); - if (controlType != etLineEdit && - controlType != etComboBox && - controlType != etComboEdit) - controlType = etLineEdit; - if (controlType == etComboBox || controlType == etComboEdit) { - // this is an editable combo box - myCombo = new SalomeApp_ComboBox(controlType == etComboEdit, this); - myCombo->setMinimumSize(MIN_COMBO_WIDTH, 0); - myCombo->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, - QSizePolicy::Fixed)); - // no insertions - myCombo->setInsertPolicy(QComboBox::NoInsert); - // no duplicates enabled by default - myCombo->setDuplicatesEnabled(false); - aTopLayout->addWidget(myCombo); - // connect signals - connect(myCombo, SIGNAL(activated(const QString&)), this, SLOT(onComboActivated(const QString&))); - connect(myCombo, SIGNAL(textChanged(const QString&)), this, SLOT(onTextChanged(const QString&))); - } - else { - // and this is an edit box - myEdit = new SalomeApp_EditBox(this); - myEdit->setMinimumSize(MIN_EDIT_WIDTH, 0); - myEdit->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, - QSizePolicy::Fixed)); - aTopLayout->addWidget(myEdit); - connect(myEdit, SIGNAL(textChanged(const QString&)), this, SLOT(onTextChanged(const QString&))); - connect(myEdit, SIGNAL(returnPressed()), this, SLOT(onApply())); - connect(myEdit, SIGNAL(escapePressed()), this, SLOT(onCancel())); - } - if (valueType != vtString && - valueType != vtInteger && - valueType != vtDouble) - valueType = vtString; - if (valueType == vtInteger) - setValidator(new QIntValidator(this)); - else if (valueType == vtDouble) - setValidator(new QDoubleValidator(this)); - if (butApply) { - // Apply button (V) - myApplyBtn = new QToolButton(this); - - QPixmap anIcon; - if( mgr ) - anIcon = mgr->loadPixmap( "SalomeApp", tr( "ICON_APPLY" ), false ); - - myApplyBtn->setIcon(anIcon); - myApplyBtn->setEnabled(false); - myApplyBtn->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); - myApplyBtn->setMinimumSize(16, 16); - myApplyBtn->setMaximumSize(16, 20); - aTopLayout->addWidget(myApplyBtn); - connect(myApplyBtn, SIGNAL(clicked()), this, SLOT(onApply())); - } - if (butCancel) { - // Cancel button (X) - myCancelBtn = new QToolButton(this); - QPixmap anIcon; - if( mgr ) - anIcon = mgr->loadPixmap( "SalomeApp", tr( "ICON_CANCEL" ), false ); - myCancelBtn->setIcon(anIcon); - myCancelBtn->setEnabled(false); - myCancelBtn->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); - myCancelBtn->setMinimumSize(16, 16); - myCancelBtn->setMaximumSize(16, 20); - aTopLayout->addWidget(myCancelBtn); - connect(myCancelBtn, SIGNAL(clicked()), this, SLOT(onCancel())); - } -} - -/*! - Destructor -*/ -SalomeApp_EntityEdit::~SalomeApp_EntityEdit() -{ -} - -/*! - Clears edit/combo box -*/ -void SalomeApp_EntityEdit::clear() -{ - if (myEdit) - myEdit->clear(); - if (myCombo) - myCombo->clear(); -} - -/*! - \return current text in edit box or combo box -*/ -QString SalomeApp_EntityEdit::getText() -{ - if (myEdit) - return myEdit->text(); - else if (myCombo) - return myCombo->currentText(); - else - return ""; -} - -/*! - Sets text -*/ -void SalomeApp_EntityEdit::setText(const QString& theText) -{ - myString = theText; - if (myEdit) - myEdit->setText(theText); - if (myCombo) { - int aFound = myCombo->findItem(theText); - if (aFound >= 0) { - myCombo->setCurrentIndex(aFound); - onTextChanged(theText); - } - } -} - -/*! - Adds item in combo box, sets it current if theSetCurrent is true -*/ -void SalomeApp_EntityEdit::insertItem(const QString& theValue, - bool theSetCurrent, - int theOrder) -{ - if (myCombo) { - int aIndexAt = -1; - if (theOrder == atTop) - aIndexAt = 0; - else if (theOrder == atBeforeCurrent && myCombo->count() > 0) - aIndexAt = myCombo->currentIndex(); - else if (theOrder == atAfterCurrent && - myCombo->count() > 0 && - myCombo->currentIndex() < myCombo->count()-1) - aIndexAt = myCombo->currentIndex() + 1; - myCombo->insertItem(theValue, aIndexAt); - } - if (theSetCurrent) - setText(theValue); -} - -/*! - Adds items in combo box, sets item theCurrent as current -*/ -void SalomeApp_EntityEdit::insertList(const QStringList& theList, - const int theCurrent) -{ - if (myCombo) - myCombo->insertList(theList); - if (theCurrent >= 0 && theCurrent < (int)theList.count()) - setText(theList[theCurrent]); -} - -/*! - Adds item in combo box, sets it current if theSetCurrent is true -*/ -void SalomeApp_EntityEdit::insertItem(const int theValue, - bool theSetCurrent) -{ - if (myCombo) { - myCombo->insertItem(theValue); - } - if (theSetCurrent) - setText(QString::number(theValue)); -} - -/*! - Adds items in combo box, sets item theCurrent as current -*/ -void SalomeApp_EntityEdit::insertList(const TColStd_ListOfInteger& theList, - const int theCurrent) -{ - if (myCombo) - myCombo->insertList(theList); - - TColStd_ListIteratorOfListOfInteger aIter(theList); - for (unsigned i = 0; aIter.More(); aIter.Next(), i++) { - if (theCurrent == i) { - setText(QString::number(aIter.Value())); - break; - } - } -} - -/*! - Adds item in combo box, sets it current if theSetCurrent is true -*/ -void SalomeApp_EntityEdit::insertItem(const double theValue, - bool theSetCurrent) -{ - if (myCombo) { - myCombo->insertItem(theValue); - } - if (theSetCurrent) - setText(QString::number(theValue)); -} - -/*! - Adds items in combo box, sets item theCurrent as current -*/ -void SalomeApp_EntityEdit::insertList(const TColStd_ListOfReal& theList, - const int theCurrent) -{ - if (myCombo) - myCombo->insertList(theList); - - TColStd_ListIteratorOfListOfReal aIter(theList); - for (unsigned i = 0; aIter.More(); aIter.Next(), i++) { - if (theCurrent == i) { - setText(QString::number(aIter.Value())); - break; - } - } -} - -/*! - \return actual widget -*/ -QWidget* SalomeApp_EntityEdit::getControl() -{ - if (myEdit) - return myEdit; - else if (myCombo) - return myCombo; - else - return 0; -} - -/*! - redirect focus to corresponding widget -*/ -void SalomeApp_EntityEdit::setFocus() -{ - if (myEdit) { - myEdit->setFocus(); - //myEdit->selectAll(); - } - else if (myCombo && myCombo->isEditable()) { - myCombo->setFocus(); - //myCombo->lineEdit()->selectAll(); - } -} - -/*! - Sets validator for the control -*/ -void SalomeApp_EntityEdit::setValidator(const QValidator* theValidator) -{ - if (myEdit) - myEdit->setValidator(theValidator); - if (myCombo) - myCombo->setValidator(theValidator); -} - -/*! - Event filter for KeyPress event -*/ -void SalomeApp_EntityEdit::keyPressEvent( QKeyEvent * e) -{ - if ( (e->key() == Qt::Key_Enter || - e->key() == Qt::Key_Return ) ) - onApply(); - else if (e->key() == Qt::Key_Escape) - onCancel(); -} - -/*! - Called when item activated in combo box -*/ -void SalomeApp_EntityEdit::onComboActivated(const QString& theText) -{ - onTextChanged(theText); -} - -/*! - Slot, called when text changed in line edit -*/ -void SalomeApp_EntityEdit::onTextChanged(const QString& theText) -{ - if (myApplyBtn) - myApplyBtn->setEnabled(!(theText == myString)); - if (myCancelBtn) - myCancelBtn->setEnabled(!(theText == myString)); -} - -/*! - Slot, called when user presses Cancel button -*/ -void SalomeApp_EntityEdit::onCancel() -{ - setText(myString); - if (myApplyBtn) - myApplyBtn->setEnabled(false); - if (myCancelBtn) - myCancelBtn->setEnabled(false); - emit escapePressed(); -} - -/*! - Slot, called when user presses Apply button -*/ -void SalomeApp_EntityEdit::onApply() -{ - myString = getText(); - if (myApplyBtn) - myApplyBtn->setEnabled(false); - if (myCancelBtn) - myCancelBtn->setEnabled(false); - emit returnPressed(); -} - -/*! - Shows/hides buttons -*/ -void SalomeApp_EntityEdit::showButtons(bool show) -{ - if (myApplyBtn) - show ? myApplyBtn->show() : myApplyBtn->hide(); - if (myCancelBtn) - show ? myCancelBtn->show() : myCancelBtn->hide(); -} - -/*! - Enables/disables data duplication (for combo box) -*/ -void SalomeApp_EntityEdit::setDuplicatesEnabled(bool enabled) -{ - if (myCombo) - myCombo->setDuplicatesEnabled(enabled); -} diff --git a/src/SalomeApp/SalomeApp_ListView.h b/src/SalomeApp/SalomeApp_ListView.h deleted file mode 100644 index d8d472248..000000000 --- a/src/SalomeApp/SalomeApp_ListView.h +++ /dev/null @@ -1,341 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 : SalomeApp_ListView.h -// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// - -#ifndef SALOMEAPP_LISTVIEW_H -#define SALOMEAPP_LISTVIEW_H - -//#include - -#include - -#include -#include -#include -#include -#include - -class QToolButton; - -class TColStd_ListOfInteger; -class TColStd_ListOfReal; - -// enumeration for ListView updating mode -enum UpdateType { - utCancel = -1, // cancel updating - utNone = 0, // needs no any update - utUpdateItem, // update one item - utUpdateParent, // update parent item too - utUpdateViewer, // update all viewer - utUpdateAll // strong update -}; - -class SalomeApp_ListViewItem; -class SalomeApp_EntityEdit; - -/*! - \class SalomeApp_ListView - parent class for Data Viewer and Properties Viewer -*/ -class SalomeApp_ListView : public QTreeWidget/*QtxListView*/ , public SUIT_PopupClient { - - Q_OBJECT - -public: -// constructor - SalomeApp_ListView(QWidget *parent); -// destructor - virtual ~SalomeApp_ListView(); - -// updates list viewer - virtual void updateViewer(); -// updtes currently selected item(s) - virtual void updateSelected(); - -// fills popup with items - virtual QString popupClientType() const; - virtual void contextMenuPopup( QMenu* ); - -// setting editing of items availbale/not available - void enableEditing(bool theFlag); -// says if editing is enabled - bool isEnableEditing(); -// accepts user input by calling finishEditing(true) - void accept(); - -// clears view - void clear(); - -// event filter - bool eventFilter(QObject* object, QEvent* event) ; - -// gets current tooltip for list view -// returns valid rect in success - QRect tip(QPoint aPos, QString& aText, QRect& dspRect, QFont& dspFnt) const; - -protected: -// handler for resize event - void resizeEvent(QResizeEvent* e); -// handler for paint event - void viewportPaintEvent(QPaintEvent* e); -// finishes editing of entity - virtual UpdateType finishEditing(bool ok); - -// returns true if mouse events are enabled - bool isMouseEnabled(); -// enables/disables mouse events (excluding MouseMove) - void enableMouse(bool enable); - -protected slots: -// called when selection changed in list - virtual void onSelectionChanged(); -// called when user finishes in editing of item - void onEditOk(); -// called when user cancels item editing - void onEditCancel(); -// called when columns sizes are changed - void onHeaderSizeChange(int, int, int); - -protected: - SalomeApp_EntityEdit* myEdit; - SalomeApp_ListViewItem* myEditedItem; - bool myEditingEnabled; - bool myMouseEnabled; -}; - - -class SalomeApp_EditBox: public QLineEdit -{ - Q_OBJECT - -public: - SalomeApp_EditBox(QWidget* parent); - -protected: - void keyPressEvent(QKeyEvent* e); - -signals: - void escapePressed(); -}; - -class SalomeApp_ComboBox: public QComboBox -{ - Q_OBJECT - -public: - SalomeApp_ComboBox(bool rw, QWidget* parent = 0, const char* name = 0); - - int findItem(const QString& theText); - void insertItem(const QString& theValue, int theIndex = -1); - void insertList(const QStringList& theList); - void insertItem(const int theValue); - void insertList(const TColStd_ListOfInteger& theList); - void insertItem(const double theValue); - void insertList(const TColStd_ListOfReal& theList); -}; - -class SalomeApp_EntityEdit : public QWidget -{ - Q_OBJECT - -public: - // enum for edit control type - enum { - etLineEdit, // simple edit box - etComboBox, // non-editable combo box - etComboEdit // editable combo box - }; - // enum for value type - enum { - vtString, // string - vtInteger, // integer value - vtDouble // double value - }; - // enum for insertion order - enum { - atBottom, - atTop, - atBeforeCurrent, - atAfterCurrent - }; - // enum for edit box buttons (Apply = Cancel) - enum { - btApply = 0x0001, - btCancel = 0x0002 - }; - -public: - SalomeApp_EntityEdit( QWidget* parent, - int controlType = etLineEdit, - int valueType = vtString, - bool butApply = false, - bool butCancel = false); - ~SalomeApp_EntityEdit(); - - void finishEditing(); - void clear(); - QString getText(); - void setText(const QString& theText ); - void insertItem( const QString& theValue, - bool theSetCurrent = false, - int theOrder = atBottom ); - void insertList( const QStringList& theList, - const int theCurrent = -1 ); - void insertItem( const int theValue, - bool theSetCurrent = false ); - void insertList( const TColStd_ListOfInteger& theList, - const int theCurrent = -1 ); - void insertItem( const double theValue, - bool theSetCurrent = false ); - void insertList( const TColStd_ListOfReal& theList, - const int theCurrent = -1 ); - QWidget* getControl(); - void setFocus(); - void setValidator(const QValidator*); - void showButtons(bool show); - void setDuplicatesEnabled(bool enabled); - -protected: - void keyPressEvent ( QKeyEvent * e); - -private slots: - void onComboActivated(const QString&); - void onTextChanged(const QString&); - void onApply(); - void onCancel(); -signals: - void returnPressed(); - void escapePressed(); - -private: - // Widgets - SalomeApp_EditBox* myEdit; - SalomeApp_ComboBox* myCombo; - QToolButton* myApplyBtn; - QToolButton* myCancelBtn; - QString myString; -}; - -class SalomeApp_ListViewItem : public QTreeWidgetItem -{ -public: - SalomeApp_ListViewItem( SalomeApp_ListView* ); - SalomeApp_ListViewItem( SalomeApp_ListView*, - SalomeApp_ListViewItem* ); - SalomeApp_ListViewItem( SalomeApp_ListView*, - const QStringList&, - const bool = false ); - SalomeApp_ListViewItem( SalomeApp_ListViewItem*, - const QStringList&, - const bool = false ); - SalomeApp_ListViewItem( SalomeApp_ListView*, - SalomeApp_ListViewItem*, - const QString&, - const bool = false ); - SalomeApp_ListViewItem( SalomeApp_ListViewItem*, - SalomeApp_ListViewItem*, - const QString&, - const bool = false); - SalomeApp_ListViewItem( SalomeApp_ListView*, - SalomeApp_ListViewItem*, - const QString& theName, - const QString& theValue, - const bool = false); - SalomeApp_ListViewItem( SalomeApp_ListViewItem*, - SalomeApp_ListViewItem*, - const QString&, - const QString&, - const bool = false); - ~SalomeApp_ListViewItem(); - - QString fullName(); - void openAllLevels(); - virtual void updateAllLevels(); - bool isEditable() const; - void setEditable(bool theEditable); - - // returns true if entitiy is accepted after editing - bool isAccepted() const; - // set entity accepted or not after editing - void setAccepted(bool theAccepted); - - // returns name of entity (as default it is text in first column) - virtual QString getName() const; - // sets name of entity (as default it is text in first column) - virtual UpdateType setName(const QString& theName); - - // returns value of entity (as default it is text in second column) - virtual QString getValue() const; - // sets value of entity (as default it is text in second column) - virtual UpdateType setValue(const QString& theValue); - - // creates control for editing and fills it with values - SalomeApp_EntityEdit* startEditing(); - // fills widget with initial values (list or single value) - virtual void fillWidgetWithValues(SalomeApp_EntityEdit* theWidget); - // finishes editing of entity - virtual UpdateType finishEditing(SalomeApp_EntityEdit* theWidget); - - // returns type of edit control (0 - edit box, 1 - combo box, 2 - editable combo box) - virtual int getEditingType(); - // sets type of edit control (0 - edit box, 1 - combo box, 2 - editable combo box) - virtual void setEditingType(const int); - // returns edited column - virtual int getEditedColumn(); - // returns type of edited value (string, int, double) - virtual int getValueType(); - // sets type of edited value (string, int, double) - virtual void setValueType(const int); - - // gets user type - virtual int getUserType(); - // sets user type - virtual void setUserType(const int); - - // returns buttons for editing widget - virtual int getButtons(); - // sets buttons for editing widget - virtual void setButtons(const int); - // returns text for tooltip - QString tipText(); - // calculates rectangle which should contain items tip - QRect tipRect(); - // calculates rect of item text in viewport coordinates - QRect textRect(const int column) const; - // calculates full rect of item data in viewport coordinates - QRect itemRect(const int column) const; - -protected: - // initialization - void init(); - int depth() const; - -private: - bool myEditable; - bool myAccepted; - int myEditingType; - int myValueType; - int myButtons; - int myUserType; // user are welcome to put additional data here and use it in fillWidgetWithValues() -}; - - -#endif diff --git a/src/SalomeApp/SalomeApp_LoadStudiesDlg.cxx b/src/SalomeApp/SalomeApp_LoadStudiesDlg.cxx deleted file mode 100644 index 1d44048ef..000000000 --- a/src/SalomeApp/SalomeApp_LoadStudiesDlg.cxx +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 "SalomeApp_LoadStudiesDlg.h" - -#include -#include -#include -#include -#include -#include - -#define SPACING_SIZE 6 -#define MARGIN_SIZE 11 -#define MIN_LISTBOX_WIDTH 150 -#define MIN_LISTBOX_HEIGHT 100 - -/*! - \class SalomeApp_LoadStudiesDlg - \brief Dialog box which allows selecting study to be loaded - from the list. -*/ - -/*! - \brief Constructor - \param parent a parent widget - \param studies list of study names -*/ -SalomeApp_LoadStudiesDlg::SalomeApp_LoadStudiesDlg( QWidget* parent, const QStringList& studies ) -: QDialog( parent ) -{ - setModal( true ); - - setWindowTitle( tr("DLG_LOAD_STUDY_CAPTION") ); - setSizeGripEnabled( true ); - - QVBoxLayout* topLayout = new QVBoxLayout( this ); - topLayout->setMargin( MARGIN_SIZE ); - topLayout->setSpacing( SPACING_SIZE ); - - QLabel* lab = new QLabel( tr( "MEN_STUDIES_CHOICE" ), this ); - - myButtonOk = new QPushButton( tr( "BUT_OK" ), this ); - myButtonOk->setAutoDefault( true ); - myButtonOk->setDefault( true ); - - QPushButton* buttonCancel = new QPushButton( tr( "BUT_CANCEL" ), this ); - - QHBoxLayout* btnLayout = new QHBoxLayout; - btnLayout->setSpacing( SPACING_SIZE ); - btnLayout->setMargin( 0 ); - btnLayout->addWidget( myButtonOk ); - btnLayout->addStretch(); - btnLayout->addWidget( buttonCancel ); - - myList = new QListWidget( this ); - myList->setMinimumSize( MIN_LISTBOX_WIDTH, MIN_LISTBOX_HEIGHT ); - myList->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, - QSizePolicy::Expanding ) ); - myList->setSelectionMode( QAbstractItemView::SingleSelection ); - - topLayout->addWidget( lab ); - topLayout->addWidget( myList ); - topLayout->addLayout( btnLayout ); - - connect( myButtonOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); - connect( myList, SIGNAL( itemDoubleClicked( QListWidgetItem* ) ), - this, SLOT( accept() ) ); - connect( myList, SIGNAL( itemSelectionChanged() ), - this, SLOT( updateState() ) ); - myList->addItems( studies ); - - updateState(); -} - -/*! - \brief Destructor -*/ -SalomeApp_LoadStudiesDlg::~SalomeApp_LoadStudiesDlg() -{ -} - -/*! - \brief Updates buttons state. -*/ -void SalomeApp_LoadStudiesDlg::updateState() -{ - myButtonOk->setEnabled( myList->currentItem() != 0 ); -} - -/*! - \brief Get selected study name - \return selected study name or null string if study is not selected -*/ -QString SalomeApp_LoadStudiesDlg::selectedStudy() -{ - QString study; - if ( myList->currentItem() ) - study = myList->currentItem()->text(); - return study; -} - -/*! - \brief Executes dialog box to select study from the list - and returns the study selected. - \param parent parent widget - \param studies list of study names - \return select study (or null string if dialog box is rejected) -*/ -QString SalomeApp_LoadStudiesDlg::selectStudy( QWidget* parent, const QStringList& studies ) -{ - SalomeApp_LoadStudiesDlg dlg( parent, studies ); - QString study; - if ( dlg.exec() == QDialog::Accepted ) - study = dlg.selectedStudy(); - return study; -} diff --git a/src/SalomeApp/SalomeApp_LoadStudiesDlg.h b/src/SalomeApp/SalomeApp_LoadStudiesDlg.h deleted file mode 100644 index 35c9a9847..000000000 --- a/src/SalomeApp/SalomeApp_LoadStudiesDlg.h +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 SALOMEAPP_LOADSTUDIESDLG_H -#define SALOMEAPP_LOADSTUDIESDLG_H - -#include "SalomeApp.h" - -#include - -class QListWidget; -class QPushButton; -class QStringList; - -class SALOMEAPP_EXPORT SalomeApp_LoadStudiesDlg : public QDialog -{ - Q_OBJECT - -private: - SalomeApp_LoadStudiesDlg( QWidget*, const QStringList& ); - -public: - ~SalomeApp_LoadStudiesDlg(); - - static QString selectStudy( QWidget*, const QStringList& ); - - QString selectedStudy(); - -private slots: - void updateState(); - -private: - QListWidget* myList; - QPushButton* myButtonOk; -}; - -#endif // STD_LOADSTUDIESDLG_H diff --git a/src/SalomeApp/SalomeApp_Module.cxx b/src/SalomeApp/SalomeApp_Module.cxx deleted file mode 100644 index 7c800c426..000000000 --- a/src/SalomeApp/SalomeApp_Module.cxx +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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: SalomeApp_Module.cxx -// Created: 10/25/2004 11:39:56 AM -// Author: Sergey LITONIN -// Copyright (C) CEA 2004 - -#include "SalomeApp_Module.h" -#include "SalomeApp_DataModel.h" -#include "SalomeApp_Application.h" -#include "SalomeApp_Study.h" - -#include "LightApp_Selection.h" - -#include "CAM_DataModel.h" - -// temporary commented -//#include "OB_Browser.h" - -#include -#include -#include - -#include - -#include - -/*!Constructor.*/ -SalomeApp_Module::SalomeApp_Module( const QString& name ) -: LightApp_Module( name ) -{ -} - -/*!Destructor.*/ -SalomeApp_Module::~SalomeApp_Module() -{ -} - -/*!Gets application.*/ -SalomeApp_Application* SalomeApp_Module::getApp() const -{ - return (SalomeApp_Application*)application(); -} - -/*!Create new instance of data model and return it.*/ -CAM_DataModel* SalomeApp_Module::createDataModel() -{ - return new SalomeApp_DataModel(this); -} - -/*!Create and return instance of LightApp_Selection.*/ -LightApp_Selection* SalomeApp_Module::createSelection() const -{ - return LightApp_Module::createSelection(); -} - -/*! - Converts objects-containers to list of objects, those are contained - Other objects must be added without conversion - \param source - source list of objects - \param dest - list of converted objects -*/ -void SalomeApp_Module::extractContainers( const SALOME_ListIO& source, SALOME_ListIO& dest ) const -{ - SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - if( !study ) - { - dest = source; - return; - } - - SALOME_ListIteratorOfListIO anIt( source ); - for( ; anIt.More(); anIt.Next() ) - { - Handle( SALOME_InteractiveObject ) obj = anIt.Value(); - if( obj->hasEntry() ) - { - _PTR(SObject) SO = study->studyDS()->FindObjectID( obj->getEntry() ); - if( SO && QString( SO->GetID().c_str() ) == SO->GetFatherComponent()->GetID().c_str() ) - { //component is selected - _PTR(SComponent) SC( SO->GetFatherComponent() ); - _PTR(ChildIterator) anIter ( study->studyDS()->NewChildIterator( SC ) ); - anIter->InitEx( true ); - while( anIter->More() ) - { - _PTR(SObject) valSO ( anIter->Value() ); - _PTR(SObject) refSO; - if( !valSO->ReferencedObject( refSO ) ) - { - QString id = valSO->GetID().c_str(), - comp = SC->ComponentDataType().c_str(), - val = valSO->GetName().c_str(); - - Handle( SALOME_InteractiveObject ) new_obj = - new SALOME_InteractiveObject( id.toLatin1(), comp.toLatin1(), val.toLatin1() ); - dest.Append( new_obj ); - } - anIter->Next(); - } - continue; - } - } - dest.Append( obj ); - } -} - -/*! - * \brief Virtual public - * - * This method is called just before the study document is saved, so the module has a possibility - * to store visual parameters in AttributeParameter attribue(s) - */ -void SalomeApp_Module::storeVisualParameters(int savePoint) -{ -} - -/*! - * \brief Virtual public - * - * This method is called after the study document is opened, so the module has a possibility to restore - * visual parameters - */ -void SalomeApp_Module::restoreVisualParameters(int savePoint) -{ -} - diff --git a/src/SalomeApp/SalomeApp_Module.h b/src/SalomeApp/SalomeApp_Module.h deleted file mode 100644 index dbb1631a8..000000000 --- a/src/SalomeApp/SalomeApp_Module.h +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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: SalomeApp_Module.h -// Created: 10/25/2004 11:33:06 AM -// Author: Sergey LITONIN -// Copyright (C) CEA 2004 - -#ifndef SALOMEAPP_MODULE_H -#define SALOMEAPP_MODULE_H - -#include "SalomeApp.h" - -#include - -class CAM_DataModel; -class SalomeApp_Application; -class LightApp_Selection; -class SALOME_ListIO; -class QString; - -/*! - * \brief Base class for all salome modules -*/ -class SALOMEAPP_EXPORT SalomeApp_Module : public LightApp_Module -{ - Q_OBJECT - -public: - SalomeApp_Module( const QString& ); - virtual ~SalomeApp_Module(); - - /*! engineIOR() should be a pure virtual method, to avoid logical errors!\n - * Implementation in derived classes can return the following values:\n - * module`s engine IOR - means that this is a standard SALOME module with a CORBA engine - * \li "" (empty string) - means that this not correct SALOME module - */ - virtual QString engineIOR() const = 0; - - /*! Convenient shortcuts*/ - - SalomeApp_Application* getApp() const; - - virtual void storeVisualParameters(int savePoint); - virtual void restoreVisualParameters(int savePoint); - virtual LightApp_Selection* createSelection() const; - -protected: - virtual CAM_DataModel* createDataModel(); - virtual void extractContainers( const SALOME_ListIO&, SALOME_ListIO& ) const; -}; - -#endif diff --git a/src/SalomeApp/SalomeApp_PyInterp.cxx b/src/SalomeApp/SalomeApp_PyInterp.cxx deleted file mode 100755 index cf59e8438..000000000 --- a/src/SalomeApp/SalomeApp_PyInterp.cxx +++ /dev/null @@ -1,139 +0,0 @@ -// SALOME SALOMEGUI : implementation of desktop and GUI kernel -// -// 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 : SalomeApp_PyInterp.cxx -// Author : Nicolas REJNERI -// Module : SALOME -// $Header$ - -#include "SalomeApp_PyInterp.h" - -#include -#include - -#include "PyInterp.h" // this include must be first (see PyInterp_base.h)! - -using namespace std; - -/*! - * constructor : multi Python interpreter, one per SALOME study. - * calls initialize method defined in base class, which calls virtual methods - * initstate & initcontext redefined here. - */ -SalomeApp_PyInterp::SalomeApp_PyInterp(): - PyConsole_Interp(), myFirstRun( true ) -{ -} - -/*! - * Destructor. - */ -SalomeApp_PyInterp::~SalomeApp_PyInterp() -{ -} - -/*!\class SalomeApp_PyInterp - * EDF-CCAR - * When SALOME uses multi Python interpreter feature, - * Every study has its own interpreter and thread state (_tstate = Py_NewInterpreter()) - * This is fine because every study has its own modules (sys.modules) stdout and stderr - * BUT some Python modules must be imported only once. In multi interpreter context Python - * modules (*.py) are imported several times. - * The pyqt module must be imported only once because it registers classes in a C module. - * It's quite the same with omniorb modules (internals and generated with omniidl) - * This problem is handled with "shared modules" defined in salome_shared_modules.py - * These "shared modules" are imported only once and only copied in all the other interpreters - * BUT it's not the only problem. Every interpreter has its own __builtin__ module. That's fine - * but if we have copied some modules and imported others problems may arise with operations that - * are not allowed in restricted execution environment. So we must impose that all interpreters - * have identical __builtin__ module. - * That's all, for the moment ... - */ - - -bool SalomeApp_PyInterp::initContext() -{ - /*! - * The GIL is assumed to be held - * It is the caller responsability caller to acquire the GIL - * It will still be held on initContext output - */ - if ( !PyConsole_Interp::initContext() ) - return false; - - // Import special module to change the import mechanism - PyObjWrapper m1( PyImport_ImportModule( "import_hook" ) ); - if ( !m1 ) - { - MESSAGE( "initContext: problem with import_hook import" ); - PyErr_Print(); - ASSERT( 0 ); - return false; - } - - // Call init_shared_modules to initialize the shared import mechanism for modules - //that must not be imported twice - PyObjWrapper m2( PyObject_CallMethod( m1, "init_shared_modules", "O", KERNEL_PYTHON::salome_shared_modules_module ) ); - if ( !m2 ) - { - MESSAGE( "initContext: problem with init_shared_modules call" ); - PyErr_Print(); - ASSERT( 0 ); - return false; - } - - return true; -} - -/*! - Do nothing - The initialization has been done in main - */ -void SalomeApp_PyInterp::initPython() -{ - MESSAGE("PyInterp_base::initPython"); - ASSERT(KERNEL_PYTHON::_gtstate); // initialisation in main - SCRUTE(KERNEL_PYTHON::_gtstate); - _gtstate=KERNEL_PYTHON::_gtstate; - _interp=KERNEL_PYTHON::_interp; -} - -/*! - Called before each Python command running. -*/ -int SalomeApp_PyInterp::beforeRun() -{ - if ( myFirstRun ) { - myFirstRun = false; - int ret = simpleRun( "from Help import *", false ); - if ( ret ) - return ret; - ret = simpleRun( "import salome", false ); - if (ret) - return ret; - ret = simpleRun( "salome.salome_init(0,1)", false ); - if (ret) - return ret; - } - return true; -} diff --git a/src/SalomeApp/SalomeApp_PyInterp.h b/src/SalomeApp/SalomeApp_PyInterp.h deleted file mode 100755 index 735be4420..000000000 --- a/src/SalomeApp/SalomeApp_PyInterp.h +++ /dev/null @@ -1,50 +0,0 @@ -// SALOME SALOMEGUI : implementation of desktop and GUI kernel -// -// 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 : SalomeApp_PyInterp.h -// Author : Nicolas REJNERI -// Module : SALOME -// $Header$ - -#ifndef _SalomeApp_PYINTERP_H_ -#define _SalomeApp_PYINTERP_H_ - -#include // this include must be first (see PyInterp_base.h)! - -class SalomeApp_PyInterp : public PyConsole_Interp -{ -public: - SalomeApp_PyInterp(); - virtual ~SalomeApp_PyInterp(); - - virtual void initPython(); - -protected: - virtual bool initContext(); - virtual int beforeRun(); - -private: - bool myFirstRun; -}; - -#endif diff --git a/src/SalomeApp/SalomeApp_Study.cxx b/src/SalomeApp/SalomeApp_Study.cxx deleted file mode 100644 index 459bc4ac2..000000000 --- a/src/SalomeApp/SalomeApp_Study.cxx +++ /dev/null @@ -1,757 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 "SalomeApp_Study.h" - -#include "SalomeApp_Module.h" -#include "SalomeApp_DataObject.h" -#include "SalomeApp_DataModel.h" -#include "SalomeApp_Application.h" -#include "SalomeApp_Engine_i.hxx" -#include "SalomeApp_VisualState.h" - -// temporary commented -//#include - -#include - -#include "utilities.h" - -#include "SALOMEDS_Tool.hxx" - -#include "SALOMEDSClient_ClientFactory.hxx" - -#include -#include CORBA_SERVER_HEADER(SALOME_Exception) - -using namespace std; - -/*! - Constructor. -*/ -SalomeApp_Study::SalomeApp_Study( SUIT_Application* app ) -: LightApp_Study( app ) -{ -} - -/*! - Destructor. -*/ -SalomeApp_Study::~SalomeApp_Study() -{ -} - -/*! - Gets study id. -*/ -int SalomeApp_Study::id() const -{ - int id = -1; - if ( myStudyDS ) - id = studyDS()->StudyId(); - return id; -} - -/*! - Gets studyDS pointer. -*/ -_PTR(Study) SalomeApp_Study::studyDS() const -{ - return myStudyDS; -} - -/*! - Create document. -*/ -bool SalomeApp_Study::createDocument( const QString& theStr ) -{ - MESSAGE( "openDocument" ); - - // initialize myStudyDS, read HDF file - QString aName = newStudyName(); - _PTR(Study) study ( SalomeApp_Application::studyMgr()->NewStudy( aName.toStdString() ) ); - if ( !study ) - return false; - - setStudyDS( study ); - setStudyName( aName ); - - // create myRoot - setRoot( new SalomeApp_RootObject( this ) ); - - bool aRet = CAM_Study::createDocument( theStr ); - emit created( this ); - - return aRet; -} - -/*! - Opens document - \param theFileName - name of file -*/ -bool SalomeApp_Study::openDocument( const QString& theFileName ) -{ - MESSAGE( "openDocument" ); - - // initialize myStudyDS, read HDF file - _PTR(Study) study ( SalomeApp_Application::studyMgr()->Open( (char*) theFileName.toStdString().c_str() ) ); - if ( !study ) - return false; - - setStudyDS( study ); - - setRoot( new SalomeApp_RootObject( this ) ); // create myRoot - - // update loaded data models: call open() and update() on them. - ModelList dm_s; - dataModels( dm_s ); - QListIterator it( dm_s ); - while ( it.hasNext() ) - openDataModel( studyName(), it.next() ); - - // this will build a SUIT_DataObject-s tree under myRoot member field - // passing "false" in order NOT to rebuild existing data models' trees - it was done in previous step - // but tree that corresponds to not-loaded data models will be updated any way. - ((SalomeApp_Application*)application())->updateObjectBrowser( false ); - - bool res = CAM_Study::openDocument( theFileName ); - - emit opened( this ); - study->IsSaved(true); - - bool restore = application()->resourceMgr()->booleanValue( "Study", "store_visual_state", true ); - if ( restore ) { - std::vector savePoints = getSavePoints(); - if ( savePoints.size() > 0 ) - SalomeApp_VisualState( (SalomeApp_Application*)application() ).restoreState( savePoints[savePoints.size()-1] ); - } - - ((SalomeApp_Application*)application())->updateObjectBrowser( true ); - return res; -} - -/*! - Connects GUI study to SALOMEDS one already loaded into StudyManager - \param theStudyName - name of study -*/ -bool SalomeApp_Study::loadDocument( const QString& theStudyName ) -{ - MESSAGE( "loadDocument" ); - - // obtain myStudyDS from StudyManager - _PTR(Study) study ( SalomeApp_Application::studyMgr()->GetStudyByName( (char*) theStudyName.toStdString().c_str() ) ); - if ( !study ) - return false; - - setStudyDS( study ); - - setRoot( new SalomeApp_RootObject( this ) ); // create myRoot - - //SRN: BugID IPAL9021, put there the same code as in a method openDocument - - // update loaded data models: call open() and update() on them. - ModelList dm_s; - dataModels( dm_s ); - - QListIterator it( dm_s ); - while ( it.hasNext() ) - openDataModel( studyName(), it.next() ); - - // this will build a SUIT_DataObject-s tree under myRoot member field - // passing "false" in order NOT to rebuild existing data models' trees - it was done in previous step - // but tree that corresponds to not-loaded data models will be updated any way. - ((SalomeApp_Application*)application())->updateObjectBrowser( false ); - - bool res = CAM_Study::openDocument( theStudyName ); - emit opened( this ); - - bool restore = application()->resourceMgr()->booleanValue( "Study", "store_visual_state", true ); - if ( restore ) { - std::vector savePoints = getSavePoints(); - if ( savePoints.size() > 0 ) - SalomeApp_VisualState( (SalomeApp_Application*)application() ).restoreState( savePoints[savePoints.size()-1] ); - } - - //SRN: BugID IPAL9021: End - return res; -} - -/*! - Saves document - \param theFileName - name of file -*/ -bool SalomeApp_Study::saveDocumentAs( const QString& theFileName ) -{ - bool store = application()->resourceMgr()->booleanValue( "Study", "store_visual_state", false ); - if ( store ) - SalomeApp_VisualState( (SalomeApp_Application*)application() ).storeState(); - - ModelList list; dataModels( list ); - - QListIterator it( list ); - QStringList listOfFiles; - while ( it.hasNext() ) { - if ( SalomeApp_DataModel* aModel = (SalomeApp_DataModel*)it.next() ) { - listOfFiles.clear(); - aModel->saveAs( theFileName, this, listOfFiles ); - if ( !listOfFiles.isEmpty() ) - saveModuleData(aModel->module()->name(), listOfFiles); - } - } - - // save SALOMEDS document - SUIT_ResourceMgr* resMgr = application()->resourceMgr(); - if( !resMgr ) - return false; - - bool isMultiFile = resMgr->booleanValue( "Study", "multi_file", false ); - bool isAscii = resMgr->booleanValue( "Study", "ascii_file", false ); - bool res = (isAscii ? - SalomeApp_Application::studyMgr()->SaveAsASCII( theFileName.toStdString(), studyDS(), isMultiFile ) : - SalomeApp_Application::studyMgr()->SaveAs ( theFileName.toStdString(), studyDS(), isMultiFile )) - && CAM_Study::saveDocumentAs( theFileName ); - - res = res && saveStudyData(theFileName); - - if ( res ) - emit saved( this ); - - return res; -} - -/*! - Saves previously opened document -*/ -bool SalomeApp_Study::saveDocument() -{ - bool store = application()->resourceMgr()->booleanValue( "Study", "store_visual_state", true ); - if ( store ) - SalomeApp_VisualState( (SalomeApp_Application*)application() ).storeState(); - - ModelList list; dataModels( list ); - - QListIterator it( list ); - QStringList listOfFiles; - while ( it.hasNext() ) { - if ( SalomeApp_DataModel* aModel = (SalomeApp_DataModel*)it.next() ) { - listOfFiles.clear(); - aModel->save(listOfFiles); - if ( !listOfFiles.isEmpty() ) - saveModuleData(aModel->module()->name(), listOfFiles); - } - } - - // save SALOMEDS document - SUIT_ResourceMgr* resMgr = application()->resourceMgr(); - if( !resMgr ) - return false; - - bool isMultiFile = resMgr->booleanValue( "Study", "multi_file", false ); - bool isAscii = resMgr->booleanValue( "Study", "ascii_file", false ); - bool res = (isAscii ? - SalomeApp_Application::studyMgr()->SaveASCII( studyDS(), isMultiFile ) : - SalomeApp_Application::studyMgr()->Save ( studyDS(), isMultiFile )) && CAM_Study::saveDocument(); - - res = res && saveStudyData(studyName()); - if ( res ) - emit saved( this ); - - return res; -} - -/*! - Closes document -*/ -void SalomeApp_Study::closeDocument(bool permanently) -{ - LightApp_Study::closeDocument(permanently); - - // close SALOMEDS document - _PTR(Study) studyPtr = studyDS(); - if ( studyPtr ) - { - if(permanently) { - SalomeApp_Application::studyMgr()->Close( studyPtr ); - } - SALOMEDSClient_Study* aStudy = 0; - setStudyDS( _PTR(Study)(aStudy) ); - } -} - -/*! - \return true, if study is modified in comparison with last open/save -*/ -bool SalomeApp_Study::isModified() const -{ - bool isAnyChanged = studyDS() && studyDS()->IsModified(); - if (!isAnyChanged) - isAnyChanged = LightApp_Study::isModified(); - - return isAnyChanged; -} - -/*! - Set study modified to \a on. - */ -void SalomeApp_Study::Modified() -{ - if(_PTR(Study) aStudy = studyDS()) - aStudy->Modified(); - LightApp_Study::Modified(); -} - -/*! - \return if data model is saved -*/ -bool SalomeApp_Study::isSaved() const -{ - bool isAllSaved = studyDS() && studyDS()->GetPersistentReference().size(); - if (!isAllSaved) - isAllSaved = LightApp_Study::isSaved(); - - return isAllSaved; -} - -/*! - Saves data of module - \param theModuleName - name of module - \param theListOfFiles - list of files to be saved -*/ -void SalomeApp_Study::saveModuleData( QString theModuleName, QStringList theListOfFiles ) -{ - int aNb = theListOfFiles.count(); - if ( aNb == 0 ) - return; - - std::vector aListOfFiles ( aNb ); - int anIndex = 0; - for ( QStringList::Iterator it = theListOfFiles.begin(); it != theListOfFiles.end(); ++it ) { - if ( (*it).isEmpty() ) - continue; - aListOfFiles[anIndex] = (*it).toStdString(); - anIndex++; - } - SetListOfFiles(theModuleName.toStdString().c_str(), aListOfFiles); -} - -/*! - Loads data of module - \param theModuleName - name of module - \param theListOfFiles - list of files to be loaded -*/ -void SalomeApp_Study::openModuleData( QString theModuleName, QStringList& theListOfFiles ) -{ - std::vector aListOfFiles = GetListOfFiles( theModuleName.toStdString().c_str() ); - - int i, aLength = aListOfFiles.size() - 1; - if ( aLength < 0 ) - return; - - //Get a temporary directory for saved a file - theListOfFiles.append(aListOfFiles[0].c_str()); - - for(i = 0; i < aLength; i++) - theListOfFiles.append(aListOfFiles[i+1].c_str()); -} - -/*! - Saves data from study -*/ -bool SalomeApp_Study::saveStudyData( const QString& theFileName ) -{ - ModelList list; dataModels( list ); - QListIterator it( list ); - std::vector listOfFiles(0); - while ( it.hasNext() ) - if ( SalomeApp_DataModel* aModel = (SalomeApp_DataModel*)it.next() ) - SetListOfFiles(aModel->module()->name().toStdString().c_str(), listOfFiles); - return true; -} - -/*! - Loads data for study -*/ -bool SalomeApp_Study::openStudyData( const QString& theFileName ) -{ - return true; -} - -/*! - Set studyDS. -*/ -void SalomeApp_Study::setStudyDS( const _PTR(Study)& s ) -{ - myStudyDS = s; -} - -/*! - Insert data model. -*/ -void SalomeApp_Study::dataModelInserted (const CAM_DataModel* dm) -{ - MESSAGE("SalomeApp_Study::dataModelInserted() : module name() = " << dm->module()->name().toStdString()); - - CAM_Study::dataModelInserted(dm); - - // addComponent(dm); -} - -/*! - Create SComponent for module, using default engine (CORBAless) -*/ -void SalomeApp_Study::addComponent(const CAM_DataModel* dm) -{ - SalomeApp_Module* aModule = dynamic_cast( dm->module() ); - // 1. aModule == 0 means that this is a light module (no CORBA enigine) - if (!aModule) { - // Check SComponent existance - _PTR(Study) aStudy = studyDS(); - if (!aStudy) - return; - _PTR(SComponent) aComp = aStudy->FindComponent(dm->module()->name().toStdString()); - if (!aComp) { - // Create SComponent - _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder(); - aComp = aBuilder->NewComponent(dm->module()->name().toStdString()); - aBuilder->SetName(aComp, dm->module()->moduleName().toStdString()); - QString anIconName = dm->module()->iconName(); - if (!anIconName.isEmpty()) { - _PTR(AttributePixMap) anAttr = aBuilder->FindOrCreateAttribute(aComp, "AttributePixMap"); - if (anAttr) - anAttr->SetPixMap(anIconName.toStdString()); - } - // Set default engine IOR - aBuilder->DefineComponentInstance(aComp, SalomeApp_Application::defaultEngineIOR().toStdString()); - //SalomeApp_DataModel::BuildTree( aComp, root(), this, /*skipExisitng=*/true ); - SalomeApp_DataModel::synchronize( aComp, this ); - } - } -} - -/*! - Open data model -*/ -bool SalomeApp_Study::openDataModel( const QString& studyName, CAM_DataModel* dm ) -{ - if (!dm) - return false; - - // SalomeApp_DataModel* aDM = (SalomeApp_DataModel*)(dm); - SalomeApp_Module* aModule = dynamic_cast( dm->module() ); - _PTR(Study) aStudy = studyDS(); // shared_ptr cannot be used here - _PTR(SComponent) aSComp; - QString anEngine; - // 1. aModule == 0 means that this is a light module (no CORBA enigine) - if (!aModule) { - anEngine = SalomeApp_Application::defaultEngineIOR(); - aSComp = aStudy->FindComponent(dm->module()->name().toStdString()); - } - else { - SalomeApp_DataModel* aDM = dynamic_cast( dm ); - if ( aDM ) { - QString anId = aDM->getRootEntry( this ); - if ( anId.isEmpty() ) - return true; // Probably nothing to load - anEngine = aDM->getModule()->engineIOR(); - if ( anEngine.isEmpty() ) - return false; - aSComp = aStudy->FindComponentID( std::string( anId.toLatin1() ) ); - } - } - if ( aSComp ) { - _PTR(StudyBuilder) aBuilder( aStudy->NewBuilder() ); - if ( aBuilder ) { - try { - aBuilder->LoadWith( aSComp, std::string( anEngine.toLatin1() ) ); - } - catch( const SALOME::SALOME_Exception& ) { - // Oops, something went wrong while loading -> return an error - return false; - } - // Something has been read -> create data model tree - //SalomeApp_DataModel* aDM = dynamic_cast( dm ); - // aDM->buildTree( aSComp, 0, this ); - } - } else { - // Don't return false here, for there might be no data - // for a given component in the study yet - } - QStringList listOfFiles; - openModuleData(dm->module()->name(), listOfFiles); - if (dm && dm->open(studyName, this, listOfFiles)) { - // Remove the files and temporary directory, created - // for this module by LightApp_Engine_i::Load() - bool isMultiFile = false; // TODO: decide, how to access this parameter - RemoveTemporaryFiles( dm->module()->name().toStdString().c_str(), isMultiFile ); - - // Something has been read -> create data model tree - LightApp_DataModel* aDM = dynamic_cast( dm ); - if ( aDM ) - aDM->update(NULL, this); - return true; - } - return false; -} - -/*! - Create new study name. -*/ -QString SalomeApp_Study::newStudyName() const -{ - std::vector studies = SalomeApp_Application::studyMgr()->GetOpenStudies(); - QString prefix( "Study%1" ), newName, curName; - int i = 1, j, n = studies.size(); - while ( newName.isEmpty() ){ - curName = prefix.arg( i ); - for ( j = 0 ; j < n; j++ ){ - if ( !strcmp( studies[j].c_str(), curName.toLatin1() ) ) - break; - } - if ( j == n ) - newName = curName; - else - i++; - } - return newName; -} - -/*! - \return list of files used by module: to be used by CORBAless modules - \param theModuleName - name of module -*/ -std::vector SalomeApp_Study::GetListOfFiles( const char* theModuleName ) const -{ - SalomeApp_Engine_i* aDefaultEngine = SalomeApp_Engine_i::GetInstance(); - if (aDefaultEngine) - return aDefaultEngine->GetListOfFiles(id(), theModuleName); - - std::vector aListOfFiles; - return aListOfFiles; -} - -/*! - Sets list of files used by module: to be used by CORBAless modules - \param theModuleName - name of module - \param theListOfFiles - list of files -*/ -void SalomeApp_Study::SetListOfFiles ( const char* theModuleName, - const std::vector theListOfFiles ) -{ - SalomeApp_Engine_i* aDefaultEngine = SalomeApp_Engine_i::GetInstance(); - if (aDefaultEngine) - aDefaultEngine->SetListOfFiles(theListOfFiles, id(), theModuleName); -} - -/*! - \return temporary directory for saving files of modules -*/ -std::string SalomeApp_Study::GetTmpDir ( const char* theURL, const bool isMultiFile ) -{ - std::string anURLDir = SALOMEDS_Tool::GetDirFromPath(theURL); - std::string aTmpDir = isMultiFile ? anURLDir : SALOMEDS_Tool::GetTmpDir(); - return aTmpDir; -} - -/*! - Removes temporary files -*/ -void SalomeApp_Study::RemoveTemporaryFiles ( const char* theModuleName, const bool isMultiFile ) const -{ - if (isMultiFile) - return; - - std::vector aListOfFiles = GetListOfFiles( theModuleName ); - if (aListOfFiles.size() > 0) { - std::string aTmpDir = aListOfFiles[0]; - - const int n = aListOfFiles.size() - 1; - SALOMEDS::ListOfFileNames_var aSeq = new SALOMEDS::ListOfFileNames; - aSeq->length(n); - for (int i = 0; i < n; i++) - aSeq[i] = CORBA::string_dup(aListOfFiles[i + 1].c_str()); - - SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq.in(), true); - } -} - -/*! - Deletes all references to object - \param obj - object -*/ -void SalomeApp_Study::deleteReferencesTo( _PTR( SObject ) obj ) -{ - _PTR(StudyBuilder) sb = studyDS()->NewBuilder(); - std::vector<_PTR(SObject)> aRefs = studyDS()->FindDependances( obj ); - for( int i=0, n=aRefs.size(); iGetFatherComponent()->ComponentDataType()==obj->GetFatherComponent()->ComponentDataType() ) - { - sb->RemoveReference( o ); - sb->RemoveObjectWithChildren( o ); - } - } -} - -/*! - \return real entry by entry of reference - \param entry - entry of reference object -*/ -QString SalomeApp_Study::referencedToEntry( const QString& entry ) const -{ - _PTR(SObject) obj = studyDS()->FindObjectID( entry.toStdString() ); - _PTR(SObject) refobj; - - if( obj && obj->ReferencedObject( refobj ) ) - return refobj->GetID().c_str(); - return LightApp_Study::referencedToEntry( entry ); -} - -/*! - \return component data type for entry -*/ -QString SalomeApp_Study::componentDataType( const QString& entry ) const -{ - _PTR(SObject) obj( studyDS()->FindObjectID( entry.toStdString() ) ); - if ( !obj ) - return LightApp_Study::componentDataType( entry ); - return obj->GetFatherComponent()->ComponentDataType().c_str(); -} - -/*! - \return true if entry corresponds to component -*/ -bool SalomeApp_Study::isComponent( const QString& entry ) const -{ - _PTR(SObject) obj( studyDS()->FindObjectID( entry.toStdString() ) ); - return obj && QString( obj->GetID().c_str() ) == obj->GetFatherComponent()->GetID().c_str(); -} - -/*! - \return entries of object children -*/ -void SalomeApp_Study::children( const QString& entry, QStringList& child_entries ) const -{ - _PTR(SObject) SO = studyDS()->FindObjectID( entry.toStdString() ); - _PTR(ChildIterator) anIter ( studyDS()->NewChildIterator( SO ) ); - anIter->InitEx( true ); - while( anIter->More() ) - { - _PTR(SObject) val( anIter->Value() ); - child_entries.append( val->GetID().c_str() ); - anIter->Next(); - } -} - -/*! - Fills list with components names - \param comp - list to be filled -*/ -void SalomeApp_Study::components( QStringList& comps ) const -{ - for( _PTR(SComponentIterator) it ( studyDS()->NewComponentIterator() ); it->More(); it->Next() ) - { - _PTR(SComponent) aComponent ( it->Value() ); - if( aComponent && aComponent->ComponentDataType() == "Interface Applicative" ) - continue; // skip the magic "Interface Applicative" component - comps.append( aComponent->ComponentDataType().c_str() ); - } -} - -/*! - \return a list of saved points' IDs -*/ -std::vector SalomeApp_Study::getSavePoints() -{ - std::vector v; - - _PTR(SObject) so = studyDS()->FindComponent("Interface Applicative"); - if(!so) return v; - - _PTR(StudyBuilder) builder = studyDS()->NewBuilder(); - _PTR(ChildIterator) anIter ( studyDS()->NewChildIterator( so ) ); - for(; anIter->More(); anIter->Next()) - { - _PTR(SObject) val( anIter->Value() ); - _PTR(GenericAttribute) genAttr; - if(builder->FindAttribute(val, genAttr, "AttributeParameter")) v.push_back(val->Tag()); - } - - return v; -} - -/*! - Removes a given save point -*/ -void SalomeApp_Study::removeSavePoint(int savePoint) -{ - if(savePoint <= 0) return; - _PTR(AttributeParameter) AP = studyDS()->GetCommonParameters(getVisualComponentName(), savePoint); - _PTR(SObject) so = AP->GetSObject(); - _PTR(StudyBuilder) builder = studyDS()->NewBuilder(); - builder->RemoveObjectWithChildren(so); -} - -/*! - \return a name of save point -*/ -QString SalomeApp_Study::getNameOfSavePoint(int savePoint) -{ - _PTR(AttributeParameter) AP = studyDS()->GetCommonParameters(getVisualComponentName(), savePoint); - _PTR(IParameters) ip = ClientFactory::getIParameters(AP); - return ip->getProperty("AP_SAVEPOINT_NAME").c_str(); -} - -/*! - Sets a name of save point -*/ -void SalomeApp_Study::setNameOfSavePoint(int savePoint, const QString& nameOfSavePoint) -{ - _PTR(AttributeParameter) AP = studyDS()->GetCommonParameters(getVisualComponentName(), savePoint); - _PTR(IParameters) ip = ClientFactory::getIParameters(AP); - ip->setProperty("AP_SAVEPOINT_NAME", nameOfSavePoint.toStdString()); -} - -/*! - \return a name of the component where visual parameters are stored -*/ -std::string SalomeApp_Study::getVisualComponentName() -{ - return "Interface Applicative"; -} - -/*! - * \brief Restores the study state - */ -void SalomeApp_Study::restoreState(int savePoint) -{ - SalomeApp_VisualState((SalomeApp_Application*)application()).restoreState(savePoint); -} - - -/*! - Slot: called on change of a root of a data model. Redefined from CAM_Study -*/ -void SalomeApp_Study::updateModelRoot( const CAM_DataModel* dm ) -{ - LightApp_Study::updateModelRoot( dm ); - - // calling updateSavePointDataObjects in order to set correct order of "Gui states" object - // it must always be the last one. - ((SalomeApp_Application*)application())->updateSavePointDataObjects( this ); -} diff --git a/src/SalomeApp/SalomeApp_Study.h b/src/SalomeApp/SalomeApp_Study.h deleted file mode 100644 index cd2df2762..000000000 --- a/src/SalomeApp/SalomeApp_Study.h +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 SALOMEAPP_STUDY_H -#define SALOMEAPP_STUDY_H - -#include "SalomeApp.h" - -#include - -#ifdef WIN32 -#pragma warning( disable:4251 ) -#endif - -#include "SALOMEDSClient.hxx" - -class SALOMEAPP_EXPORT SalomeApp_Study : public LightApp_Study -{ - Q_OBJECT - -public: - SalomeApp_Study( SUIT_Application* ); - virtual ~SalomeApp_Study(); - - virtual int id() const; - - virtual bool createDocument( const QString& ); - virtual bool openDocument( const QString& ); - virtual bool loadDocument( const QString& ); - - virtual bool saveDocument(); - virtual bool saveDocumentAs( const QString& ); - - virtual void closeDocument(bool permanently = true); - - virtual bool isSaved() const; - virtual bool isModified() const; - virtual void Modified(); - - virtual void addComponent ( const CAM_DataModel* dm); - - _PTR(Study) studyDS() const; - - virtual std::string GetTmpDir ( const char* theURL, const bool isMultiFile); - - // to delete all references to object, whose have the same component - void deleteReferencesTo( _PTR( SObject ) ); - - virtual QString componentDataType( const QString& ) const; - virtual QString referencedToEntry( const QString& ) const; - virtual bool isComponent( const QString& ) const; - virtual void children( const QString&, QStringList& ) const; - virtual void components( QStringList& ) const; - - std::vector getSavePoints(); - void removeSavePoint(int savePoint); - QString getNameOfSavePoint(int savePoint); - void setNameOfSavePoint(int savePoint, const QString& nameOfSavePoint); - virtual std::string getVisualComponentName(); - - virtual void restoreState(int savePoint); - -protected: - virtual void saveModuleData ( QString theModuleName, QStringList theListOfFiles ); - virtual void openModuleData ( QString theModuleName, QStringList& theListOfFiles ); - virtual bool saveStudyData ( const QString& theFileName ); - virtual bool openStudyData ( const QString& theFileName ); - - virtual std::vector GetListOfFiles ( const char* theModuleName ) const; - virtual void SetListOfFiles ( const char* theModuleName, - const std::vector theListOfFiles); - virtual void RemoveTemporaryFiles ( const char* theModuleName, const bool isMultiFile) const; - -protected: - virtual void dataModelInserted( const CAM_DataModel* ); - virtual bool openDataModel( const QString&, CAM_DataModel* ); - void setStudyDS(const _PTR(Study)& s ); - -protected slots: - virtual void updateModelRoot( const CAM_DataModel* ); - -private: - QString newStudyName() const; - -private: - _PTR(Study) myStudyDS; -}; - -#ifdef WIN32 -#pragma warning( default:4251 ) -#endif - -#endif diff --git a/src/SalomeApp/SalomeApp_StudyPropertiesDlg.cxx b/src/SalomeApp/SalomeApp_StudyPropertiesDlg.cxx deleted file mode 100644 index 8567371be..000000000 --- a/src/SalomeApp/SalomeApp_StudyPropertiesDlg.cxx +++ /dev/null @@ -1,371 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 -// -// SALOME SalomeApp -// -// File : SalomeApp_StudyPropertiesDlg.cxx -// Author : Sergey ANIKIN -// Module : SALOME -// $Header$ - -#include "SalomeApp_StudyPropertiesDlg.h" -#include "SalomeApp_ListView.h" -#include "SalomeApp_Study.h" - -#include "SUIT_Session.h" -#include -#include - -// CORBA Headers -#include -#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) - -// QT Includes -#include -#include - -using namespace std; - -#define DEFAULT_MARGIN 11 -#define DEFAULT_SPACING 6 -#define SPACER_SIZE 5 -#define MIN_LIST_WIDTH 300 -#define MIN_LIST_HEIGHT 150 - -class SalomeApp_PropItem : public SalomeApp_ListViewItem -{ -public: - /*! constructor */ - SalomeApp_PropItem(SalomeApp_ListView* parent, - const QString theName, - const bool theEditable, - const int theUserType) : - SalomeApp_ListViewItem( parent, QStringList(theName), theEditable ) - { - setUserType(theUserType); - } - /*! constructor */ - SalomeApp_PropItem(SalomeApp_ListView* parent, - SalomeApp_ListViewItem* after, - const QString theName, - const bool theEditable, - const int theUserType) : - SalomeApp_ListViewItem( parent, after, theName, theEditable ) - { - setUserType(theUserType); - } - /*! fills widget with initial values (list or single value)*/ - void fillWidgetWithValues( SalomeApp_EntityEdit* theWidget ) - { - QStringList list; - switch(getUserType()) { - //case SalomeApp_StudyPropertiesDlg::prpModeId: - // { - // list << SalomeApp_StudyPropertiesDlg::tr("PRP_MODE_FROM_SCRATCH") << - // SalomeApp_StudyPropertiesDlg::tr("PRP_MODE_FROM_COPYFROM"); - // theWidget->insertList(list); - // break; - // } - case SalomeApp_StudyPropertiesDlg::prpLockedId: - { - list << SalomeApp_StudyPropertiesDlg::tr( "PRP_NO" ) << SalomeApp_StudyPropertiesDlg::tr( "PRP_YES" ); - theWidget->insertList(list, getValue() == SalomeApp_StudyPropertiesDlg::tr( "PRP_NO" ) ? 0 : 1 ); - break; - } - case SalomeApp_StudyPropertiesDlg::prpModificationsId: - { - SalomeApp_Study* study = - dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - if (study) { - _PTR(Study) studyDoc = study->studyDS(); - _PTR(AttributeStudyProperties) propAttr; - if ( studyDoc ) { - propAttr = studyDoc->GetProperties(); - if ( propAttr ) { - std::vector aUsers; - std::vector aMins, aHours, aDays, aMonths, aYears; - propAttr->GetModificationsList(aUsers, aMins, aHours, aDays, aMonths, aYears, false); - int aCnt = aUsers.size(); - for ( int i = 0; i < aCnt; i++ ) { - QString val; - val.sprintf("%2.2d/%2.2d/%2d %2.2d:%2.2d", - aDays [i], - aMonths[i], - aYears [i], - aHours [i], - aMins [i]); - val = val + " : " + QString( aUsers[i].c_str() ); - list.prepend(val); - } - theWidget->setDuplicatesEnabled(true); - theWidget->insertList(list); - } - } - } - break; - } - default: - { - SalomeApp_ListViewItem::fillWidgetWithValues(theWidget); - break; - } - } - } - /*! finishes editing of entity */ - virtual UpdateType finishEditing( SalomeApp_EntityEdit* theWidget ) { - if ( getUserType() == SalomeApp_StudyPropertiesDlg::prpModificationsId ) - return utCancel; - else - return SalomeApp_ListViewItem::finishEditing(theWidget); - } -}; - -/*!Constructor. Initialize study properties dialog.*/ -SalomeApp_StudyPropertiesDlg::SalomeApp_StudyPropertiesDlg(QWidget* parent) - : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint ), - myChanged( false ) -{ - setObjectName( "" ); - setModal( TRUE ); - - setWindowTitle(tr("TLT_STUDY_PROPERTIES")); - setSizeGripEnabled( true ); - - setWindowFlags( windowFlags() ^ QFlags(!Qt::WindowContextHelpButtonHint) ); - - QGridLayout* mainLayout = new QGridLayout(this); - mainLayout->setMargin(DEFAULT_MARGIN); - mainLayout->setSpacing(DEFAULT_SPACING); - - myPropList = new SalomeApp_ListView(this); - myPropList->setColumnCount(2); - QStringList aLabels; - aLabels << "" << ""; - myPropList->setHeaderLabels( aLabels ); - myPropList->enableEditing(TRUE); - myPropList->setMinimumSize(MIN_LIST_WIDTH, MIN_LIST_HEIGHT); - mainLayout->addWidget(myPropList, 0, 0, 1, 3); - - myOKBtn = new QPushButton(tr("BUT_OK"), this); - mainLayout->addWidget(myOKBtn, 1, 0); - - myCancelBtn = new QPushButton(tr("BUT_CANCEL"), this); - mainLayout->addWidget(myCancelBtn, 1, 2); - - QSpacerItem* spacer1 = - new QSpacerItem(SPACER_SIZE, SPACER_SIZE, QSizePolicy::Expanding, QSizePolicy::Minimum); - mainLayout->addItem(spacer1, 1, 1); - - // Display study properties - SalomeApp_Study* study = - dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - if (study) - myStudyDoc = study->studyDS(); - - initData(); - - connect(myOKBtn, SIGNAL(clicked()), this, SLOT(onOK())); - connect(myCancelBtn, SIGNAL(clicked()), this, SLOT(reject())); -} - -/*! - Destructor. -*/ -SalomeApp_StudyPropertiesDlg::~SalomeApp_StudyPropertiesDlg() -{ -} - -/*! - Data initializetion for dialog.(Study author's name, date of creation etc.) -*/ -void SalomeApp_StudyPropertiesDlg::initData() -{ - bool hasData = myStudyDoc; - _PTR(AttributeStudyProperties) propAttr; - if (hasData) - propAttr = myStudyDoc->GetProperties(); - hasData = hasData && propAttr; - - // Study author's name - SalomeApp_PropItem* item = new SalomeApp_PropItem(myPropList, tr("PRP_AUTHOR")+":", true, prpAuthorId); - if (hasData) - item->setValue(propAttr->GetUserName().c_str()); - - // Date of creation - item = new SalomeApp_PropItem(myPropList, item, tr("PRP_DATE")+":", false, prpDateId); - if (hasData) { - int minutes, hours, day, month, year; - if (propAttr->GetCreationDate(minutes, hours, day, month, year)) { - QString strDate; - strDate.sprintf("%2.2d/%2.2d/%2d %2.2d:%2.2d", day, month, year, hours, minutes); - item->setValue(strDate); - } - } - - // Creation mode -// item = new SalomeApp_PropItem(myPropList, item, tr("PRP_MODE")+":", true, prpModeId); -// item->setEditingType( SalomeApp_EntityEdit::etComboBox); -// if (hasData) item->setValue(propAttr->GetCreationMode()); - - // Locked or not - item = new SalomeApp_PropItem(myPropList, item, tr("PRP_LOCKED")+":", true, prpLockedId); - item->setEditingType( SalomeApp_EntityEdit::etComboBox); - if ( hasData ) - item->setValue( tr( propAttr->IsLocked() ? "PRP_YES" : "PRP_NO" ) ); - - // Saved or not - item = new SalomeApp_PropItem(myPropList, item, tr("PRP_MODIFIED")+":", false, prpSavedId); - bool isModified = false; - SalomeApp_Study* study = dynamic_cast - (SUIT_Session::session()->activeApplication()->activeStudy()); - if (study) { - isModified = study->isModified(); - if (hasData) { - if (propAttr->IsModified() != isModified) { - propAttr->SetModified((int)isModified); - } - } - } - if (hasData) { - if (propAttr->IsModified()) - item->setValue( tr( "PRP_YES" ) ); - else - item->setValue( tr( "PRP_NO" ) ); - } - - // Modifications list - item = new SalomeApp_PropItem(myPropList, item, tr("PRP_MODIFICATIONS")+":", true, prpModificationsId); - item->setEditingType( SalomeApp_EntityEdit::etComboBox); - if (hasData) { - std::vector aUsers; - std::vector aMins, aHours, aDays, aMonths, aYears; - propAttr->GetModificationsList(aUsers, aMins, aHours, aDays, aMonths, aYears, false); - int aLast = aUsers.size()-1; - if (aLast >= 0) { - QString val; - val.sprintf("%2.2d/%2.2d/%2d %2.2d:%2.2d", - aDays [aLast], - aMonths[aLast], - aYears [aLast], - aHours [aLast], - aMins [aLast]); - val = val + " : " + QString(aUsers[aUsers.size()-1].c_str()); - item->setValue(val); - } - } - - myOKBtn->setEnabled(hasData); -} - -/*! - accept data. Return true. -*/ -bool SalomeApp_StudyPropertiesDlg::acceptData() -{ - return TRUE; -} - -/*! - Fill properties attributes. -*/ -void SalomeApp_StudyPropertiesDlg::onOK() -{ - myPropList->accept(); - - if (acceptData()) { - _PTR(AttributeStudyProperties) propAttr = myStudyDoc->GetProperties(); - //myChanged = propChanged(); - if ( propAttr /*&& myChanged*/ ) { - QTreeWidgetItemIterator it( myPropList ); - // iterate through all items of the listview - while (*it) { - SalomeApp_PropItem* item = (SalomeApp_PropItem*)(*it); - switch (item->getUserType()) { - case prpAuthorId: - if (QString(propAttr->GetUserName().c_str()) != item->getValue().trimmed()) { - if (!propAttr->IsLocked()) { - propAttr->SetUserName(item->getValue().trimmed().toStdString()); - myChanged = true; - } else { - SUIT_MessageBox::warning(SUIT_Session::session()->activeApplication()->desktop(), - QObject::tr("WRN_WARNING"), - QObject::tr("WRN_STUDY_LOCKED") ); - } - } - break; - //case prpModeId: - // propAttr->SetCreationMode(item->getValue().trimmed().latin1()); - // break; - case prpLockedId: - { - bool bLocked = item->getValue().compare(tr("PRP_YES")) == 0; - if (propAttr->IsLocked() != bLocked) { - propAttr->SetLocked(bLocked); - myChanged = true; - } - } - break; - default: - break; - } - ++it; - } - } - accept(); - } -} - -/*! - Check is properties changed? -*/ -bool SalomeApp_StudyPropertiesDlg::propChanged() -{ - _PTR(AttributeStudyProperties) propAttr = myStudyDoc->GetProperties(); - if (propAttr) { - QTreeWidgetItemIterator it (myPropList); - - // iterate through all items of the listview - while (*it) { - SalomeApp_PropItem* item = (SalomeApp_PropItem*)(*it); - switch (item->getUserType()) { - case prpAuthorId: - if ( QString( propAttr->GetUserName().c_str() ) != item->getValue().trimmed() ) { - return true; - } - break; - //case prpModeId: - // if ( QString( propAttr->GetCreationMode().c_str() ) != item->getValue().trimmed() ) { - // return true; - // } - // break; - case prpLockedId: - { - bool bLocked = item->getValue().compare( tr( "PRP_YES" ) ) == 0; - if ( propAttr->IsLocked() != bLocked ) { - return true; - } - break; - } - default: - break; - } - ++it; - } - } - return false; -} diff --git a/src/SalomeApp/SalomeApp_StudyPropertiesDlg.h b/src/SalomeApp/SalomeApp_StudyPropertiesDlg.h deleted file mode 100644 index 6991488fe..000000000 --- a/src/SalomeApp/SalomeApp_StudyPropertiesDlg.h +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 : SalomeApp_StudyPropertiesDlg.h -// Author : Sergey ANIKIN -// Module : SALOME - -#ifndef SALOMEAPP_STUDY_PROPERTIES_DLG_H -#define SALOMEAPP_STUDY_PROPERTIES_DLG_H - -#include "SalomeApp.h" - -#include - -#include -#include CORBA_SERVER_HEADER(SALOMEDS) - -#include - -class SalomeApp_ListView; -class QPushButton; - -class SALOMEAPP_EXPORT SalomeApp_StudyPropertiesDlg : public QDialog -{ - Q_OBJECT - -public: - enum { - prpAuthorId, - prpModeId, - prpDateId, - prpSavedId, - prpLockedId, - prpModificationsId, - prpLastId - }; - -public: - SalomeApp_StudyPropertiesDlg( QWidget* parent = 0 ); - ~SalomeApp_StudyPropertiesDlg(); - - bool isChanged() { return myChanged; } - -public slots: - void onOK(); - -private: - void initData(); - bool acceptData(); - bool propChanged(); - -private: - SalomeApp_ListView* myPropList; - QPushButton* myOKBtn; - QPushButton* myCancelBtn; - bool myChanged; - - _PTR(Study) myStudyDoc; -}; - -#endif // SALOMEAPP_STUDY_PROPERTIES_DLG_H diff --git a/src/SalomeApp/SalomeApp_Tools.cxx b/src/SalomeApp/SalomeApp_Tools.cxx deleted file mode 100644 index 893629e9d..000000000 --- a/src/SalomeApp/SalomeApp_Tools.cxx +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 "SalomeApp_Tools.h" - -#include -#include -#include - -#include - -#include -#include - -#include - -/*! - Convert QColor to Quantity_Color, if QColor is valid. -*/ -Quantity_Color SalomeApp_Tools::color( const QColor& c ) -{ - Quantity_Color aColor; - if ( c.isValid() ) - aColor = Quantity_Color( c.red() / 255., c.green() / 255., c.blue() / 255., Quantity_TOC_RGB ); - return aColor; -} - -/*! - Convert Quantity_Color to QColor. -*/ -QColor SalomeApp_Tools::color( const Quantity_Color& c ) -{ - return QColor( (int)( c.Red() * 255 ), (int)( c.Green() * 255 ), (int)( c.Blue() * 255 ) ); -} - -/*! - Gets message on exception \a S_ex. -*/ -QString SalomeApp_Tools::ExceptionToString( const SALOME::SALOME_Exception& S_ex ) -{ - QString message; - - switch ( S_ex.details.type ) - { - case SALOME::COMM: - case SALOME::INTERNAL_ERROR: - { - message = QString( S_ex.details.text ); - QString source( S_ex.details.sourceFile ); - QString line; - line.setNum( S_ex.details.lineNumber ); - message = message + " \n" + source + " : " + line; - break; - } - case SALOME::BAD_PARAM: - { - message = QString( S_ex.details.text ); -#ifdef _DEBUG_ - QString source( S_ex.details.sourceFile ); - QString line; - line.setNum( S_ex.details.lineNumber ); - message = message + " \n" + source + " : " + line; -#endif - break; - } - default: - { - message = QString( "SALOME CORBA Exception Type invalid" ); - QString source( S_ex.details.sourceFile ); - QString line; - line.setNum( S_ex.details.lineNumber ); - message = message + " \n" + source + " : " + line; - break; - } - } - return message; -} - -/*! - Gets message box on exception \a S_ex. -*/ -void SalomeApp_Tools::QtCatchCorbaException( const SALOME::SALOME_Exception& S_ex ) -{ - QString message = ExceptionToString( S_ex ); - - QString title; - bool error = true; - switch ( S_ex.details.type ) - { - case SALOME::COMM: - case SALOME::INTERNAL_ERROR: - title = QObject::tr( "Engine Error" ); - break; - case SALOME::BAD_PARAM: - error = false; - title = QObject::tr( "Engine Warning" ); - break; - default: - title = QObject::tr( "Internal SALOME Error" ); - break; - } - - if ( error ) - SUIT_MessageBox::critical( SUIT_Session::session()->activeApplication()->desktop(), - title, message ); - else - SUIT_MessageBox::warning( SUIT_Session::session()->activeApplication()->desktop(), - title, message ); - -} diff --git a/src/SalomeApp/SalomeApp_Tools.h b/src/SalomeApp/SalomeApp_Tools.h deleted file mode 100644 index c288ef12f..000000000 --- a/src/SalomeApp/SalomeApp_Tools.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 SALOMEAPP_TOOLS_H -#define SALOMEAPP_TOOLS_H - -#include "SalomeApp.h" - -#include - -class QColor; -class QString; - -class Quantity_Color; - -#include -#include CORBA_CLIENT_HEADER(SALOME_Exception) - -/*! - Class which provide color converter and exception message box. -*/ -class SALOMEAPP_EXPORT SalomeApp_Tools : public SUIT_Tools -{ -public: - static Quantity_Color color( const QColor& ); - static QColor color( const Quantity_Color& ); - - static QString ExceptionToString( const SALOME::SALOME_Exception& ); - static void QtCatchCorbaException( const SALOME::SALOME_Exception& ); -}; - -#endif diff --git a/src/SalomeApp/SalomeApp_TypeFilter.cxx b/src/SalomeApp/SalomeApp_TypeFilter.cxx deleted file mode 100644 index 2a8d2fb8a..000000000 --- a/src/SalomeApp/SalomeApp_TypeFilter.cxx +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 "SalomeApp_TypeFilter.h" - -#include "LightApp_DataOwner.h" -#include "SalomeApp_Study.h" - -/*! - Constructor. -*/ -SalomeApp_TypeFilter::SalomeApp_TypeFilter( SalomeApp_Study* study, const QString& kind ) - : SalomeApp_Filter( study ) -{ - myKind = kind; -} - -/*! - Destructor. -*/ -SalomeApp_TypeFilter::~SalomeApp_TypeFilter() -{ -} - -/*! - Check: data owner is valid? -*/ -bool SalomeApp_TypeFilter::isOk( const SUIT_DataOwner* sOwner ) const -{ - const LightApp_DataOwner* owner = dynamic_cast ( sOwner ); - - SalomeApp_Study* aDoc = getStudy(); - if (owner && aDoc && aDoc->studyDS()) - { - _PTR(Study) aStudy = aDoc->studyDS(); - QString entry = owner->entry(); - - _PTR(SObject) aSObj( aStudy->FindObjectID( entry.toStdString() ) ); - if (aSObj) - { - _PTR(SComponent) aComponent(aSObj->GetFatherComponent()); - if ( aComponent && (aComponent->ComponentDataType() == myKind.toStdString()) ) - return true; - } - } - - return false; -} diff --git a/src/SalomeApp/SalomeApp_TypeFilter.h b/src/SalomeApp/SalomeApp_TypeFilter.h deleted file mode 100644 index fa18adf95..000000000 --- a/src/SalomeApp/SalomeApp_TypeFilter.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 SALOMEAPP_TYPEFILTER_H -#define SALOMEAPP_TYPEFILTER_H - -#include - -#include "SalomeApp_Filter.h" - -/*! - Class which provide data owner validation. -*/ -class SALOMEAPP_EXPORT SalomeApp_TypeFilter: public SalomeApp_Filter -{ -public: - SalomeApp_TypeFilter( SalomeApp_Study* study, const QString& kind ); - ~SalomeApp_TypeFilter(); - - virtual bool isOk( const SUIT_DataOwner* ) const; - -private: - QString myKind; -}; - -#endif diff --git a/src/SalomeApp/SalomeApp_VisualState.cxx b/src/SalomeApp/SalomeApp_VisualState.cxx deleted file mode 100644 index a3f14ddb6..000000000 --- a/src/SalomeApp/SalomeApp_VisualState.cxx +++ /dev/null @@ -1,324 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 "SalomeApp_VisualState.h" - -#include "SalomeApp_Module.h" -#include "SalomeApp_Study.h" -#include "SalomeApp_Application.h" - -//#include -#include -#include -#include - -#include - -#include -#include -#include - -#include //? -#include //? - -#include //? -#include //? - -/*! - Constructor. -*/ -SalomeApp_VisualState::SalomeApp_VisualState( SalomeApp_Application* app ) - : myApp( app ) -{ -} - -/*! - Destructor. -*/ -SalomeApp_VisualState::~SalomeApp_VisualState() -{ -} - -/*! - Sets names of all view windows in given list. This is used - in order to apply the same naming algorithm when saving and restoring - view windows. Names of view windows must be the same before saving - workstack (splitters) information, and before its restoring! - Naming rule: ViewerType_IndexOfViewerOfThisType_IndexOfViewInThisViewer - VTKViewer_0_0 - OCCViewer_0_0 OCCViewer_0_1 OCCViewer_0_2 - VTKViewer_1_0 -*/ -void nameViewWindows( const ViewManagerList& lst ) -{ - QMultiHash viewersCounter; // map viewerType - to - index_of_this_viewer_type - QListIterator it(lst); - SUIT_ViewManager* aVM = 0; - while ( it.hasNext() ) { - aVM = it.next(); - if ( !aVM ) continue; - - int view_count = aVM->getViewsCount(); - QString vType = aVM->getType(); - if ( !view_count ) - continue; //No views is opened in the viewer - - int viewerID = viewersCounter.value( vType ); - if ( !viewerID ) { - viewerID = 0; - viewersCounter.insert( vType, viewerID ); - } - else - ++viewerID; - - QVector views = aVM->getViews(); - for ( int i = 0; i < view_count; i++ ) { - QString vName = QString( "%1_%2_%3" ).arg( vType ).arg( viewerID ).arg( i ); - views[i]->setObjectName( vName ); - } - } - viewersCounter.clear(); -} - -/*! - Stores the visual parameters of the viewers -*/ -int SalomeApp_VisualState::storeState() -{ - SalomeApp_Study* study = dynamic_cast( myApp->activeStudy() ); - if ( !study ) - return -1; - - int savePoint = 1; - std::vector savePoints = study->getSavePoints(); - //Calculate a new savePoint number = the last save point number + 1 - if ( savePoints.size() > 0) - savePoint = savePoints[savePoints.size()-1] + 1; - - _PTR(AttributeParameter) ap = study->studyDS()->GetCommonParameters( study->getVisualComponentName(), savePoint ); - _PTR(IParameters) ip = ClientFactory::getIParameters( ap ); - - ViewManagerList lst; - myApp->viewManagers( lst ); - - // setting unique names for view windows in order to save this view inside - // workstack's structure (see below). On restore the views with the same names will - // be placed to the same place inside the workstack's splitters. - nameViewWindows( lst ); - - // store active window's name - SUIT_ViewWindow* win = myApp->desktop()->activeWindow(); - if ( win ) - ip->setProperty("AP_ACTIVE_VIEW", win->objectName().toStdString() ); - - int viewerID = 0; - SUIT_ViewManager* vm = 0; - QListIterator it( lst ); - while ( it.hasNext() ) { - vm = it.next(); - if ( !vm ) continue; - - int view_count = vm->getViewsCount(); - if ( !view_count ) - continue; //No views is opened in the viewer - - std::string viewerEntry = QString( "%1_%2" ).arg( vm->getType() ).arg( ++viewerID ).toStdString(); - ip->append("AP_VIEWERS_LIST", viewerEntry); - - QVector views = vm->getViews(); - for(int i = 0; iappend( viewerEntry, views[i]->windowTitle().toStdString() ); - ip->append( viewerEntry, views[i]->getVisualParameters().toStdString() ); - } - } - - //Save information about split areas - if ( myApp->desktop()->inherits( "STD_TabDesktop" ) ) { - QtxWorkstack* workstack = ((STD_TabDesktop*)myApp->desktop())->workstack(); - QString workstackInfo; - (*workstack) >> workstackInfo; - ip->setProperty( "AP_WORKSTACK_INFO", workstackInfo.toStdString() ); - } - - //Save a name of the active module - if ( CAM_Module* activeModule = myApp->activeModule() ) - ip->setProperty( "AP_ACTIVE_MODULE", activeModule->moduleName().toStdString() ); - - //Store visual parameters of the modules - QList mlist; - myApp->modules( mlist ); - QListIterator itM( mlist ); - CAM_Module* module = 0; - while ( itM.hasNext() ) { - module = itM.next(); - if ( !module ) continue; - - if ( SalomeApp_Module* sModule = dynamic_cast( module ) ) { - ip->append( "AP_MODULES_LIST", sModule->moduleName().toStdString() ); - sModule->storeVisualParameters( savePoint ); - } - } - - // set default name of new savePoint - study->setNameOfSavePoint( savePoint, QObject::tr( "SAVE_POINT_DEF_NAME" ) + QString::number( savePoint ) ); - - return savePoint; -} - -/*! - Restores the visual parameters of the viewers -*/ -void SalomeApp_VisualState::restoreState(int savePoint) -{ - SalomeApp_Study* study = dynamic_cast( myApp->activeStudy() ); - if ( !study ) - return; - - _PTR(AttributeParameter) ap = study->studyDS()->GetCommonParameters( study->getVisualComponentName(), savePoint ); - _PTR(IParameters) ip = ClientFactory::getIParameters(ap); - - //Remove all already existent veiwers and their views - ViewManagerList lst; - myApp->viewManagers( lst ); - QListIterator it(lst); - while ( it.hasNext() ) { - myApp->removeViewManager( it.next() ); - qApp->processEvents(); - } - //Restore the viewers and view windows - int nbViewers = ip->nbValues( "AP_VIEWERS_LIST" ); - SUIT_ViewWindow* viewWin = 0; - - // parameters of view windows are stored in a map for restoring after restoring of the workstack - QMap viewersParameters; - - for ( int i = 0; i < nbViewers; i++ ) { - std::string viewerEntry = ip->getValue( "AP_VIEWERS_LIST", i ); - std::vector veiewerParams = ip->parseValue(viewerEntry,'_'); - std::string type = veiewerParams[0]; - std::string viewerID = veiewerParams[1]; - SUIT_ViewManager* vm = myApp->newViewManager( type.c_str() ); - if ( !vm ) - continue; //Unknown viewer - - int nbViews = (ip->nbValues(viewerEntry))/2; - - //Create nbViews-1 view (-1 because 1 view is created by createViewManager) - for ( int i = 1; i< nbViews; i++ ) { - SUIT_ViewWindow* aView = vm->createViewWindow(); - aView->show(); - } - - int viewCount = vm->getViewsCount(); - if (viewCount != nbViews) { - printf( "\nRestore visual state: Unknow error, Can't create a view!\n" ); - continue; - } - - //Resize the views, set their captions and apply visual parameters. - QVector views = vm->getViews(); - for (int i = 0, j = 0; iisVisible() ) - qApp->processEvents(); - - viewWin->setWindowTitle(ip->getValue(viewerEntry, j).c_str()); - - // printf ( "VP for viewWin \"%s\": %s\n", viewerEntry.c_str(), ip->getValue(viewerEntry, j+1).c_str() ); - viewersParameters[ viewWin ] = ip->getValue(viewerEntry, j+1).c_str(); - //viewWin->setVisualParameters(ip->getValue(viewerEntry, j+1).c_str()); - } - } - - // restore modules' visual parameters - std::vector v = ip->getValues("AP_MODULES_LIST"); - for ( int i = 0; i < v.size(); i++ ) { - myApp->activateModule( v[i].c_str() ); - if ( SalomeApp_Module* module = dynamic_cast( myApp->activeModule() ) ) - module->restoreVisualParameters( savePoint ); - } - - // new view windows may have been created in module->restoreVisualParameters() [GAUSS] - // so here we store their visual parameters for later restoring.. - lst.clear(); - myApp->viewManagers(lst); - QListIterator itVM( lst ); - SUIT_ViewManager* aVM = 0; - while ( itVM.hasNext() ) { - aVM = itVM.next(); - if ( !aVM ) continue; - - int view_count = aVM->getViewsCount(); - QVector views = aVM->getViews(); - for ( int i = 0; i < view_count; i++ ) { - if ( !viewersParameters.contains( views[i] ) ) { - viewersParameters[ views[i] ] = views[i]->getVisualParameters(); - // printf ( "store VP for viewWin \"%s\": %s\n", views[i]->name(), views[i]->getVisualParameters().toLatin1().constData() ); - } - } - } - - // activate module that was active on save - QString activeModuleName( ip->getProperty("AP_ACTIVE_MODULE" ).c_str() ); - if ( !activeModuleName.isEmpty() ) - myApp->activateModule( activeModuleName ); - - // setting unique names for view windows in order to restore positions of view windows inside - // workstack's structure (see below). During save the same naming algorithm was used, - // so the same views will get the same names. - nameViewWindows( lst ); - - // restore workstack parameters. should be done after module's restoreVisualParameters(), because - // some modules can create their own viewers (like VISU creates GaussViewers) - if ( myApp->desktop()->inherits( "STD_TabDesktop" ) ) { - QtxWorkstack* workstack = ((STD_TabDesktop*)myApp->desktop())->workstack(); - (*workstack) << ip->getProperty( "AP_WORKSTACK_INFO" ).c_str(); - } - - // restore visual parameters of view windows. it must be done AFTER restoring workstack. - // also set active view - std::string activeViewName = ip->getProperty("AP_ACTIVE_VIEW"); - QMap::Iterator mapIt; - for ( mapIt = viewersParameters.begin(); mapIt != viewersParameters.end(); ++mapIt ) { - mapIt.key()->setVisualParameters( mapIt.value() ); - if ( activeViewName == mapIt.key()->objectName().toStdString() ) - mapIt.key()->setFocus(); - } - - // for ( it.toFirst(); it.current(); ++it ) { - // int view_count = it.current()->getViewsCount(); - // QPtrVector views = it.current()->getViews(); - // for ( int i = 0; i < view_count; i++ ) - // views[i]->setVisualParameters( viewersParameters[ views[i]->name() ] ); - // } - - // set focus to previously saved active view window - // std::string activeViewName = ip->getProperty("AP_ACTIVE_VIEW"); - // for ( it.toFirst(); it.current(); ++it ) { - // int view_count = it.current()->getViewsCount(); - // QPtrVector views = it.current()->getViews(); - // for ( int i = 0; i < view_count; i++ ) { - // if ( activeViewName == views[i]->name() ) - // views[i]->setFocus(); - // } - // } -} diff --git a/src/SalomeApp/SalomeApp_VisualState.h b/src/SalomeApp/SalomeApp_VisualState.h deleted file mode 100644 index dae7fc091..000000000 --- a/src/SalomeApp/SalomeApp_VisualState.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 SALOMEAPP_VISUALSTATE_H -#define SALOMEAPP_VISUALSTATE_H - -#ifdef WIN32 -#pragma warning( disable:4251 ) -#endif - -#include "SalomeApp.h" - -class SalomeApp_Application; - -class SALOMEAPP_EXPORT SalomeApp_VisualState -{ -public: - SalomeApp_VisualState( SalomeApp_Application* ); - virtual ~SalomeApp_VisualState(); - - virtual int storeState(); - virtual void restoreState( int savePoint ); - -protected: - SalomeApp_Application* myApp; -}; - -#ifdef WIN32 -#pragma warning( default:4251 ) -#endif - -#endif diff --git a/src/SalomeApp/Test/Makefile.am b/src/SalomeApp/Test/Makefile.am deleted file mode 100644 index 3971f30d0..000000000 --- a/src/SalomeApp/Test/Makefile.am +++ /dev/null @@ -1,47 +0,0 @@ -# SALOMELocalTrace : log on local machine -# -# 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.in -# Author : Sergey RUIN -# Module : SALOME - -include $(top_srcdir)/adm_local/unix/make_common_starter.am - -lib_LTLIBRARIES= libSalomeAppTest.la - -salomeinclude_HEADERS= SalomeAppTest.hxx - -dist_libSalomeAppTest_la_SOURCES= SalomeAppTest.cxx - -libSalomeAppTest_la_CXXFLAGS= @CPPUNIT_INCLUDES@ $(KERNEL_CXXFLAGS) -libSalomeAppTest_la_LIBADD= @CPPUNIT_LIBS@ - -bin_PROGRAMS= TestSalomeApp - -TestSalomeApp_SOURCES= TestSalomeApp.cxx - -TestSalomeApp_CXXFLAGS= $(libSalomeAppTest_la_CXXFLAGS) -TestSalomeApp_LDADD= $(libSalomeAppTest_la_LIBADD) libSalomeAppTest.la - -dist_salomescript_PYTHON = TestSalomeApp.py -UNIT_TEST_PROG = TestSalomeApp diff --git a/src/SalomeApp/Test/SalomeAppTest.cxx b/src/SalomeApp/Test/SalomeAppTest.cxx deleted file mode 100644 index e05206e21..000000000 --- a/src/SalomeApp/Test/SalomeAppTest.cxx +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (C) 2006 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 "SalomeAppTest.hxx" - -using namespace std; - -// ============================================================================ -/*! - * Set up the environment - */ -// ============================================================================ - -void SalomeAppTest::setUp() -{ -} - -// ============================================================================ -/*! - * - delete - */ -// ============================================================================ - -void SalomeAppTest::tearDown() -{ -} - -// ============================================================================ -/*! - * Check SalomeApp functionality - */ -// ============================================================================ -void SalomeAppTest::testSalomeApp() -{ -} - - - - diff --git a/src/SalomeApp/Test/SalomeAppTest.hxx b/src/SalomeApp/Test/SalomeAppTest.hxx deleted file mode 100644 index 97dd58146..000000000 --- a/src/SalomeApp/Test/SalomeAppTest.hxx +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (C) 2006 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 _SalomeAppTEST_HXX_ -#define _SalomeAppTEST_HXX_ - -#include - -class SalomeAppTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE( SalomeAppTest ); - CPPUNIT_TEST( testSalomeApp ); - CPPUNIT_TEST_SUITE_END(); - -public: - - void setUp(); - void tearDown(); - void testSalomeApp(); -}; - -#endif diff --git a/src/SalomeApp/Test/TestSalomeApp.cxx b/src/SalomeApp/Test/TestSalomeApp.cxx deleted file mode 100644 index 5e8ca565e..000000000 --- a/src/SalomeApp/Test/TestSalomeApp.cxx +++ /dev/null @@ -1,31 +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 -// - -// --- include all SalomeApp Test from basics until the present directory - -#include "SalomeAppTest.hxx" - -// --- Registers the fixture into the 'registry' - -CPPUNIT_TEST_SUITE_REGISTRATION( SalomeAppTest ); - -// --- generic Main program from Basic/Test - -#include "BasicMainTest.hxx" diff --git a/src/SalomeApp/Test/TestSalomeApp.py b/src/SalomeApp/Test/TestSalomeApp.py deleted file mode 100644 index e636e1fc9..000000000 --- a/src/SalomeApp/Test/TestSalomeApp.py +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms 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 -# - -import sys, os,signal,string,commands -import runSalome -import orbmodule -import TestKiller - -# get SALOME environment : - -args, modules_list, modules_root_dir = runSalome.get_config() -runSalome.set_env(args, modules_list, modules_root_dir) - -# launch CORBA naming server - -clt=orbmodule.client() - -# launch CORBA logger server - -myServer=runSalome.LoggerServer(args) -myServer.run() -clt.waitLogger("Logger") - -# execute Unit Test - -command = ['TestSalomeApp'] -ret = os.spawnvp(os.P_WAIT, command[0], command) - -# kill Test process - -TestKiller.killProcess(runSalome.process_id) diff --git a/src/SalomeApp/resources/SalomeApp.ini b/src/SalomeApp/resources/SalomeApp.ini deleted file mode 100644 index d89841c14..000000000 --- a/src/SalomeApp/resources/SalomeApp.ini +++ /dev/null @@ -1,31 +0,0 @@ -[language] -language = en - -[launch] -modules = GEOM,SMESH,VISU - -[resources] -SUIT = $(GUI_ROOT_DIR)/share/salome/resources/gui -STD = $(GUI_ROOT_DIR)/share/salome/resources/gui -Plot2d = $(GUI_ROOT_DIR)/share/salome/resources/gui -GLViewer = $(GUI_ROOT_DIR)/share/salome/resources/gui -OCCViewer = $(GUI_ROOT_DIR)/share/salome/resources/gui -VTKViewer = $(GUI_ROOT_DIR)/share/salome/resources/gui -SVTK = $(GUI_ROOT_DIR)/share/salome/resources/gui -LightApp = $(GUI_ROOT_DIR)/share/salome/resources/gui -SalomeApp = $(GUI_ROOT_DIR)/share/salome/resources/gui -GEOM = $(GEOM_ROOT_DIR)/share/salome/resources/geom -SMESH = $(SMESH_ROOT_DIR)/share/salome/resources/smesh -VISU = $(VISU_ROOT_DIR)/share/salome/resources/visu - -[GEOM] -name = Geometry -icon = ModulGeom - -[SMESH] -name = Mesh -icon = ModulMesh - -[VISU] -name = Post-Pro -icon = ModulVisu diff --git a/src/SalomeApp/resources/SalomeApp.xml b/src/SalomeApp/resources/SalomeApp.xml deleted file mode 100644 index ec75bd2d0..000000000 --- a/src/SalomeApp/resources/SalomeApp.xml +++ /dev/null @@ -1,162 +0,0 @@ - -
- - - - - - - - - - - - - - - - -
-
- - - -
-
- - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - -
-
- - -
-
- - -
-
- - - - - - - - - -
-
- - - -
-
- - - - - -
-
- - - - - -
-
- - - - - - - - -
-
- - - - -
-
- - - - - - - - - - - - -
-
- - - - -
-
- - -
-
- - - -
-
- - - -
-
diff --git a/src/SalomeApp/resources/SalomeApp_images.po b/src/SalomeApp/resources/SalomeApp_images.po deleted file mode 100644 index 25df26cd8..000000000 --- a/src/SalomeApp/resources/SalomeApp_images.po +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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: SalomeApp_images.po -// Created: November, 2004 -// Author: OCC team -// Copyright (C) CEA 2004 - -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" - diff --git a/src/SalomeApp/resources/SalomeApp_images.ts b/src/SalomeApp/resources/SalomeApp_images.ts deleted file mode 100644 index 4eb9e1878..000000000 --- a/src/SalomeApp/resources/SalomeApp_images.ts +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/src/SalomeApp/resources/SalomeApp_msg_en.po b/src/SalomeApp/resources/SalomeApp_msg_en.po deleted file mode 100644 index d363ec7af..000000000 --- a/src/SalomeApp/resources/SalomeApp_msg_en.po +++ /dev/null @@ -1,269 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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: SalomeApp_msg_en.po -// Created: 10/25/2004 12:46:36 PM -// Author: Sergey LITONIN - -msgid "" -msgstr "" -"Project-Id-Version: PROJECT VERSION\n" -"POT-Creation-Date: 2002-02-22 16:56:46 CET\n" -"PO-Revision-Date: 2004-02-17 11:17+0300\n" -"Last-Translator: FULLNAME \n" -"Content-Type: text/plain; charset=iso-8859-1\n" - -//======================================================================================= - -msgid "BUT_NEW" -msgstr "&New" - -msgid "BUT_OPEN" -msgstr "&Open" - -msgid "BUT_LOAD" -msgstr "&Load" - -//======================================================================================= - -msgid "SalomeApp_Application::PYTHON_CONSOLE" -msgstr "Python Console" - -msgid "SalomeApp_Application::TOT_DESK_FILE_DUMP_STUDY" -msgstr "Dump study" - -msgid "SalomeApp_Application::MEN_DESK_FILE_DUMP_STUDY" -msgstr "&Dump study..." - -msgid "SalomeApp_Application::PRP_DESK_FILE_DUMP_STUDY" -msgstr "Dumps study to the python script" - -msgid "SalomeApp_Application::TOT_DESK_FILE_SAVE_GUI_STATE" -msgstr "Save GUI state" - -msgid "SalomeApp_Application::MEN_DESK_FILE_SAVE_GUI_STATE" -msgstr "Save GUI state" - -msgid "SalomeApp_Application::PRP_DESK_FILE_SAVE_GUI_STATE" -msgstr "Saves current state of viewers, displayed objects, etc." - -msgid "SalomeApp_Application::TOT_DESK_FILE_LOAD_SCRIPT" -msgstr "Load python script" - -msgid "SalomeApp_Application::MEN_DESK_FILE_LOAD_SCRIPT" -msgstr "Load scrip&t..." - -msgid "SalomeApp_Application::PRP_DESK_FILE_LOAD_SCRIPT" -msgstr "Loads python script from file" - -msgid "SalomeApp_Application::TOT_FILE_DESK_PREFERENCES" -msgstr "Preferences" - -msgid "SalomeApp_Application::MEN_DESK_TOOLS" -msgstr "&Tools" - -msgid "SalomeApp_Application::TOT_DESK_CATALOG_GENERATOR" -msgstr "Catalog generator" - -msgid "SalomeApp_Application::MEN_DESK_CATALOG_GENERATOR" -msgstr "Catalog &generator" - -msgid "SalomeApp_Application::PRP_DESK_CATALOG_GENERATOR" -msgstr "Generates XML catalog of a component's interface" - -msgid "SalomeApp_Application::TOT_DESK_REGISTRY_DISPLAY" -msgstr "Registry display" - -msgid "SalomeApp_Application::MEN_DESK_REGISTRY_DISPLAY" -msgstr "Registry &display" - -msgid "SalomeApp_Application::PRP_DESK_REGISTRY_DISPLAY" -msgstr "Displays content of the Registry CORBA server" - -msgid "SalomeApp_Application::TOT_DESK_MRU" -msgstr "Most recently used" - -msgid "SalomeApp_Application::MEN_DESK_MRU" -msgstr "Most recently used" - -msgid "SalomeApp_Application::TOT_DESK_PROPERTIES" -msgstr "Study properties" - -msgid "SalomeApp_Application::MEN_DESK_PROPERTIES" -msgstr "Pro&perties..." - -msgid "SalomeApp_Application::PRP_DESK_PROPERTIES" -msgstr "Edits study properties" - -msgid "SalomeApp_Application::PREF_CATEGORY_SALOME" -msgstr "SALOME" - -msgid "SalomeApp_Application::PREF_TAB_OBJBROWSER" -msgstr "Object browser" - -msgid "SalomeApp_Application::MEN_OPENWITH" -msgstr "Activate %1 Module" - -msgid "SalomeApp_Application::MEN_DELETE_INVALID_REFERENCE" -msgstr "Delete Invalid Reference" - -msgid "SalomeApp_Application::PREF_STORE_VISUAL_STATE" -msgstr "Store/restore last GUI state" - -//======================================================================================= - -msgid "PUBLISH_IN_STUDY" -msgstr "Publish in study" - -msgid "SAVE_GUI_STATE" -msgstr "Save GUI state" - -//======================================================================================= - -msgid "SalomeApp_Application::MEN_WINDOWS_NEW" -msgstr "New window" - -msgid "SalomeApp_Application::MEN_VIEW_WNDS" -msgstr "Windows" - -//======================================================================================= - -msgid "SalomeApp_Application::PREF_GROUP_DEF_COLUMNS" -msgstr "Default columns" - -msgid "SalomeApp_Application::PREF_OBJ_BROWSER_SETTINGS" -msgstr "Settings" - -//======================================================================================= - -msgid "SalomeApp_Application::OBJ_BROWSER_NAME" -msgstr "Object" - -msgid "SalomeApp_Application::OBJ_BROWSER_COLUMN_0" -msgstr "Entry" - -msgid "SalomeApp_Application::OBJ_BROWSER_COLUMN_1" -msgstr "Value" - -msgid "SalomeApp_Application::OBJ_BROWSER_COLUMN_2" -msgstr "IOR" - -msgid "SalomeApp_Application::OBJ_BROWSER_COLUMN_3" -msgstr "Reference entry" - -msgid "SalomeApp_Application::ALL_FILES_FILTER" -msgstr "All files (*.*)" - -msgid "SalomeApp_Application::PYTHON_FILES_FILTER" -msgstr "PYTHON Files (*.py)" - -msgid "SalomeApp_Application::STUDY_LOCKED" -msgstr "LOCKED" - -msgid "SalomeApp_Application::QUE_DOC_ALREADYEXIST" -msgstr "The document %1 already exists in study manager.\nDo you want to reload it ?" - -//======================================================================================= - -msgid "SalomeApp_StudyPropertiesDlg::PRP_MODE_FROM_SCRATCH" -msgstr "from scratch" - -msgid "SalomeApp_StudyPropertiesDlg::PRP_MODE_FROM_COPYFROM" -msgstr "copy from" - -msgid "SalomeApp_StudyPropertiesDlg::TLT_STUDY_PROPERTIES" -msgstr "Study Properties" - -msgid "SalomeApp_StudyPropertiesDlg::PRP_AUTHOR" -msgstr "Author" - -msgid "SalomeApp_StudyPropertiesDlg::PRP_DATE" -msgstr "Created" - -msgid "SalomeApp_StudyPropertiesDlg::PRP_MODE" -msgstr "Mode" - -msgid "SalomeApp_StudyPropertiesDlg::PRP_LOCKED" -msgstr "Locked" - -msgid "SalomeApp_StudyPropertiesDlg::PRP_MODIFIED" -msgstr "Modified" - -msgid "SalomeApp_StudyPropertiesDlg::PRP_MODIFICATIONS" -msgstr "Modifications" - -msgid "SalomeApp_StudyPropertiesDlg::PRP_YES" -msgstr "Yes" - -msgid "SalomeApp_StudyPropertiesDlg::PRP_NO" -msgstr "No" - -//======================================================================================= - -msgid "SalomeApp_Application::PUBLISH_IN_STUDY" -msgstr "Publish in study" - -msgid "SalomeApp_Application::WRN_DUMP_STUDY_FAILED" -msgstr "Dump study failed" - -msgid "SAVE_POINT_OBJECT_TOOLTIP" -msgstr "Saved GUI state: %1" - -msgid "SAVE_POINT_DEF_NAME" -msgstr "GUI state: " - -msgid "SAVE_POINT_ROOT_TOOLTIP" -msgstr "Persistent GUI states" - -msgid "SAVE_POINT_ROOT_NAME" -msgstr "GUI states" - -msgid "CLOSE_LOCKED_STUDY" -msgstr "Close locked study?" - -//======================================================================================= - -msgid "SalomeApp_Application::MEN_RESTORE_VS" -msgstr "Restore" - -msgid "SalomeApp_Application::MEN_RENAME_VS" -msgstr "Rename" - -msgid "SalomeApp_Application::MEN_DELETE_VS" -msgstr "Delete" - -//======================================================================================= - -msgid "SalomeApp_Application::APPCLOSE_SAVE" -msgstr "&Save&&Close" - -msgid "SalomeApp_Application::APPCLOSE_CLOSE" -msgstr "&Close w/o saving" - -msgid "SalomeApp_Application::APPCLOSE_UNLOAD" -msgstr "&Unload" - -msgid "SalomeApp_Application::APPCLOSE_CANCEL" -msgstr "&Cancel" - -msgid "SalomeApp_Application::APPCLOSE_CAPTION" -msgstr "Close active study" - -msgid "SalomeApp_Application::APPCLOSE_DESCRIPTION" -msgstr "Do you want to close or only unload the study" - diff --git a/src/SalomeApp/resources/SalomeApp_msg_en.ts b/src/SalomeApp/resources/SalomeApp_msg_en.ts deleted file mode 100644 index 822063b55..000000000 --- a/src/SalomeApp/resources/SalomeApp_msg_en.ts +++ /dev/null @@ -1,331 +0,0 @@ - - - @default - - WRN_FILE_NAME_BAD - Please enter correct file name. Special characters are not allowed. - - - CLOSE_LOCKED_STUDY - Close locked study? - - - PUBLISH_IN_STUDY - Publish in study - - - BUT_NEW - &New - - - SAVE_POINT_ROOT_NAME - GUI states - - - SAVE_POINT_ROOT_TOOLTIP - Persistent GUI states - - - SAVE_GUI_STATE - Save GUI state - - - BUT_LOAD - &Load - - - BUT_OPEN - &Open - - - SAVE_POINT_OBJECT_TOOLTIP - Saved GUI state: %1 - - - SAVE_POINT_DEF_NAME - GUI state: - - - VALUE_COLUMN - Value - - - IOR_COLUMN - IOR - - - REFENTRY_COLUMN - Ref.Entry - - - - SalomeApp_Application - - ALL_FILES_FILTER - All files (*.*) - - - APPCLOSE_UNLOAD - &Unload - - - APPCLOSE_CLOSE - &Close w/o saving - - - MEN_WINDOWS_NEW - New window - - - MEN_DELETE_INVALID_REFERENCE - Delete Invalid Reference - - - TOT_FILE_DESK_PREFERENCES - Preferences - - - MEN_DELETE_VS - Delete - - - MEN_OPENWITH - Activate %1 Module - - - MEN_DESK_REGISTRY_DISPLAY - Registry &display - - - APPCLOSE_SAVE - &Save && Close - - - TOT_DESK_FILE_LOAD_SCRIPT - Load python script - - - PREF_STORE_VISUAL_STATE - Store/restore last GUI state - - - PRP_DESK_FILE_SAVE_GUI_STATE - Saves current state of viewers, displayed objects, etc. - - - MEN_DESK_FILE_SAVE_GUI_STATE - Save GUI state - - - TOT_DESK_FILE_SAVE_GUI_STATE - Save GUI state - - - MEN_RESTORE_VS - Restore - - - WRN_DUMP_STUDY_FAILED - Dump study failed - - - MEN_DESK_PROPERTIES - Pro&perties... - - - QUE_DOC_ALREADYEXIST - The document %1 already exists in study manager. -Do you want to reload it ? - - - MEN_RENAME_VS - Rename - - - TOT_DESK_CATALOG_GENERATOR - Catalog generator - - - PUBLISH_IN_STUDY - Publish in study - - - PREF_OBJ_BROWSER_SETTINGS - Settings - - - PRP_DESK_REGISTRY_DISPLAY - Displays content of the Registry CORBA server - - - PYTHON_FILES_FILTER - PYTHON Files (*.py) - - - APPCLOSE_DESCRIPTION - Do you want to close or unload study before closing? - - - PRP_DESK_PROPERTIES - Edits study properties - - - PREF_TAB_OBJBROWSER - Object browser - - - STUDY_LOCKED - LOCKED - - - APPCLOSE_CANCEL - &Cancel - - - OBJ_BROWSER_NAME - Object - - - TOT_DESK_REGISTRY_DISPLAY - Registry display - - - OBJ_BROWSER_COLUMN_0 - Entry - - - OBJ_BROWSER_COLUMN_1 - Value - - - OBJ_BROWSER_COLUMN_2 - IOR - - - OBJ_BROWSER_COLUMN_3 - Reference entry - - - PREF_CATEGORY_SALOME - SALOME - - - PYTHON_CONSOLE - Python Console - - - MEN_DESK_FILE_LOAD_SCRIPT - Load scrip&t... - - - MEN_DESK_TOOLS - &Tools - - - TOT_DESK_FILE_DUMP_STUDY - Dump study - - - MEN_VIEW_WNDS - Windows - - - MEN_DESK_FILE_DUMP_STUDY - &Dump study... - - - PRP_DESK_CATALOG_GENERATOR - Generates XML catalog of a component's interface - - - PRP_DESK_FILE_DUMP_STUDY - Dumps study to the python script - - - TOT_DESK_PROPERTIES - Study properties - - - PREF_GROUP_DEF_COLUMNS - Default columns - - - PRP_DESK_FILE_LOAD_SCRIPT - Loads python script from file - - - MEN_DESK_CATALOG_GENERATOR - Catalog &generator - - - APPCLOSE_CAPTION - Close active study - - - MEN_DESK_MRU - Most recently used - - - TOT_DESK_MRU - Most recently used - - - ACTIVATE_MODULE_OP_LOAD - &Load... - - - - SalomeApp_StudyPropertiesDlg - - PRP_MODE_FROM_SCRATCH - from scratch - - - PRP_AUTHOR - Author - - - PRP_LOCKED - Locked - - - PRP_MODIFICATIONS - Modifications - - - PRP_NO - No - - - PRP_YES - Yes - - - PRP_MODIFIED - Modified - - - PRP_DATE - Created - - - PRP_MODE - Mode - - - PRP_MODE_FROM_COPYFROM - copy from - - - TLT_STUDY_PROPERTIES - Study Properties - - - - SalomeApp_ExitDlg - - SHUTDOWN_SERVERS - Shutdown standalone servers - - - diff --git a/src/Session/Makefile.am b/src/Session/Makefile.am deleted file mode 100755 index 6de26cbfa..000000000 --- a/src/Session/Makefile.am +++ /dev/null @@ -1,78 +0,0 @@ -# SALOME Session : implementation of Session.idl -# -# 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.in -# Author : Paul RASCLE, EDF -# Module : SALOME -# $Header$ - -include $(top_srcdir)/adm_local/unix/make_common_starter.am - -lib_LTLIBRARIES = libSalomeSession.la - -salomeinclude_HEADERS= \ - Session_Session_i.hxx \ - Session_ServerLauncher.hxx \ - Session_ServerThread.hxx \ - Session_ServerCheck.hxx \ - SalomeApp_Engine_i.hxx - -# Libraries targets - -dist_libSalomeSession_la_SOURCES= \ - Session_Session_i.cxx \ - Session_ServerThread.cxx \ - Session_ServerLauncher.cxx \ - Session_ServerCheck.cxx \ - SalomeApp_Engine_i.cxx - -libSalomeSession_la_CPPFLAGS= $(QT_MT_INCLUDES) $(PYTHON_INCLUDES) \ - $(HDF5_INCLUDES) $(BOOST_CPPFLAGS) @KERNEL_CXXFLAGS@ $(CAS_CPPFLAGS) \ - @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ \ - -I$(top_builddir)/salome_adm/unix -I$(top_builddir)/idl \ - -I$(srcdir)/../Qtx -I$(srcdir)/../SUIT -I$(srcdir)/../Event \ - -I$(srcdir)/../Style @LIBXML_INCLUDES@ - -libSalomeSession_la_LDFLAGS= $(QT_MT_LIBS) $(KERNEL_LDFLAGS) -lSalomeNS \ - -lSalomeLifeCycleCORBA -lOpUtil -lSALOMELocalTrace -lSalomeCatalog \ - -lSalomeDSClient $(CAS_KERNEL) -lwith_loggerTraceCollector \ - ../SUIT/libsuit.la ../Event/libEvent.la ../../idl/libSalomeIDLGUI.la \ - ../Style/libSalomeStyle.la - -# Executable -bin_PROGRAMS= SALOME_Session_Server - -dist_SALOME_Session_Server_SOURCES= SALOME_Session_Server.cxx - -SALOME_Session_Server_CPPFLAGS= $(libSalomeSession_la_CPPFLAGS) -SALOME_Session_Server_LDADD= $(libSalomeSession_la_LDFLAGS) $(OMNIORB_LIBS) \ - $(HDF5_LIBS) -lSalomeContainer -lSalomeResourcesManager -lTOOLSDS \ - -lSalomeHDFPersist -lSalomeDSImpl -lSalomeGenericObj -lRegistry \ - -lSalomeNotification -lSALOMEBasics -lSalomeLauncher ../Qtx/libqtx.la \ - $(top_builddir)/idl/libSalomeIDLGUI.la \ - libSalomeSession.la - -lib-hook: - ln -sf $(top_builddir)/bin/salome/styles styles - -# ../SalomeApp/libSalomeApp.la diff --git a/src/Session/SALOME_Session.hxx b/src/Session/SALOME_Session.hxx deleted file mode 100755 index 22bb8ffa2..000000000 --- a/src/Session/SALOME_Session.hxx +++ /dev/null @@ -1,39 +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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SALOME_Session.hxx -// Author : Alexander A. BORODIN -// Module : GUI - -#ifndef _SALOME_Session_HXX_ -#define _SALOME_Session_HXX_ - -#if defined WIN32 -# if defined SESSION_EXPORTS -# define SESSION_EXPORT __declspec( dllexport ) -# else -# define SESSION_EXPORT __declspec( dllimport ) -# endif -#else // WIN32 -# define SESSION_EXPORT -#endif // WIN32 - -#endif diff --git a/src/Session/SALOME_Session_Server.cxx b/src/Session/SALOME_Session_Server.cxx deleted file mode 100755 index 4457b8777..000000000 --- a/src/Session/SALOME_Session_Server.cxx +++ /dev/null @@ -1,599 +0,0 @@ -// SALOME Session : implementation of Session.idl -// -// 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 : SALOME_Session_Server.cxx -// Author : Paul RASCLE, EDF -// Module : SALOME - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include CORBA_SERVER_HEADER(SALOME_Session) -#include CORBA_SERVER_HEADER(SALOMEDS) - -#include -#include "Session_ServerLauncher.hxx" -#include "Session_ServerCheck.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -/*! - read arguments, define list of server to launch with their arguments. - * - wait for naming service - * - create and run a thread for launch of all servers - * -*/ - -//! CORBA server for SALOME Session -/*! - * SALOME_Session Server launches a SALOME session servant. - * The servant registers to the Naming Service. - * See SALOME_Session.idl for interface specification. - * - * Main services offered by the servant are: - * - launch GUI - * - stop Session ( must be idle ) - * - get session state - */ - -PyObject* salome_shared_modules_module = 0; - -void MessageOutput( QtMsgType type, const char* msg ) -{ - switch ( type ) - { - case QtDebugMsg: - MESSAGE( "Debug: " << msg ); - break; - case QtWarningMsg: - MESSAGE( "Warning: " << msg ); - break; - case QtFatalMsg: - MESSAGE( "Fatal: " << msg ); - break; - } -} - -/* XPM */ -static const char* pixmap_not_found_xpm[] = { -"16 16 3 1", -" c None", -". c #000000", -"+ c #A80000", -" ", -" ", -" . . ", -" .+. .+. ", -" .+++. .+++. ", -" .+++.+++. ", -" .+++++. ", -" .+++. ", -" .+++++. ", -" .+++.+++. ", -" .+++. .+++. ", -" .+. .+. ", -" . . ", -" ", -" ", -" "}; - -QString salomeVersion() -{ - QString path( ::getenv( "GUI_ROOT_DIR" ) ); - if ( !path.isEmpty() ) - path += QDir::separator(); - path += QString( "bin/salome/VERSION" ); - - QFile vf( path ); - if ( !vf.open( QIODevice::ReadOnly ) ) - return QString(); - - QString line( vf.readLine( 1024 ) ); - - vf.close(); - - if ( line.isEmpty() ) - return QString(); - - while ( !line.isEmpty() && line.at( line.length() - 1 ) == QChar( '\n' ) ) - line.remove( line.length() - 1, 1 ); - - QString ver; - int idx = line.lastIndexOf( ":" ); - if ( idx != -1 ) - ver = line.mid( idx + 1 ).trimmed(); - - return ver; -} - -class SALOME_ResourceMgr : public SUIT_ResourceMgr -{ -public: - SALOME_ResourceMgr( const QString& app, const QString& resVarTemplate ) : SUIT_ResourceMgr( app, resVarTemplate ) - { - setCurrentFormat( "xml" ); - setOption( "translators", QString( "%P_msg_%L.qm|%P_icons.qm|%P_images.qm" ) ); - setDefaultPixmap( QPixmap( pixmap_not_found_xpm ) ); - } - static void initResourceMgr() - { - if ( myExtAppName.isNull() || myExtAppVersion.isNull() ) { - SALOME_ResourceMgr resMgr( "SalomeApp", QString( "%1Config" ) ); - resMgr.loadLanguage( "LightApp", "en" ); - resMgr.loadLanguage( "SalomeApp", "en" ); - - myExtAppName = QObject::tr( "APP_NAME" ).trimmed(); - if ( myExtAppName == "APP_NAME" || myExtAppName.toLower() == "salome" ) - myExtAppName = "SalomeApp"; - myExtAppVersion = QObject::tr( "APP_VERSION" ); - if ( myExtAppVersion == "APP_VERSION" ) { - if ( myExtAppName != "SalomeApp" ) - myExtAppVersion = ""; - else myExtAppVersion = salomeVersion(); - } - } - } - QString version() const { return myExtAppVersion; } - -protected: - QString userFileName( const QString& appName, const bool for_load ) const - { - if ( version().isEmpty() ) return ""; - return SUIT_ResourceMgr::userFileName( myExtAppName, for_load ); - } - - virtual int userFileId( const QString& _fname ) const - { - if ( !myExtAppName.isEmpty() ) { - QRegExp exp( QString( "\\.%1rc\\.([a-zA-Z0-9.]+)$" ).arg( myExtAppName ) ); - QRegExp vers_exp( "^([0-9]+)([A-Za-z]?)([0-9]*)$" ); - - QString fname = QFileInfo( _fname ).fileName(); - if( exp.exactMatch( fname ) ) { - QStringList vers = exp.cap( 1 ).split( ".", QString::SkipEmptyParts ); - int major=0, minor=0; - major = vers[0].toInt(); - minor = vers[1].toInt(); - if( vers_exp.indexIn( vers[2] )==-1 ) - return -1; - int release = 0, dev1 = 0, dev2 = 0; - release = vers_exp.cap( 1 ).toInt(); - dev1 = vers_exp.cap( 2 )[ 0 ].toLatin1(); - dev2 = vers_exp.cap( 3 ).toInt(); - - int dev = dev1*100+dev2, id = major; - id*=100; id+=minor; - id*=100; id+=release; - id*=10000; - if ( dev > 0 ) id+=dev-10000; - return id; - } - } - - return -1; - } - -public: - static QString myExtAppName; - static QString myExtAppVersion; -}; - -QString SALOME_ResourceMgr::myExtAppName = QString(); -QString SALOME_ResourceMgr::myExtAppVersion = QString(); - -class SALOME_Session : public SUIT_Session -{ -public: - SALOME_Session() : SUIT_Session() {} - virtual ~SALOME_Session() {} - -protected: - virtual SUIT_ResourceMgr* createResourceMgr( const QString& appName ) const - { - SALOME_ResourceMgr::initResourceMgr(); - SALOME_ResourceMgr* resMgr = new SALOME_ResourceMgr( appName, QString( "%1Config" ) ); - return resMgr; - } -}; - -class SALOME_QApplication : public QApplication -{ -public: - SALOME_QApplication( int& argc, char** argv ) : QApplication( argc, argv ), myHandler ( 0 ) {} - - virtual bool notify( QObject* receiver, QEvent* e ) - { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) < 0x060101 - // Disable GUI user actions while python command is executed - if (SUIT_Session::IsPythonExecuted()) { - // Disable mouse and keyboard events - QEvent::Type aType = e->type(); - if (aType == QEvent::MouseButtonPress || aType == QEvent::MouseButtonRelease || - aType == QEvent::MouseButtonDblClick || aType == QEvent::MouseMove || - aType == QEvent::Wheel || aType == QEvent::ContextMenu || - aType == QEvent::KeyPress || aType == QEvent::KeyRelease || - aType == QEvent::Accel || aType == QEvent::AccelOverride) - return false; - } -#endif - - return myHandler ? myHandler->handle( receiver, e ) : - QApplication::notify( receiver, e ); - } - SUIT_ExceptionHandler* handler() const { return myHandler; } - void setHandler( SUIT_ExceptionHandler* h ) { myHandler = h; } - -private: - SUIT_ExceptionHandler* myHandler; -}; - -// class which calls SALOME::Session::GetInterface() from another thread -// to avoid mutual lock ( if called from the same thread as main() -class GetInterfaceThread : public QThread -{ -public: - GetInterfaceThread( SALOME::Session_var s ) : session ( s ) - { - start(); - } -protected: - virtual void run() - { - if ( !CORBA::is_nil( session ) ) - session->GetInterface(); - else - printf( "\nFATAL ERROR: SALOME::Session object is nil! Can not display GUI\n\n" ); - } -private: - SALOME::Session_var session; -}; - -// returns true if 'str' is found in argv -bool isFound( const char* str, int argc, char** argv ) -{ - for ( int i = 1; i <= ( argc-1 ); i++ ) - if ( !strcmp( argv[i], str ) ) - return true; - return false; -} - -void killOmniNames() -{ - SALOME_LifeCycleCORBA::killOmniNames(); -} - -// shutdown standalone servers -void shutdownServers( SALOME_NamingService* theNS ) -{ - SALOME_LifeCycleCORBA lcc(theNS); - lcc.shutdownServers(); -} - -// ---------------------------- MAIN ----------------------- -int main( int argc, char **argv ) -{ - bool temp = true; - while(temp) - { - //INFOS( "Waiting for debug attach" ); - cout << "Waiting for debug attach" << endl; - } - - // Install Qt debug messages handler - qInstallMsgHandler( MessageOutput ); - - // Create Qt application instance; - // this should be done the very first! - SALOME_QApplication _qappl( argc, argv ); - - // Add application library path (to search style plugin etc...) - QString path = QDir::convertSeparators( SUIT_Tools::addSlash( QString( ::getenv( "GUI_ROOT_DIR" ) ) ) + QString( "bin/salome" ) ); - _qappl.addLibraryPath( path ); - - bool isGUI = isFound( "GUI", argc, argv ); - bool isSplash = isFound( "SPLASH", argc, argv ); - // Show splash screen (only if both the "GUI" and "SPLASH" parameters are set) - // Note, that user preferences are not taken into account for splash settings - - // it is a property of the application! - QtxSplash* splash = 0; - if ( isGUI && isSplash ) { - // ...create resource manager - SUIT_ResourceMgr resMgr( "SalomeApp", QString( "%1Config" ) ); - resMgr.setCurrentFormat( "xml" ); - resMgr.loadLanguage( false, "LightApp", "en" ); - // - splash = QtxSplash::splash( QPixmap() ); - splash->readSettings( &resMgr ); - if ( splash->pixmap().isNull() ) - splash->setPixmap( resMgr.loadPixmap( "LightApp", QObject::tr( "ABOUT_SPLASH" ) ) ); - if ( splash->pixmap().isNull() ) { - delete splash; - splash = 0; - } - else { - splash->setOption( "%A", QObject::tr( "APP_NAME" ) ); - splash->setOption( "%V", QObject::tr( "ABOUT_VERSION" ).arg( salomeVersion() ) ); - splash->setOption( "%L", QObject::tr( "ABOUT_LICENSE" ) ); - splash->setOption( "%C", QObject::tr( "ABOUT_COPYRIGHT" ) ); - splash->show(); - QApplication::instance()->processEvents(); - } - } - - - // Initialization - int result = -1; - - CORBA::ORB_var orb; - PortableServer::POA_var poa; - - SUIT_Session* aGUISession = 0; - SALOME_NamingService* _NS = 0; - GetInterfaceThread* guiThread = 0; - Session_ServerLauncher* myServerLauncher = 0; - - try { - // ...initialize Python (only once) - int _argc = 1; - char* _argv[] = {""}; - KERNEL_PYTHON::init_python( _argc,_argv ); - PyEval_RestoreThread( KERNEL_PYTHON::_gtstate ); - if ( !KERNEL_PYTHON::salome_shared_modules_module ) // import only once - KERNEL_PYTHON::salome_shared_modules_module = PyImport_ImportModule( "salome_shared_modules" ); - if ( !KERNEL_PYTHON::salome_shared_modules_module ) { - INFOS( "salome_shared_modules_module == NULL" ); - PyErr_Print(); - } - PyEval_ReleaseThread( KERNEL_PYTHON::_gtstate ); - - // ...create ORB, get RootPOA object, NamingService, etc. - ORB_INIT &init = *SINGLETON_::Instance(); - ASSERT( SINGLETON_::IsAlreadyExisting() ); - int orbArgc = 1; - orb = init( orbArgc, argv ); - - // ...install SALOME thread event handler - SALOME_Event::GetSessionThread(); - - CORBA::Object_var obj = orb->resolve_initial_references( "RootPOA" ); - poa = PortableServer::POA::_narrow( obj ); - - PortableServer::POAManager_var pman = poa->the_POAManager(); - pman->activate() ; - MESSAGE( "pman->activate()" ); - - _NS = new SALOME_NamingService( orb ); - - result = 0; - } - catch ( SALOME_Exception& e ) { - INFOS( "run(): SALOME::SALOME_Exception is caught: "<name(); - INFOS ( "run(): CORBA exception of the kind : "<setProgress( 0, sc.totalSteps() ); - // start check loop - while ( true ) { - int step = sc.currentStep(); - int total = sc.totalSteps(); - QString msg = sc.currentMessage(); - QString err = sc.error(); - if ( !err.isEmpty() ) { - QtxSplash::setError( err ); - QApplication::instance()->processEvents(); - result = -1; - break; - } - QtxSplash::setStatus( msg, step ); - QApplication::instance()->processEvents(); - if ( step >= total ) - break; - // ...block this thread until servers checking is finished - _SplashStarted.wait( &_SplashMutex ); - } - // ...unlock mutex 'cause it is no more needed - _SplashMutex.unlock(); - } - - // Finalize embedded servers launcher - // ...block this thread until launcher is finished - _ServerLaunch.wait( &_GUIMutex ); - // ...unlock mutex 'cause it is no more needed - _GUIMutex.unlock(); - } - - bool shutdown = false; - if ( !result ) { - // Launch GUI activator - if ( isGUI ) { - if ( splash ) - splash->setStatus( QApplication::translate( "", "Activating desktop..." ) ); - // ...retrieve Session interface reference - CORBA::Object_var obj = _NS->Resolve( "/Kernel/Session" ); - SALOME::Session_var session = SALOME::Session::_narrow( obj ) ; - ASSERT ( ! CORBA::is_nil( session ) ); - // ...create GUI launcher - MESSAGE( "Session activated, Launch IAPP..." ); - guiThread = new GetInterfaceThread( session ); - } - - // GUI activation - // Allow multiple activation/deactivation of GUI - while ( true ) { - MESSAGE( "waiting wakeAll()" ); - _SessionStarted.wait( &_SessionMutex ); // to be reseased by Launch server thread when ready: - // atomic operation lock - unlock on mutex - // unlock mutex: serverThread runs, calls _ServerLaunch->wakeAll() - // this thread wakes up, and lock mutex - - _SessionMutex.unlock(); - - // SUIT_Session creation - aGUISession = new SALOME_Session(); - - // Load SalomeApp dynamic library - MESSAGE( "creation SUIT_Application" ); - SUIT_Application* aGUIApp = aGUISession->startApplication( "SalomeApp", 0, 0 ); - if ( aGUIApp ) - { - // Set SALOME style to the application - SUIT_ResourceMgr resMgr( "SalomeApp", QString( "%1Config" ) ); - resMgr.setCurrentFormat( "xml" ); - resMgr.loadLanguage( false, "LightApp", "en" ); - if ( bool isSSUse = resMgr.booleanValue( "Style", "use_salome_style", true ) ) - { - Style_Salome* aStyle = new Style_Salome(); - aStyle->getModel()->initFromResource( aGUIApp->resourceMgr() ); - _qappl.setStyle( aStyle ); - } - - if ( !isFound( "noexcepthandler", argc, argv ) ) - _qappl.setHandler( aGUISession->handler() ); // after loading SalomeApp application - // aGUISession contains SalomeApp_ExceptionHandler - // Run GUI loop - MESSAGE( "run(): starting the main event loop" ); - - if ( splash ) - splash->finish( aGUIApp->desktop() ); - - result = _qappl.exec(); - - splash = 0; - - if ( result == SUIT_Session::NORMAL ) { // desktop is closed by user from GUI - shutdown = aGUISession->exitFlags(); - break; - } - } - - delete aGUISession; - aGUISession = 0; - - // Prepare _GUIMutex for a new GUI activation - _SessionMutex.lock(); - } - } - - // unlock Session mutex - _SessionMutex.unlock(); - - if ( shutdown ) - shutdownServers( _NS ); - - if ( myServerLauncher ) - myServerLauncher->KillAll(); // kill embedded servers - - delete aGUISession; - delete guiThread; - delete myServerLauncher; - delete _NS; - - PyGILState_STATE gstate = PyGILState_Ensure(); - Py_Finalize(); - - try { - orb->shutdown(0); - } - catch (...) { - ////////////////////////////////////////////////////////////// - // VSR: silently skip exception: - // CORBA.BAD_INV_ORDER.BAD_INV_ORDER_ORBHasShutdown - // exception is raised when orb->destroy() is called and - // cpp continer is launched in the embedded mode - ////////////////////////////////////////////////////////////// - // std::cerr << "Caught unexpected exception on destroy : ignored !!" << std::endl; - } - - if ( shutdown ) - killOmniNames(); - - return result; -} diff --git a/src/Session/SalomeApp_Engine_i.cxx b/src/Session/SalomeApp_Engine_i.cxx deleted file mode 100644 index 855cb8cf7..000000000 --- a/src/Session/SalomeApp_Engine_i.cxx +++ /dev/null @@ -1,176 +0,0 @@ -// SalomeApp_Engine_i : implementation of SalomeApp_Engine.idl -// -// 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 : SalomeApp_Engine_i.cxx -// Author : Alexander SLADKOV -// Module : SALOME -// $Header$ - -#include "SalomeApp_Engine_i.hxx" - -#include "SALOMEDS_Tool.hxx" - -#include - -using namespace std; - -SalomeApp_Engine_i* SalomeApp_Engine_i::myInstance = NULL; - -/*! - Constructor -*/ -SalomeApp_Engine_i::SalomeApp_Engine_i() -{ - myInstance = this; -} - -/*! - Destructor -*/ -SalomeApp_Engine_i::~SalomeApp_Engine_i() -{ -} - -SALOMEDS::TMPFile* SalomeApp_Engine_i::Save (SALOMEDS::SComponent_ptr theComponent, - const char* theURL, - bool isMultiFile) -{ - SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile; - - cout << "SalomeApp_Engine_i::Save() isMultiFile = " << isMultiFile << endl; - if (CORBA::is_nil(theComponent) || CORBA::is_nil(theComponent->GetStudy())) - return aStreamFile._retn(); - - const int studyId = theComponent->GetStudy()->StudyId(); - cout << "SalomeApp_Engine_i::Save() - studyId = " << studyId << endl; - - // Get a temporary directory to store a file - //std::string aTmpDir = isMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir(); - - if (myMap.count(studyId)) { - cout << "SalomeApp_Engine_i::Save() - myMap.count(studyId)" << endl; - MapOfListOfFiles mapOfListOfFiles = myMap[studyId]; - std::string componentName (theComponent->ComponentDataType()); - cout << "SalomeApp_Engine_i::Save() - componentName = " << componentName << endl; - ListOfFiles listOfFiles = mapOfListOfFiles[componentName]; - - // listOfFiles must contain temporary directory name in its first item - // and names of files (relatively the temporary directory) in the others - const int n = listOfFiles.size() - 1; - - if (n > 0) { // there are some files, containing persistent data of the component - std::string aTmpDir = listOfFiles[0]; - cout << "SalomeApp_Engine_i::Save() - aTmpDir = " << aTmpDir << endl; - - // Create a list to store names of created files - SALOMEDS::ListOfFileNames_var aSeq = new SALOMEDS::ListOfFileNames; - aSeq->length(n); - for (int i = 0; i < n; i++) - aSeq[i] = CORBA::string_dup(listOfFiles[i + 1].c_str()); - - // Convert a file to the byte stream - aStreamFile = SALOMEDS_Tool::PutFilesToStream(aTmpDir.c_str(), aSeq.in(), isMultiFile); - - // Remove the files and tmp directory, created by the component storage procedure - if (!isMultiFile) SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq.in(), true); - } - } - - return aStreamFile._retn(); -} - -CORBA::Boolean SalomeApp_Engine_i::Load (SALOMEDS::SComponent_ptr theComponent, - const SALOMEDS::TMPFile& theFile, - const char* theURL, - bool isMultiFile) -{ - cout << "SalomeApp_Engine_i::Load() isMultiFile = " << isMultiFile << endl; - if (CORBA::is_nil(theComponent) || CORBA::is_nil(theComponent->GetStudy())) - return false; - - const int studyId = theComponent->GetStudy()->StudyId(); - - // Create a temporary directory for the component's data files - std::string aTmpDir = isMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir(); - - // Convert the byte stream theStream to a files and place them in the tmp directory. - // The files and temporary directory must be deleted by the component loading procedure. - SALOMEDS::ListOfFileNames_var aSeq = - SALOMEDS_Tool::PutStreamToFiles(theFile, aTmpDir.c_str(), isMultiFile); - - // Store list of file names to be used by the component loading procedure - const int n = aSeq->length() + 1; - ListOfFiles listOfFiles (n); - listOfFiles[0] = aTmpDir; - for (int i = 1; i < n; i++) - listOfFiles[i] = std::string(aSeq[i - 1]); - - //MapOfListOfFiles mapOfListOfFiles; - //if (myMap.count(studyId)) - // mapOfListOfFiles = myMap[studyId]; - //std::string componentName (theComponent->ComponentDataType()); - //mapOfListOfFiles[componentName] = listOfFiles; - //myMap[studyId] = mapOfListOfFiles; - - SetListOfFiles(listOfFiles, studyId, theComponent->ComponentDataType()); - - return true; -} - -SalomeApp_Engine_i::ListOfFiles SalomeApp_Engine_i::GetListOfFiles (const int theStudyId, - const char* theComponentName) -{ - ListOfFiles aListOfFiles; - - if (myMap.count(theStudyId)) - { - MapOfListOfFiles mapOfListOfFiles = myMap[theStudyId]; - std::string componentName (theComponentName); - if (mapOfListOfFiles.count(componentName)) - aListOfFiles = mapOfListOfFiles[componentName]; - } - - return aListOfFiles; -} - -void SalomeApp_Engine_i::SetListOfFiles (const ListOfFiles theListOfFiles, - const int theStudyId, - const char* theComponentName) -{ - //if (!myMap.count(theStudyId)) { - // MapOfListOfFiles mapOfListOfFiles; - // myMap[theStudyId] = mapOfListOfFiles; - //} - - MapOfListOfFiles& mapOfListOfFiles = myMap[theStudyId]; - std::string componentName (theComponentName); - mapOfListOfFiles[componentName] = theListOfFiles; -} - -/*! - \return shared instance of engine -*/ -SalomeApp_Engine_i* SalomeApp_Engine_i::GetInstance() -{ - return myInstance; -} diff --git a/src/Session/SalomeApp_Engine_i.hxx b/src/Session/SalomeApp_Engine_i.hxx deleted file mode 100755 index abadbdd67..000000000 --- a/src/Session/SalomeApp_Engine_i.hxx +++ /dev/null @@ -1,95 +0,0 @@ -// SalomeApp_Engine_i : implementation of SalomeApp_Engine.idl -// -// 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 : SalomeApp_Engine_i.hxx -// Author : Alexander SLADKOV -// Module : SALOME -// $Header$ - -#ifndef _SALOMEAPP_ENGINE_I_HXX_ -#define _SALOMEAPP_ENGINE_I_HXX_ - -#include - -#include "SALOME_Component_i.hxx" - -#include -#include - -#include -#include CORBA_SERVER_HEADER(SalomeApp_Engine) - -class SESSION_EXPORT SalomeApp_Engine_i: public POA_SalomeApp::Engine, - public Engines_Component_i -{ -public: - SalomeApp_Engine_i(); - ~SalomeApp_Engine_i(); - - SALOMEDS::TMPFile* Save( SALOMEDS::SComponent_ptr theComponent, - const char* theURL, - bool isMultiFile ); - - CORBA::Boolean Load( SALOMEDS::SComponent_ptr theComponent, - const SALOMEDS::TMPFile& theFile, - const char* theURL, - bool isMultiFile ); - -public: - typedef std::vector ListOfFiles; - - ListOfFiles GetListOfFiles (const int theStudyId, - const char* theComponentName); - - void SetListOfFiles (const ListOfFiles theListOfFiles, - const int theStudyId, - const char* theComponentName); - - static SalomeApp_Engine_i* GetInstance(); - -public: - // methods from SALOMEDS::Driver without implementation. Must be redefined because - // there is no default implementation of SALOMEDS::Driver interface - SALOMEDS::TMPFile* SaveASCII( SALOMEDS::SComponent_ptr, const char*, bool ) {return 0;} - CORBA::Boolean LoadASCII( SALOMEDS::SComponent_ptr, const SALOMEDS::TMPFile&, const char*, bool ) {return 0;} - void Close( SALOMEDS::SComponent_ptr ) {} - char* ComponentDataType() {return 0;} - char* IORToLocalPersistentID( SALOMEDS::SObject_ptr, const char*, CORBA::Boolean, CORBA::Boolean ) {return 0;} - char* LocalPersistentIDToIOR( SALOMEDS::SObject_ptr, const char*, CORBA::Boolean, CORBA::Boolean ) {return 0;} - bool CanPublishInStudy( CORBA::Object_ptr ) {return 0;} - SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr, CORBA::Object_ptr, const char* ) throw (SALOME::SALOME_Exception) {return 0;} - CORBA::Boolean CanCopy( SALOMEDS::SObject_ptr ) {return 0;} - SALOMEDS::TMPFile* CopyFrom( SALOMEDS::SObject_ptr, CORBA::Long& ) {return 0;} - CORBA::Boolean CanPaste( const char*, CORBA::Long ) {return 0;} - SALOMEDS::SObject_ptr PasteInto( const SALOMEDS::TMPFile&, CORBA::Long, SALOMEDS::SObject_ptr ) {return 0;} - -private: - typedef std::map MapOfListOfFiles; - typedef std::map MapOfMapOfListOfFiles; - MapOfMapOfListOfFiles myMap; - - static SalomeApp_Engine_i* myInstance; -}; - -#endif - diff --git a/src/Session/Session.pro b/src/Session/Session.pro deleted file mode 100644 index 812c9c5ee..000000000 --- a/src/Session/Session.pro +++ /dev/null @@ -1,85 +0,0 @@ -#TEMPLATE = lib -#TARGET = SalomeSession -#DESTDIR = ../../lib -#MOC_DIR = ../../moc -#OBJECTS_DIR = ../../obj/$$TARGET - -# ================> - -TEMPLATE = -TARGET = SALOME_Session_Server -DESTDIR = ../../bin -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -# <================ - - -QT_MT_INCLUDES = $$(QTDIR)/include $$(QTDIR)/include/QtCore $$(QTDIR)/include/QtGui $$(QTDIR)/include/QtOpenGL $$(QTDIR)/include/QtXml - -PYTHON_INCLUDES = $$(PYTHONHOME)/include/python2.4 - -HDF5_INCLUDES = $$(HDF5HOME)/include - -BOOST_CPPFLAGS = $$(BOOSTDIR)/include - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -OMNIORBDIR = $$(OMNIORBDIR) -CORBA_INCLUDES = $${OMNIORBDIR}/include $${OMNIORBDIR}/include/omniORB4 $${OMNIORBDIR}/include/COS - -INCLUDEPATH += $${QT_MT_INCLUDES} $${PYTHON_INCLUDES} $${HDF5_INCLUDES} $${BOOST_CPPFLAGS} $${KERNEL_CXXFLAGS} $${CAS_CPPFLAGS} $${CORBA_INCLUDES} ../../salome_adm/unix $$(GUI_ROOT_DIR)/idl ../Qtx ../SUIT ../Event - -QT_MT_LIBS = -L$$(QTDIR)/lib -lQtCore -lQtXml -lQtGui -lQtOpenGL - -KERNEL_LDFLAGS = -L$$(KERNEL_ROOT_DIR)/lib/salome - -CAS_KERNEL = -L$${CASROOT}/Linux/lib -lTKernel - -LIBS += $${QT_MT_LIBS} $${KERNEL_LDFLAGS} -lSalomeNS -lSalomeLifeCycleCORBA -lOpUtil -lSALOMELocalTrace -lSalomeCatalog -lSalomeDSClient $${CAS_KERNEL} -L../../lib -lwith_loggerTraceCollector -lsuit -lEvent -L$$(GUI_ROOT_DIR)/idl -lSalomeIDLGUI - -# ================> - -OMNIORB_LIBS = -L$${OMNIORBDIR}/lib -lomniORB4 -lomniDynamic4 -lCOS4 -lCOSDynamic4 -lomnithread - -HDF5_LIBS = -L$$(HDF5HOME)/lib -lhdf5 - -INCLUDEPATH = $${INCLUDEPATH} -LIBS = $${LIBS} $${OMNIORB_LIBS} $${HDF5_LIBS} -lSalomeContainer -lSalomeResourcesManager -lTOOLSDS -lSalomeHDFPersist -lSalomeDSImpl -lSalomeGenericObj -lRegistry -lSalomeNotification -lSALOMEBasics -L$$(GUI_ROOT_DIR)/lib -lqtx -lSalomeSession - -# <================ - - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += SESSION_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS OMNIORB_VERSION=4 __x86__ __linux__ COMP_CORBA_DOUBLE COMP_CORBA_LONG - -HEADERS = Session_Session_i.hxx -HEADERS += Session_ServerLauncher.hxx -HEADERS += Session_ServerThread.hxx -HEADERS += Session_ServerCheck.hxx -HEADERS += SalomeApp_Engine_i.hxx - -SOURCES = Session_Session_i.cxx -SOURCES += Session_ServerThread.cxx -SOURCES += Session_ServerLauncher.cxx -SOURCES += Session_ServerCheck.cxx -SOURCES += SalomeApp_Engine_i.cxx - -# ================> - -SOURCES += SALOME_Session_Server.cxx - -# <================ - -#includes.files = $$HEADERS -#includes.path = ../../include - -#INSTALLS += includes - - diff --git a/src/Session/Session_ServerCheck.cxx b/src/Session/Session_ServerCheck.cxx deleted file mode 100644 index 27535f84f..000000000 --- a/src/Session/Session_ServerCheck.cxx +++ /dev/null @@ -1,627 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 : Session_ServerCheck.cxx -// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// - -#include "Session_ServerCheck.hxx" - -#include -#include CORBA_CLIENT_HEADER(SALOME_Session) -#include CORBA_CLIENT_HEADER(SALOME_Registry) -#include CORBA_CLIENT_HEADER(SALOMEDS) -#include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog) -#include CORBA_CLIENT_HEADER(SALOME_Component) - -#include "Utils_ORB_INIT.hxx" -#include "Utils_SINGLETON.hxx" -#include "SALOME_NamingService.hxx" -#include "OpUtil.hxx" -#include "utilities.h" - -#include -#include -#include -#include - -// -// Default settings -// - -/*! - \brief Default number of attemtps to check SALOME server. - - This value can be changed by setting the CSF_RepeatServerRequest - environment variable. For example, to set number of check attempts - for each server to 1000: - \code - setenv CSF_RepeatServerRequest 1000 - \endcode -*/ -const int __DEFAULT__ATTEMPTS__ = 300; - -/*! - \brief Default delay between attempts (in microseconds). - - This value can be changed by setting the CSF_DelayServerRequest - environment variable. For example, to set delay between attemtps - to check SALOME servers to 100000 (0.1 second): - \code - setenv CSF_DelayServerRequest 100000 - \endcode -*/ -const int __DEFAULT__DELAY__ = 50000; - -/*! - \classSession_ServerCheck::Locker - \brief Automatic locker/unlocker. - \internal -*/ - -class Session_ServerCheck::Locker -{ -public: - /*! - \brief Constructor. Tries to aquire lock. - */ - Locker( Session_ServerCheck* sc ) - : myChecker( sc ) - { - myChecker->myMutex->lock(); - myChecker->myMutex->unlock(); - } - /*! - \brief Destructor. Wakes the calling thread and goes sleeping. - */ - ~Locker() - { - myChecker->myWC->wakeAll(); - myChecker->usleep( myChecker->myDelay ); - } -private: - Session_ServerCheck* myChecker; -}; - -/*! - \class Session_ServerCheck - \brief The class Session_ServerCheck is used to check SALOME - servers availability. - - It runs in the secondrary thread. The number of attemts to check - each SALOME server and the time delay between checks can be specified - via setting the CSF_RepeatServerRequest and CSF_DelayServerRequest - environment variables. - - Total number of the check attempts can be retrieved via totalSteps() - method and current check step can be retrieved via currentStep() method. - - The method currentMessage() can be used to get the information message - about what SALOME server is currently checked. If any error occured (some - server could not be found) the thread loop is stopped and error status - is set. Error message can be retrieved with the error() method. -*/ - -/*! - \brief Constructor. - \param mutex a mutex used to serialize progress operations (splash) - \param wc a wait condition used in combination with \a mutex -*/ -Session_ServerCheck::Session_ServerCheck( QMutex* mutex, QWaitCondition* wc ) -: QThread(), - myMutex( mutex ), - myWC( wc ), - myCheckCppContainer( false ), - myCheckPyContainer( false ), - myCheckSVContainer( false ), - myAttempts( __DEFAULT__ATTEMPTS__ ), - myDelay ( __DEFAULT__DELAY__ ), - myCurrentStep( 0 ) -{ - char* cenv; - // try to get nb of attempts from environment variable - if ( ( cenv = getenv( "CSF_RepeatServerRequest" ) ) && atoi( cenv ) > 0 ) - myAttempts = atoi( cenv ); - // try to get delay between attempts from environment variable - if ( ( cenv = getenv( "CSF_DelayServerRequest" ) ) && atoi( cenv ) > 0 ) - myDelay = atoi( cenv ); - - // parse command line check if it is necessary to wait SALOME containers - QStringList args = QApplication::arguments(); - for ( int i = 1; i < args.count(); i++ ) { - myCheckCppContainer = myCheckCppContainer || args[i] == "CPP"; - myCheckPyContainer = myCheckPyContainer || args[i] == "PY"; - myCheckSVContainer = myCheckSVContainer || args[i] == "SUPERV"; - } - - // start thread - start(); -} - -/*! - \brief Destructor -*/ -Session_ServerCheck::~Session_ServerCheck() -{ - terminate(); - while( isRunning() ); -} - -/*! - \brief Get current information message. - \return current message -*/ -QString Session_ServerCheck::currentMessage() -{ - static QStringList messages; - if ( messages.isEmpty() ) { - messages << tr( "Waiting for naming service..." ); - messages << tr( "Waiting for registry server..." ); - messages << tr( "Waiting for study server..." ); - messages << tr( "Waiting for module catalogue server..." ); - messages << tr( "Waiting for session server..." ); - messages << tr( "Waiting for C++ container..." ); - messages << tr( "Waiting for Python container..." ); - messages << tr( "Waiting for Supervision container..." ); - } - QMutexLocker locker( &myDataMutex ); - QString msg; - int idx = myCurrentStep / myAttempts; - if ( idx >= 0 && idx < messages.count() ) - msg = messages[ idx ]; - return msg; -} - -/*! - \brief Get error message. - \return error message or null string of there was no any error -*/ -QString Session_ServerCheck::error() -{ - QMutexLocker locker( &myDataMutex ); - return myError; -} - -/*! - \brief Get current step. - \return current step -*/ -int Session_ServerCheck::currentStep() -{ - QMutexLocker locker( &myDataMutex ); - return myCurrentStep; -} - -/*! - \brief Get total number of check steps. - \return total number of steps -*/ -int Session_ServerCheck::totalSteps() -{ - QMutexLocker locker( &myDataMutex ); - int cnt = 5; // base servers - if ( myCheckCppContainer ) cnt++; // + C++ container - if ( myCheckPyContainer ) cnt++; // + Python container - if ( myCheckSVContainer ) cnt++; // + supervision container - return cnt * myAttempts; -} - -/*! - \brief Modify current step. - \param step new current step value -*/ -void Session_ServerCheck::setStep( const int step ) -{ - QMutexLocker locker( &myDataMutex ); - myCurrentStep = step; -} - -/*! - \brief Set error message. - \param msg error message -*/ -void Session_ServerCheck::setError( const QString& msg ) -{ - QMutexLocker locker( &myDataMutex ); - myError = msg; -} - -/*! - \brief Thread loop function. Performs SALOME servers check. -*/ -void Session_ServerCheck::run() -{ - // start check servers - int current = 0; - QString error; - int argc = QApplication::instance()->argc(); - char** argv = QApplication::instance()->argv(); - - // 1. Check naming service - for ( int i = 0; i < myAttempts; i++ ) { - Locker locker( this ); - - setStep( current * myAttempts + i ); - - try { - CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); - CORBA::Object_var obj = orb->resolve_initial_references( "NameService" ); - CosNaming::NamingContext_var _root_context = CosNaming::NamingContext::_narrow( obj ); - if ( !CORBA::is_nil( _root_context ) ) { - setStep( ++current * myAttempts ); - break; - } - } - catch( CORBA::COMM_FAILURE& ) { - MESSAGE( "CORBA::COMM_FAILURE: unable to contact the naming service" ); - } - catch( ... ) { - MESSAGE( "Unknown Exception: unable to contact the naming service" ); - } - - if ( i == myAttempts-1 ) { - setError( tr( "Unable to contact the naming service.\n" ) ); - return; - } - } - - // 2. Check registry server - for ( int i = 0; i < myAttempts ; i++ ) { - Locker locker( this ); - - setStep( current * myAttempts + i ); - - try { - CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); - SALOME_NamingService &NS = *SINGLETON_::Instance(); - ASSERT( SINGLETON_::IsAlreadyExisting() ); - NS.init_orb( orb ); - CORBA::Object_var obj = NS.Resolve( "/Registry" ); - Registry::Components_var registry = Registry::Components::_narrow( obj ); - if ( !CORBA::is_nil( registry ) ) { - MESSAGE( "/Registry is found" ); - registry->ping(); - MESSAGE( "Registry was activated" ); - setStep( ++current * myAttempts ); - break; - } - } - catch ( ServiceUnreachable& ) { - MESSAGE( "Caught exception: Naming Service unreachable." ); - error = "Naming service unreachable"; - } - catch ( CORBA::COMM_FAILURE& ) { - MESSAGE( "Caught CORBA::SystemException CommFailure." ); - error = "Caught CORBA::SystemException CommFailure."; - } - catch ( CORBA::SystemException& ) { - MESSAGE( "Caught CORBA::SystemException." ); - error = "Caught CORBA::SystemException."; - } - catch ( CORBA::Exception& ) { - MESSAGE( "Caught CORBA::Exception." ); - error = "Caught CORBA::Exception."; - } - catch (...) { - MESSAGE( "Caught unknown exception." ); - error = "Caught unknown exception."; - } - - if ( i == myAttempts-1 ) { - setError( tr( "Registry server is not found.\n%1" ).arg ( error ) ); - return; - } - } - - // 3. Check data server - for ( int i = 0; i < myAttempts ; i++ ) { - Locker locker( this ); - - setStep( current * myAttempts + i ); - - try { - CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); - SALOME_NamingService &NS = *SINGLETON_::Instance(); - ASSERT( SINGLETON_::IsAlreadyExisting() ); - NS.init_orb( orb ); - CORBA::Object_var obj = NS.Resolve( "/myStudyManager" ); - SALOMEDS::StudyManager_var studyManager = SALOMEDS::StudyManager::_narrow( obj ); - if ( !CORBA::is_nil( studyManager ) ) { - MESSAGE( "/myStudyManager is found" ); - studyManager->ping(); - MESSAGE( "StudyManager was activated" ); - setStep( ++current * myAttempts ); - break; - } - } - catch ( ServiceUnreachable& ) { - MESSAGE( "Caught exception: Naming Service unreachable." ); - error = "Naming service unreachable"; - } - catch ( CORBA::COMM_FAILURE& ) { - MESSAGE( "Caught CORBA::SystemException CommFailure." ); - error = "Caught CORBA::SystemException CommFailure."; - } - catch ( CORBA::SystemException& ) { - MESSAGE( "Caught CORBA::SystemException." ); - error = "Caught CORBA::SystemException."; - } - catch ( CORBA::Exception& ) { - MESSAGE( "Caught CORBA::Exception." ); - error = "Caught CORBA::Exception."; - } - catch (...) { - MESSAGE( "Caught unknown exception." ); - error = "Caught unknown exception."; - } - - if ( i == myAttempts-1 ) { - setError( tr( "Study server is not found.\n%1" ).arg ( error ) ); - return; - } - } - - // 4. Check module catalogue server - for ( int i = 0; i < myAttempts ; i++ ) { - Locker locker( this ); - - setStep( current * myAttempts + i ); - - try { - CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); - SALOME_NamingService &NS = *SINGLETON_::Instance(); - ASSERT( SINGLETON_::IsAlreadyExisting() ); - NS.init_orb( orb ); - CORBA::Object_var obj = NS.Resolve( "/Kernel/ModulCatalog" ); - SALOME_ModuleCatalog::ModuleCatalog_var catalog = SALOME_ModuleCatalog::ModuleCatalog::_narrow( obj ); - if ( !CORBA::is_nil( catalog ) ){ - MESSAGE( "/Kernel/ModulCatalog is found" ); - catalog->ping(); - MESSAGE( "ModuleCatalog was activated" ); - setStep( ++current * myAttempts ); - break; - } - } - catch ( ServiceUnreachable& ) { - MESSAGE( "Caught exception: Naming Service unreachable." ); - error = "Naming service unreachable"; - } - catch ( CORBA::COMM_FAILURE& ) { - MESSAGE( "Caught CORBA::SystemException CommFailure." ); - error = "Caught CORBA::SystemException CommFailure."; - } - catch ( CORBA::SystemException& ) { - MESSAGE( "Caught CORBA::SystemException." ); - error = "Caught CORBA::SystemException."; - } - catch ( CORBA::Exception& ) { - MESSAGE( "Caught CORBA::Exception." ); - error = "Caught CORBA::Exception."; - } - catch (...) { - MESSAGE( "Caught unknown exception." ); - error = "Caught unknown exception."; - } - - if ( i == myAttempts-1 ) { - setError( tr( "Module catalogue server is not found.\n%1" ).arg ( error ) ); - return; - } - } - - // 5. Check data server - for ( int i = 0; i < myAttempts ; i++ ) { - Locker locker( this ); - - setStep( current * myAttempts + i ); - - try { - CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); - SALOME_NamingService &NS = *SINGLETON_::Instance(); - ASSERT( SINGLETON_::IsAlreadyExisting() ); - NS.init_orb( orb ); - CORBA::Object_var obj = NS.Resolve( "/Kernel/Session" ); - SALOME::Session_var session = SALOME::Session::_narrow( obj ); - if ( !CORBA::is_nil( session ) ) { - MESSAGE( "/Kernel/Session is found" ); - session->ping(); - MESSAGE( "SALOME_Session was activated" ); - setStep( ++current * myAttempts ); - break; - } - } - catch ( ServiceUnreachable& ) { - MESSAGE( "Caught exception: Naming Service unreachable." ); - error = "Naming service unreachable"; - } - catch ( CORBA::COMM_FAILURE& ) { - MESSAGE( "Caught CORBA::SystemException CommFailure." ); - error = "Caught CORBA::SystemException CommFailure."; - } - catch ( CORBA::SystemException& ) { - MESSAGE( "Caught CORBA::SystemException." ); - error = "Caught CORBA::SystemException."; - } - catch ( CORBA::Exception& ) { - MESSAGE( "Caught CORBA::Exception." ); - error = "Caught CORBA::Exception."; - } - catch (...) { - MESSAGE( "Caught unknown exception." ); - error = "Caught unknown exception."; - } - - if ( i == myAttempts-1 ) { - setError( tr( "Session server is not found.\n%1" ).arg ( error ) ); - return; - } - } - - // 6. Check C++ container - if ( myCheckCppContainer ) { - for ( int i = 0; i < myAttempts ; i++ ) { - Locker locker( this ); - - setStep( current * myAttempts + i ); - - try { - CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); - SALOME_NamingService &NS = *SINGLETON_::Instance(); - ASSERT( SINGLETON_::IsAlreadyExisting() ); - NS.init_orb( orb ); - QString containerName = QString( "/Containers/%1/FactoryServer" ).arg( GetHostname().c_str() ); - CORBA::Object_var obj = NS.Resolve( containerName.toLatin1() ); - Engines::Container_var FScontainer = Engines::Container::_narrow( obj ); - if ( !CORBA::is_nil( FScontainer ) ) { - MESSAGE( containerName.toLatin1().constData() << " is found" ); - FScontainer->ping(); - MESSAGE( "FactoryServer container was activated" ); - setStep( ++current * myAttempts ); - break; - } - } - catch ( ServiceUnreachable& ) { - MESSAGE( "Caught exception: Naming Service unreachable." ); - error = "Naming service unreachable"; - } - catch ( CORBA::COMM_FAILURE& ) { - MESSAGE( "Caught CORBA::SystemException CommFailure." ); - error = "Caught CORBA::SystemException CommFailure."; - } - catch ( CORBA::SystemException& ) { - MESSAGE( "Caught CORBA::SystemException." ); - error = "Caught CORBA::SystemException."; - } - catch ( CORBA::Exception& ) { - MESSAGE( "Caught CORBA::Exception." ); - error = "Caught CORBA::Exception."; - } - catch (...) { - MESSAGE( "Caught unknown exception." ); - error = "Caught unknown exception."; - } - - if ( i == myAttempts-1 ) { - setError( tr( "C++ container is not found.\n%1" ).arg ( error ) ); - return; - } - } - } - - // 7. Check Python container - if ( myCheckPyContainer ) { - for ( int i = 0; i < myAttempts ; i++ ) { - Locker locker( this ); - - setStep( current * myAttempts + i ); - - try { - CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); - SALOME_NamingService &NS = *SINGLETON_::Instance(); - ASSERT( SINGLETON_::IsAlreadyExisting() ); - NS.init_orb( orb ); - QString containerName = QString( "/Containers/%1/FactoryServerPy" ).arg( GetHostname().c_str() ); - CORBA::Object_var obj = NS.Resolve( containerName.toLatin1() ); - Engines::Container_var FSPcontainer = Engines::Container::_narrow( obj ); - if ( !CORBA::is_nil( FSPcontainer ) ) { - MESSAGE( containerName.toLatin1().constData() << " is found" ); - FSPcontainer->ping(); - MESSAGE("FactoryServerPy container was activated"); - setStep( ++current * myAttempts ); - break; - } - } - catch ( ServiceUnreachable& ) { - MESSAGE( "Caught exception: Naming Service unreachable." ); - error = "Naming service unreachable"; - } - catch ( CORBA::COMM_FAILURE& ) { - MESSAGE( "Caught CORBA::SystemException CommFailure." ); - error = "Caught CORBA::SystemException CommFailure."; - } - catch ( CORBA::SystemException& ) { - MESSAGE( "Caught CORBA::SystemException." ); - error = "Caught CORBA::SystemException."; - } - catch ( CORBA::Exception& ) { - MESSAGE( "Caught CORBA::Exception." ); - error = "Caught CORBA::Exception."; - } - catch (...) { - MESSAGE( "Caught unknown exception." ); - error = "Caught unknown exception."; - } - - if ( i == myAttempts-1 ) { - setError( tr( "Python container is not found.\n%1" ).arg ( error ) ); - return; - } - } - } - - // 8. Check supervision container - if ( myCheckSVContainer ) { - for ( int i = 0; i < myAttempts ; i++ ) { - Locker locker( this ); - - setStep( current * myAttempts + i ); - - try { - CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); - SALOME_NamingService &NS = *SINGLETON_::Instance(); - ASSERT( SINGLETON_::IsAlreadyExisting() ); - NS.init_orb( orb ); - QString containerName = QString( "/Containers/%1/SuperVisionContainer" ).arg( GetHostname().c_str() ); - CORBA::Object_var obj = NS.Resolve( containerName.toLatin1() ); - Engines::Container_var SVcontainer = Engines::Container::_narrow( obj ); - if ( !CORBA::is_nil( SVcontainer ) ) { - MESSAGE( containerName.toLatin1().constData() << " is found" ); - SVcontainer->ping(); - MESSAGE("SuperVisionContainer container was activated"); - setStep( ++current * myAttempts ); - break; - } - } - catch ( ServiceUnreachable& ) { - MESSAGE( "Caught exception: Naming Service unreachable." ); - error = "Naming service unreachable"; - } - catch ( CORBA::COMM_FAILURE& ) { - MESSAGE( "Caught CORBA::SystemException CommFailure." ); - error = "Caught CORBA::SystemException CommFailure."; - } - catch ( CORBA::SystemException& ) { - MESSAGE( "Caught CORBA::SystemException." ); - error = "Caught CORBA::SystemException."; - } - catch ( CORBA::Exception& ) { - MESSAGE( "Caught CORBA::Exception." ); - error = "Caught CORBA::Exception."; - } - catch (...) { - MESSAGE( "Caught unknown exception." ); - error = "Caught unknown exception."; - } - - if ( i == myAttempts-1 ) { - setError( tr( "Supervision container is not found.\n%1" ).arg ( error ) ); - return; - } - } - } -} diff --git a/src/Session/Session_ServerCheck.hxx b/src/Session/Session_ServerCheck.hxx deleted file mode 100644 index 07c007113..000000000 --- a/src/Session/Session_ServerCheck.hxx +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms 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 : Session_ServerCheck.hxx -// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// - -#if !defined(SESSION_SERVERCHECK_HXX) -#define SESSION_SERVERCHECK_HXX - -#include "SALOME_Session.hxx" - -#include -#include - -class QWaitCondition; - -class SESSION_EXPORT Session_ServerCheck : public QThread -{ - class Locker; - -public: - Session_ServerCheck( QMutex*, QWaitCondition* ); - virtual ~Session_ServerCheck(); - - QString currentMessage(); - QString error(); - - int currentStep(); - int totalSteps(); - -protected: - virtual void run(); - -private: - void setStep( const int ); - void setError( const QString& msg ); - -private: - QMutex myDataMutex; //!< data mutex - QMutex* myMutex; //!< splash mutex - QWaitCondition* myWC; //!< splash wait condition - - bool myCheckCppContainer; //!< flag : check C++ container - bool myCheckPyContainer; //!< flag : check Python container - bool myCheckSVContainer; //!< flag : check supervision container - int myAttempts; //!< number of attemtps to get response from server - int myDelay; //!< delay between attempts in microseconds - int myCurrentStep; //!< current step - QString myMessage; //!< current information message - QString myError; //!< error message - - friend class Locker; -}; - -#endif // SESSION_SERVERCHECK_HXX diff --git a/src/Session/Session_ServerLauncher.cxx b/src/Session/Session_ServerLauncher.cxx deleted file mode 100755 index cee92e943..000000000 --- a/src/Session/Session_ServerLauncher.cxx +++ /dev/null @@ -1,236 +0,0 @@ -// SALOME Session : implementation of Session_ServerLauncher.cxx -// -// 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 : Session_ServerLauncher.xx -// Author : Paul RASCLE, EDF -// Module : SALOME -// $Header$ - -#include "Session_ServerLauncher.hxx" -#include "Session_ServerThread.hxx" - -#include "Utils_SALOME_Exception.hxx" -#include "utilities.h" - -#include -#include - -using namespace std; -/*! - default constructor not for use - */ -Session_ServerLauncher::Session_ServerLauncher() -{ - ASSERT(0); // must not be called -} - -/*! - constructor -*/ -Session_ServerLauncher::Session_ServerLauncher(int argc, - char ** argv, - CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - QMutex *GUIMutex, - QWaitCondition *ServerLaunch, - QMutex *SessionMutex, - QWaitCondition *SessionStarted) -{ - _argc = argc; - _argv = argv; - _orb = CORBA::ORB::_duplicate(orb); - _root_poa = PortableServer::POA::_duplicate(poa); - _GUIMutex = GUIMutex; - _ServerLaunch = ServerLaunch; - _SessionMutex = SessionMutex; - _SessionStarted = SessionStarted; - - // start thread - start(); -} - -/*! - destructor -*/ -Session_ServerLauncher::~Session_ServerLauncher() -{ -} - -/*! - Check args and activate servers -*/ -void Session_ServerLauncher::run() -{ - // wait until main thread is ready - _GUIMutex->lock(); // ... lock mutex (it is unlocked my calling thread - // wait condition's wait(mutex) - _GUIMutex->unlock(); // ... and unlock it 'cause it is not more needed - - // wake main thread - _ServerLaunch->wakeAll(); - - CheckArgs(); - ActivateAll(); - - // wait until main thread is ready - _GUIMutex->lock(); // ... lock mutex (it is unlocked my calling thread - // wait condition's wait(mutex) - _GUIMutex->unlock(); // ... and unlock it 'cause it is not more needed - - // wake main thread - _ServerLaunch->wakeAll(); - - // run ORB - //_orb->run(); // No need to call orb->run() : it waits on a lock. Qt is already waiting in the mainloop. -} - -/*! - controls and dispatchs arguments given with command -*/ -void Session_ServerLauncher::CheckArgs() -{ - int argState = 0; - ServArg aServArg(0,0,0); - _argCopy.reserve(_argc); - for (int iarg=0; iarg <_argc; iarg++) - { - SCRUTE(iarg); - SCRUTE(_argv[iarg]); - _argCopy.push_back(_argv[iarg]); - switch (argState) - { - case 0: // looking for "--with" - { - if (strcmp(_argv[iarg],"--with")==0) - argState = 1; - break; - } - case 1: // looking for server type - { - for (int i=0; i::iterator itServ; - for (itServ = _argServToLaunch.begin(); itServ !=_argServToLaunch.end(); itServ++) - { - int argc = 2 + (*itServ)._lastArg - (*itServ)._firstArg; - char** argv = new char*[argc+1]; - argv[argc]=0; // for Engines_Container_i constructor... - int servType = (*itServ)._servType; - argv[0]=strdup(Session_ServerThread::_serverTypes[servType]); - if (argc>1) - { - for (int i=0; iInit(); - free( argv[0] ); - delete[] argv; - } - - // Always launch Session Server - MESSAGE("*** activating [ SESSION ] "); - - int argc=1; - char** argv = new char*[argc]; - argv[0] = "Session"; - Session_SessionThread* aServerThread - = new Session_SessionThread(argc, argv, _orb,_root_poa,_SessionMutex,_SessionStarted); - _serverThreads.push_front(aServerThread); - aServerThread->Init(); - delete[] argv; -} - -/*! - Destruction des classes serveur dans l'ordre inverse de creation -*/ -void Session_ServerLauncher::KillAll() -{ - MESSAGE("Session_ServerLauncher::KillAll()"); - list::reverse_iterator itServ; - for (itServ = _serverThreads.rbegin(); itServ !=_serverThreads.rend(); itServ++) - { - delete (*itServ); - } -} diff --git a/src/Session/Session_ServerLauncher.hxx b/src/Session/Session_ServerLauncher.hxx deleted file mode 100755 index 6f0fede88..000000000 --- a/src/Session/Session_ServerLauncher.hxx +++ /dev/null @@ -1,95 +0,0 @@ -// SALOME Session : implementation of Session_ServerLauncher.hxx -// -// 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 : Session_ServerLauncher.hxx -// Author : Paul RASCLE, EDF -// Module : SALOME -// $Header$ - -#ifndef _SESSION_SERVERLAUNCHER_HXX_ -#define _SESSION_SERVERLAUNCHER_HXX_ - -#include - -#include -#include -#include -#include -#include - -using namespace std; - -class SESSION_EXPORT ServArg - { - public: - int _servType; - int _firstArg; - int _lastArg; - inline ServArg(int servType=0, int firstArg=0, int lastArg=0); -}; - -inline ServArg::ServArg(int servType, int firstArg, int lastArg): - _servType(servType),_firstArg(firstArg),_lastArg(lastArg) -{} - -class Session_ServerThread; - -class QMutex; -class QWaitCondition; - -class SESSION_EXPORT Session_ServerLauncher: public QThread -{ -public: - Session_ServerLauncher(); - Session_ServerLauncher(int argc, - char ** argv, - CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - QMutex *GUIMutex, - QWaitCondition *ServerLaunch, - QMutex *SessionMutex, - QWaitCondition *SessionStarted); - virtual ~Session_ServerLauncher(); - void run(); - void KillAll(); - -protected: - void CheckArgs(); - void ActivateAll(); - -private: - int _argc; - char ** _argv; - CORBA::ORB_var _orb; - PortableServer::POA_var _root_poa; - QMutex* _GUIMutex; - QWaitCondition* _ServerLaunch; - QMutex* _SessionMutex; - QWaitCondition* _SessionStarted; - list _argServToLaunch; - vector _argCopy; - list _serverThreads; -}; - -#endif - diff --git a/src/Session/Session_ServerThread.cxx b/src/Session/Session_ServerThread.cxx deleted file mode 100755 index 45bba979c..000000000 --- a/src/Session/Session_ServerThread.cxx +++ /dev/null @@ -1,472 +0,0 @@ -// SALOME Session : implementation of Session_ServerThread.cxx -// -// 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 : Session_ServerThread.cxx -// Author : Paul RASCLE, EDF -// Module : SALOME -// $Header$ - -// #include -// #include CORBA_SERVER_HEADER(SALOME_Session) -// #include CORBA_SERVER_HEADER(SALOMEDS) - -#include "Session_ServerThread.hxx" - -#include -#include -#include -#include -#include -#include - -#include "Session_Session_i.hxx" -#include "SalomeApp_Engine_i.hxx" - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -using namespace std; - -const int Session_ServerThread::NB_SRV_TYP = 7; -const char* Session_ServerThread::_serverTypes[NB_SRV_TYP] = {"Container", - "ModuleCatalog", - "Registry", - "SALOMEDS", - "Session", - "SalomeAppEngine", - "ContainerManager"}; - -/*! - default constructor not for use -*/ -Session_ServerThread::Session_ServerThread() -{ - ASSERT(0); // must not be called -} - -/*! - constructor -*/ -Session_ServerThread::Session_ServerThread(int argc, - char ** argv, - CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa) -{ - //MESSAGE("Session_ServerThread Constructor " << argv[0]); - _argc = argc; - _argv = new char*[ _argc + 1 ]; - _argv[_argc] = 0; - for (int i = 0; i < _argc; i++ ) - _argv[i] = strdup( argv[i] ); - - _orb = CORBA::ORB::_duplicate(orb); - _root_poa = PortableServer::POA::_duplicate(poa); - _servType =-1; - _NS = new SALOME_NamingService(_orb); // one instance per server to limit - // multi thread coherence problems -} - -/*! - destructor -*/ -Session_ServerThread::~Session_ServerThread() -{ - //MESSAGE("~Session_ServerThread "<< _argv[0]); - delete _NS; - for (int i = 0; i <_argc ; i++ ) - free( _argv[i] ); - delete[] _argv; -} - -/*! - run the thread : activate one servant, the servant type is given by - argument _argv[0] -*/ -void Session_ServerThread::Init() -{ - MESSAGE("Session_ServerThread::Init "<< _argv[0]); - - int i; - for (i=0; i<_argc; i++) SCRUTE(_argv[i]); - - for (i=0; iactivate_object (Catalogue_i); - Catalogue_i->_remove_ref(); - - CORBA::Object_var myCata = Catalogue_i->_this(); - _NS->Register(myCata ,"/Kernel/ModulCatalog"); - } - catch(CORBA::SystemException&) { - INFOS( "Caught CORBA::SystemException." ); - } - catch(CORBA::Exception&) { - INFOS( "Caught CORBA::Exception." ); - } - catch(omniORB::fatalException& fe) { - INFOS( "Caught omniORB::fatalException:" ); - INFOS( " file: " << fe.file() ); - INFOS( " line: " << fe.line() ); - INFOS( " mesg: " << fe.errmsg() ); - } - catch(...) { - INFOS( "Caught unknown exception." ); - } -} - -void Session_ServerThread::ActivateSALOMEDS(int argc, - char ** argv) -{ - try { - MESSAGE("SALOMEDS thread started"); - // We allocate the objects on the heap. Since these are reference - // counted objects, they will be deleted by the POA when they are no - // longer needed. - - ClientFactory::createStudyManager(_orb,_root_poa); - } - catch(CORBA::SystemException&) { - INFOS( "Caught CORBA::SystemException." ); - } - catch(CORBA::Exception&) { - INFOS( "Caught CORBA::Exception." ); - } - catch(omniORB::fatalException& fe) { - INFOS( "Caught omniORB::fatalException:" ); - INFOS( " file: " << fe.file() ); - INFOS( " line: " << fe.line() ); - INFOS( " mesg: " << fe.errmsg() ); - } - catch(...) { - INFOS( "Caught unknown exception." ); - } -} - -void Session_ServerThread::ActivateRegistry(int argc, - char ** argv) -{ - MESSAGE("Registry thread started"); - SCRUTE(argc); - if ( argc<3 ) { - INFOS("you must provide the Salome session name when you call SALOME_Registry_Server"); - throw CommException("you must provide the Salome session name when you call SALOME_Registry_Server"); - } - const char *ptrSessionName=0; - - int k=0 ; - for ( k=1 ; k0); - const char *registryName = "Registry"; - Registry::Components_var varComponents; - try { - RegistryService *ptrRegistry = SINGLETON_::Instance(); - ptrRegistry->SessionName( ptrSessionName ); - ptrRegistry->SetOrb(_orb); - varComponents = ptrRegistry->_this(); - // The RegistryService must not already exist. - - try { - CORBA::Object_var pipo = _NS->Resolve( registryName ); - if (CORBA::is_nil(pipo) ) throw ServiceUnreachable(); - INFOS("RegistryService servant already existing" ); - ASSERT(0); - } - catch( const ServiceUnreachable &/*ex*/ ) { - } - catch( const CORBA::Exception &/*exx*/ ) { - } - string absoluteName = string("/") + registryName; - _NS->Register( varComponents , absoluteName.c_str() ); - MESSAGE("On attend les requetes des clients"); - } - catch( const SALOME_Exception &ex ) { - INFOS( "Communication Error : " << ex.what() ); - ASSERT(0); - } -} - -void Session_ServerThread::ActivateContainerManager(int argc, - char ** argv) -{ - try { - PortableServer::POA_var root_poa=PortableServer::POA::_the_root_poa(); - cout << "Activate SalomeLauncher ......!!!! " << endl; - SALOME_Launcher * myContainer = new SALOME_Launcher(_orb,root_poa); - } - catch(CORBA::SystemException&) { - INFOS("Caught CORBA::SystemException."); - } - catch(PortableServer::POA::WrongPolicy&) { - INFOS("Caught CORBA::WrongPolicyException."); - } - catch(PortableServer::POA::ServantAlreadyActive&) { - INFOS("Caught CORBA::ServantAlreadyActiveException"); - } - catch(CORBA::Exception&) { - INFOS("Caught CORBA::Exception."); - } - catch(...) { - INFOS("Caught unknown exception."); - } -} - -void Session_ServerThread::ActivateContainer(int argc, - char ** argv) -{ - try { - MESSAGE("Container thread started"); - - // get or create the child POA - - PortableServer::POA_var factory_poa; - try { - factory_poa = _root_poa->find_POA("factory_poa",0); - // 0 = no activation (already done if exists) - } - catch (PortableServer::POA::AdapterNonExistent&) { - MESSAGE("factory_poa does not exists, create..."); - // define policy objects - PortableServer::ImplicitActivationPolicy_var implicitActivation = - _root_poa->create_implicit_activation_policy(PortableServer::NO_IMPLICIT_ACTIVATION); - // default = NO_IMPLICIT_ACTIVATION - PortableServer::ThreadPolicy_var threadPolicy = - _root_poa->create_thread_policy(PortableServer::ORB_CTRL_MODEL); - // default = ORB_CTRL_MODEL, other choice SINGLE_THREAD_MODEL - - // create policy list - CORBA::PolicyList policyList; - policyList.length(2); - policyList[0] = PortableServer::ImplicitActivationPolicy:: - _duplicate(implicitActivation); - policyList[1] = PortableServer::ThreadPolicy:: - _duplicate(threadPolicy); - - PortableServer::POAManager_var nil_mgr - = PortableServer::POAManager::_nil(); - factory_poa = _root_poa->create_POA("factory_poa", - nil_mgr, - policyList); - //with nil_mgr instead of pman, - //a new POA manager is created with the new POA - - // destroy policy objects - implicitActivation->destroy(); - threadPolicy->destroy(); - - // obtain the factory poa manager - PortableServer::POAManager_var pmanfac = factory_poa->the_POAManager(); - pmanfac->activate(); - MESSAGE("pmanfac->activate()"); - } - - char *containerName = ""; - if (argc >1) { - containerName = argv[1]; - } - - Engines_Container_i * myContainer - = new Engines_Container_i(_orb, _root_poa, containerName , argc , argv , true , false); - } - catch(CORBA::SystemException&) { - INFOS("Caught CORBA::SystemException."); - } - catch(PortableServer::POA::WrongPolicy&) { - INFOS("Caught CORBA::WrongPolicyException."); - } - catch(PortableServer::POA::ServantAlreadyActive&) { - INFOS("Caught CORBA::ServantAlreadyActiveException"); - } - catch(CORBA::Exception&) { - INFOS("Caught CORBA::Exception."); - } - catch(...) { - INFOS("Caught unknown exception."); - } -} - -void Session_ServerThread::ActivateEngine(int /*argc*/, char ** /*argv*/) -{ - try { - MESSAGE("SalomeApp_Engine thread started"); - SalomeApp_Engine_i* anEngine = new SalomeApp_Engine_i(); - PortableServer::ObjectId_var id =_root_poa->activate_object( anEngine ); - MESSAGE("poa->activate_object( SalomeApp_Engine )"); - - CORBA::Object_var obj = anEngine->_this(); - anEngine->_remove_ref(); - _NS->Register( obj ,"/SalomeAppEngine"); - } - catch (CORBA::SystemException&) { - INFOS("Caught CORBA::SystemException."); - } - catch (CORBA::Exception&) { - INFOS("Caught CORBA::Exception."); - } - catch (...) { - INFOS("Caught unknown exception."); - } -} - -void Session_ServerThread::ActivateSession(int argc, - char ** argv) -{ - MESSAGE("Session_ServerThread::ActivateSession() not implemented!"); -} - -/*! - constructor -*/ -Session_SessionThread::Session_SessionThread(int argc, - char** argv, - CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - QMutex* GUIMutex, - QWaitCondition* GUILauncher) -: Session_ServerThread(argc, argv, orb, poa), - _GUIMutex( GUIMutex ), - _GUILauncher( GUILauncher ) -{ -} - -/*! - destructor -*/ -Session_SessionThread::~Session_SessionThread() -{ -} - -void Session_SessionThread::ActivateSession(int argc, - char ** argv) -{ - try { - MESSAGE("Session thread started"); - SALOME_Session_i * mySALOME_Session - = new SALOME_Session_i(argc, argv, _orb, _root_poa, _GUIMutex, _GUILauncher) ; - PortableServer::ObjectId_var mySALOME_Sessionid - = _root_poa->activate_object(mySALOME_Session); - MESSAGE("poa->activate_object(mySALOME_Session)"); - - CORBA::Object_var obj = mySALOME_Session->_this(); - CORBA::String_var sior(_orb->object_to_string(obj)); - mySALOME_Session->_remove_ref(); - - mySALOME_Session->NSregister(); - } - catch (CORBA::SystemException&) { - INFOS("Caught CORBA::SystemException."); - } - catch (CORBA::Exception&) { - INFOS("Caught CORBA::Exception."); - } - catch (...) { - INFOS("Caught unknown exception."); - } -} diff --git a/src/Session/Session_ServerThread.hxx b/src/Session/Session_ServerThread.hxx deleted file mode 100755 index 146183da7..000000000 --- a/src/Session/Session_ServerThread.hxx +++ /dev/null @@ -1,96 +0,0 @@ -// SALOME Session : implementation of Session_ServerThread.hxx -// -// 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 : Session_ServerThread.hxx -// Author : Paul RASCLE, EDF -// Module : SALOME -// $Header$ - -#ifndef _SESSION_SERVERTHREAD_HXX_ -#define _SESSION_SERVERTHREAD_HXX_ - -#include - -#include -#include - -using namespace std; - -void WaitForServerReadiness(string serverName); - -class SALOME_NamingService; - -class SESSION_EXPORT Session_ServerThread -{ -public: - static const int NB_SRV_TYP; - static const char* _serverTypes[]; - - Session_ServerThread(); - Session_ServerThread(int argc, - char ** argv, - CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa); - virtual ~Session_ServerThread(); - void Init(); -protected: - void ActivateModuleCatalog ( int argc, char ** argv ); - void ActivateSALOMEDS ( int argc, char ** argv ); - void ActivateRegistry ( int argc, char ** argv ); - void ActivateContainer ( int argc, char ** argv ); - virtual void ActivateSession ( int argc, char ** argv ); - void ActivateEngine ( int argc, char ** argv ); - void ActivateContainerManager( int argc, char ** argv ); -protected: - int _argc; - char ** _argv; - int _servType; - CORBA::ORB_var _orb; - PortableServer::POA_var _root_poa; - SALOME_NamingService * _NS; -}; - -class QMutex; -class QWaitCondition; - -class SESSION_EXPORT Session_SessionThread : public Session_ServerThread -{ -public: - Session_SessionThread() {} - Session_SessionThread(int argc, - char** argv, - CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - QMutex* GUIMutex, - QWaitCondition* GUILauncher); - virtual ~Session_SessionThread(); - -protected: - virtual void ActivateSession ( int argc, char ** argv ); -private: - QMutex* _GUIMutex; - QWaitCondition* _GUILauncher; -}; - -#endif - diff --git a/src/Session/Session_Session_i.cxx b/src/Session/Session_Session_i.cxx deleted file mode 100755 index 089c223f0..000000000 --- a/src/Session/Session_Session_i.cxx +++ /dev/null @@ -1,267 +0,0 @@ -// SALOME Session : implementation of Session.idl -// -// 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 : SALOME_Session_i.cxx -// Author : Paul RASCLE, EDF -// Module : SALOME -// $Header$ - -#include "utilities.h" - -#include "Session_Session_i.hxx" - -#include "SALOME_NamingService.hxx" -#include "SALOME_Event.h" - -#include "SUIT_Session.h" -#include "SUIT_Desktop.h" -#include "SUIT_Study.h" - -#include -#include - -// Open CASCADE Includes -#include -#include - -#ifdef WNT -# include -#endif - - -using namespace std; - -/*! - constructor -*/ -SALOME_Session_i::SALOME_Session_i(int argc, - char ** argv, - CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - QMutex* GUIMutex, - QWaitCondition* GUILauncher) -{ - _argc = argc ; - _argv = argv ; - _isGUI = FALSE ; - _runningStudies= 0 ; - _orb = CORBA::ORB::_duplicate(orb) ; - _poa = PortableServer::POA::_duplicate(poa) ; - _GUIMutex = GUIMutex; - _GUILauncher = GUILauncher; - _NS = new SALOME_NamingService(_orb); - //MESSAGE("constructor end"); -} - -/*! - returns Visu component -*/ -Engines::Component_ptr SALOME_Session_i::GetComponent(const char* theLibraryName) -{ - typedef Engines::Component_ptr TGetImpl(CORBA::ORB_ptr, - PortableServer::POA_ptr, - SALOME_NamingService*,QMutex*); - OSD_SharedLibrary aSharedLibrary(const_cast(theLibraryName)); - if(aSharedLibrary.DlOpen(OSD_RTLD_LAZY)) - if(OSD_Function anOSDFun = aSharedLibrary.DlSymb("GetImpl")) - return ((TGetImpl (*)) anOSDFun)(_orb,_poa,_NS,_GUIMutex); - return Engines::Component::_nil(); -} - -/*! - destructor -*/ -SALOME_Session_i::~SALOME_Session_i() -{ - delete _NS; - //MESSAGE("destructor end"); -} - -/*! - tries to find the Corba Naming Service and to register the session, - gives naming service interface to _IAPPThread -*/ -void SALOME_Session_i::NSregister() -{ - CORBA::Object_var obref=_this(); - SALOME::Session_var pSession = SALOME::Session::_narrow(obref); - try - { - _NS->Register(pSession, "/Kernel/Session"); - } - catch (ServiceUnreachable&) - { - INFOS("Caught exception: Naming Service Unreachable"); - exit(1) ; - } - catch (...) - { - INFOS("Caught unknown exception from Naming Service"); - } - //MESSAGE("Session registered in Naming Service"); -} - -/*! - Launches the GUI if there is none. - The Corba method is oneway (corba client does'nt wait for GUI completion) -*/ -void SALOME_Session_i::GetInterface() -{ - _GUIMutex->lock(); - _GUIMutex->unlock(); - if ( !SUIT_Session::session() ) - { - _GUILauncher->wakeAll(); - MESSAGE("SALOME_Session_i::GetInterface() called, starting GUI...") - } -} - -/*! - Kills the session if there are no active studies nore GUI -*/ -class CloseEvent : public SALOME_Event -{ -public: - virtual void Execute() { - SUIT_Session* session = SUIT_Session::session(); - session->closeSession( SUIT_Session::DONT_SAVE ); - //if ( SUIT_Application::getDesktop() ) - // QAD_Application::getDesktop()->closeDesktop( true ); - } -}; - -/*! - Processes event to close session -*/ -void SALOME_Session_i::StopSession() -{ - ProcessVoidEvent( new CloseEvent() ); -} - -/*! - Send a SALOME::StatSession structure (see idl) to the client - (number of running studies and presence of GUI) -*/ -/*class QtLock -{ -public: - QtLock() { if ( qApp ) qApp->lock(); } - ~QtLock() { if ( qApp ) qApp->unlock(); } -};*/ - - -SALOME::StatSession SALOME_Session_i::GetStatSession() -{ - // update Session state - _GUIMutex->lock(); - - _runningStudies = 0; - { - //QtLock lock; - _isGUI = SUIT_Session::session(); - if ( _isGUI && SUIT_Session::session()->activeApplication() ) - _runningStudies = SUIT_Session::session()->activeApplication()->getNbStudies(); - } - - _GUIMutex->unlock(); - - // getting stat info - SALOME::StatSession_var myStats = new SALOME::StatSession ; - if (_runningStudies) - myStats->state = SALOME::running ; - else - myStats->state = SALOME::asleep ; - myStats->runningStudies = _runningStudies ; - myStats->activeGUI = _isGUI ; - return myStats._retn() ; -} - -CORBA::Long SALOME_Session_i::GetActiveStudyId() -{ - long aStudyId=-1; - if ( SUIT_Session::session() && SUIT_Session::session()->activeApplication() ) { - if ( SUIT_Session::session()->activeApplication()->activeStudy() ) // mkr : IPAL12128 - aStudyId = SUIT_Session::session()->activeApplication()->activeStudy()->id(); - } - return aStudyId; -} - -CORBA::Long SALOME_Session_i::getPID() { - return (CORBA::Long) -#ifndef WNT - getpid(); -#else - _getpid(); -#endif -} - -bool SALOME_Session_i::restoreVisualState(CORBA::Long theSavePoint) -{ - class TEvent: public SALOME_Event { - int _savePoint; - public: - TEvent(int savePoint) { _savePoint = savePoint; } - virtual void Execute() { - SUIT_Study* study = SUIT_Session::session()->activeApplication()->activeStudy(); - if ( study ) { - study->restoreState(_savePoint); - } - } - }; - - if(SUIT_Session::session() && SUIT_Session::session()->activeApplication() ) { - SUIT_Study* study = SUIT_Session::session()->activeApplication()->activeStudy(); - if(!study) SUIT_Session::session()->activeApplication()->createEmptyStudy(); - ProcessVoidEvent( new TEvent(theSavePoint) ); - return true; - } - - return false; -} - -void SALOME_Session_i::emitMessage(const char* theMessage) -{ - class TEvent: public SALOME_Event { - public: - TEvent(const char * msg) { - _msg = msg; - } - virtual void Execute() { - SUIT_Session::session()->activeApplication()->desktop()->emitMessage(_msg); - } - private: - const char* _msg; - }; - if ( SUIT_Session::session() ) { - if ( SUIT_Session::session()->activeApplication() ) { - if ( SUIT_Session::session()->activeApplication()->desktop() ) { - ProcessVoidEvent( new TEvent(theMessage) ); - } - } - } -} - -void SALOME_Session_i::emitMessageOneWay(const char* theMessage) -{ - emitMessage(theMessage); -} diff --git a/src/Session/Session_Session_i.hxx b/src/Session/Session_Session_i.hxx deleted file mode 100755 index fc7a1e56e..000000000 --- a/src/Session/Session_Session_i.hxx +++ /dev/null @@ -1,97 +0,0 @@ -// SALOME Session : implementation of Session.idl -// -// 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 : Session_Session_i.hxx -// Author : Paul RASCLE, EDF -// Module : SALOME -// $Header$ - -#ifndef _SESSION_SESSION_I_HXX_ -#define _SESSION_SESSION_I_HXX_ - -#include - -#include -#include CORBA_SERVER_HEADER(SALOME_Component) -#include CORBA_SERVER_HEADER(SALOME_Session) -class SALOME_NamingService; - -class QMutex; -class QWaitCondition; - -class SESSION_EXPORT SALOME_Session_i: public virtual POA_SALOME::Session, - public virtual PortableServer::ServantBase -{ -public: - SALOME_Session_i(int argc, - char ** argv, - CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - QMutex* GUIMutex, - QWaitCondition* GUILauncher); - ~SALOME_Session_i(); - - //! Launch Graphical User Interface - void GetInterface(); - - //! Return VISU component - Engines::Component_ptr GetComponent(const char* theLibraryName); - - //! Stop the Session (must be idle): kill servant & server - void StopSession(); - - //! Get session state - SALOME::StatSession GetStatSession(); - - //! Register the servant to Naming Service - void NSregister(); - - CORBA::Long GetActiveStudyId(); - - void ping(){}; - CORBA::Long getPID(); - - //! Restors a visual state of the study at theSavePoint - bool restoreVisualState(CORBA::Long theSavePoint); - - //! Emit a qt signal from the session GUI desktop window. - void emitMessage(const char* theMessage); - void emitMessageOneWay(const char* theMessage); - -protected: - - //! Naming service interface - SALOME_NamingService *_NS; - - int _argc ; - char **_argv; - CORBA::Boolean _isGUI ; - QMutex* _GUIMutex ; - QWaitCondition* _GUILauncher; - int _runningStudies ; - CORBA::ORB_var _orb; - PortableServer::POA_var _poa; -}; - -#endif - diff --git a/src/TOOLSGUI/Makefile.am b/src/TOOLSGUI/Makefile.am deleted file mode 100755 index d972dfa13..000000000 --- a/src/TOOLSGUI/Makefile.am +++ /dev/null @@ -1,60 +0,0 @@ -# SALOME TOOLSGUI : implementation of desktop "Tools" optioins -# -# 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.in -# Author : Marc Tajchman (CEA) -# Module : SALOME -# $Header$ - -include $(top_srcdir)/adm_local/unix/make_common_starter.am - -lib_LTLIBRARIES = libToolsGUI.la - -salomeinclude_HEADERS= \ - ToolsGUI.h \ - ToolsGUI_RegWidget.h \ - ToolsGUI_CatalogGeneratorDlg.h - -dist_libToolsGUI_la_SOURCES= \ - ToolsGUI_CatalogGeneratorDlg.cxx \ - ToolsGUI_RegWidget.cxx \ - ToolsGUI.cxx - -EXTRA_DIST+= - -MOC_FILES= \ - ToolsGUI_CatalogGeneratorDlg_moc.cxx \ - ToolsGUI_RegWidget_moc.cxx - -nodist_libToolsGUI_la_SOURCES= $(MOC_FILES) - -# .po files to transform in .qm -nodist_salomeres_DATA= \ - ToolsGUI_msg_en.qm - -libToolsGUI_la_CPPFLAGS = $(QT_INCLUDES) $(CAS_CPPFLAGS) $(BOOST_CPPFLAGS) \ - @KERNEL_CXXFLAGS@ @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ \ - -I$(top_builddir)/salome_adm/unix -I$(top_builddir)/idl \ - -I$(srcdir)/../Qtx -I$(srcdir)/../SUIT -libToolsGUI_la_LDFLAGS = $(QT_MT_LIBS) ../SUIT/libsuit.la $(CAS_KERNEL) $(KERNEL_LDFLAGS) \ - -lSalomeNS -lOpUtil $(top_builddir)/idl/libSalomeIDLGUI.so diff --git a/src/TOOLSGUI/TOOLSGUI.pro b/src/TOOLSGUI/TOOLSGUI.pro deleted file mode 100644 index 361da544d..000000000 --- a/src/TOOLSGUI/TOOLSGUI.pro +++ /dev/null @@ -1,48 +0,0 @@ -TEMPLATE = lib -TARGET = ToolsGUI -DESTDIR = ../../lib -MOC_DIR = ../../moc -OBJECTS_DIR = ../../obj/$$TARGET - -CASROOT = $$(CASROOT) -CAS_CPPFLAGS = $${CASROOT}/inc - -BOOST_CPPFLAGS = $$(BOOSTDIR)/include - -KERNEL_CXXFLAGS = $$(KERNEL_ROOT_DIR)/include/salome - -CORBA_INCLUDES = $$(OMNIORBDIR)/include $$(OMNIORBDIR)/include/omniORB4 $$(OMNIORBDIR)/include/COS - -CAS_KERNEL = -L$${CASROOT}/Linux/lib -lTKernel - -KERNEL_LDFLAGS = -L$$(KERNEL_ROOT_DIR)/lib/salome - -INCLUDEPATH += $${CAS_CPPFLAGS} $${BOOST_CPPFLAGS} $${KERNEL_CXXFLAGS} $${CORBA_INCLUDES} ../../salome_adm/unix ../../idl ../Qtx ../SUIT -LIBS += -L../../lib -lsuit -lSalomeNS -lOpUtil $${CAS_KERNEL} $${KERNEL_LDFLAGS} - -CONFIG -= debug release debug_and_release -CONFIG += qt thread debug dll shared - -win32:DEFINES += WIN32 -DEFINES += OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS - -HEADERS = ToolsGUI.h -HEADERS += ToolsGUI_RegWidget.h -HEADERS += ToolsGUI_CatalogGeneratorDlg.h - -SOURCES = ToolsGUI_CatalogGeneratorDlg.cxx -SOURCES += ToolsGUI_RegWidget.cxx -SOURCES += ToolsGUI.cxx - -TRANSLATIONS = resources/ToolsGUI_icons.ts \ - resources/ToolsGUI_msg_en.ts - -ICONS = resources/*.png - -includes.files = $$HEADERS -includes.path = ../../include - -resources.files = $$ICONS resources/*.qm -resources.path = ../../resources - -INSTALLS += includes resources diff --git a/src/TOOLSGUI/ToolsGUI.cxx b/src/TOOLSGUI/ToolsGUI.cxx deleted file mode 100755 index 290eb6603..000000000 --- a/src/TOOLSGUI/ToolsGUI.cxx +++ /dev/null @@ -1,87 +0,0 @@ -// SALOME TOOLSGUI : implementation of desktop "Tools" optioins -// -// 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 : ToolsGUI.cxx -// Author : Nicolas REJNERI -// - -#include "ToolsGUI.h" - -/*! - \class ToolsGUI - \brief Utility class. -*/ - -/*! - \brief Get visibility value of the "AttributeGraphic" attribute. - \param theStudy study - \param theObj object - \param theId sub-object identifier - \return \c true if an object (sub-object) is visible -*/ -bool ToolsGUI::GetVisibility( _PTR(Study) theStudy, - _PTR(SObject) theObj, - void* theId ) -{ - _PTR(GenericAttribute) anAttr; - if ( theObj && theObj->FindAttribute( anAttr, "AttributeGraphic" ) ) - { - _PTR(AttributeGraphic) aGraphic (anAttr); - return aGraphic->GetVisibility( (unsigned long)theId ); - } - - return false; -} - -/*! - \brief Set visibility value of the "AttributeGraphic" attribute. - \param theStudy study - \param theObj object - \return theValue new visibility value - \param theId sub-object identifier -*/ -bool ToolsGUI::SetVisibility( _PTR(Study) theStudy, - const char* theEntry, - const bool theValue, - void* theId ) -{ - _PTR(SObject) anObj ( theStudy->FindObjectID( theEntry ) ); - - if ( anObj ) - { - _PTR(GenericAttribute) aGAttr; - if ( anObj->FindAttribute( aGAttr, "AttributeGraphic" ) ) - { - _PTR(AttributeGraphic) anAttr ( aGAttr ); - anAttr->SetVisibility( (unsigned long)theId, theValue ); - } - else if ( theValue ) - { - _PTR(StudyBuilder) aBuilder (theStudy->NewBuilder()); - _PTR(AttributeGraphic) anAttr (aBuilder->FindOrCreateAttribute(anObj, "AttributeGraphic")); - anAttr->SetVisibility( (unsigned long)theId, theValue ); - } - return true; - } - - return false; -} - diff --git a/src/TOOLSGUI/ToolsGUI.h b/src/TOOLSGUI/ToolsGUI.h deleted file mode 100755 index 522c195d2..000000000 --- a/src/TOOLSGUI/ToolsGUI.h +++ /dev/null @@ -1,54 +0,0 @@ -// SALOME TOOLSGUI : implementation of desktop "Tools" optioins -// -// 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 : ToolsGUI.h -// Author : Nicolas REJNERI -// - -#ifndef TOOLSGUI_H -#define TOOLSGUI_H - -#ifdef WIN32 -# ifdef TOOLSGUI_EXPORTS -# define TOOLSGUI_EXPORT __declspec(dllexport) -# else -# define TOOLSGUI_EXPORT __declspec(dllimport) -# endif -#else // WIN32 -# define TOOLSGUI_EXPORT -#endif // WIN32 - -#include "utilities.h" -#include "SALOMEDSClient.hxx" - -class TOOLSGUI_EXPORT ToolsGUI -{ -public : - static bool GetVisibility( _PTR(Study) theStudy, - _PTR(SObject) theObj, - void* theId ); - static bool SetVisibility( _PTR(Study) theStudy, - const char* theEntry, - const bool theValue, - void* theId ); -}; - -#endif // TOOLSGUI_H diff --git a/src/TOOLSGUI/ToolsGUI_CatalogGeneratorDlg.cxx b/src/TOOLSGUI/ToolsGUI_CatalogGeneratorDlg.cxx deleted file mode 100755 index cbc92ed5b..000000000 --- a/src/TOOLSGUI/ToolsGUI_CatalogGeneratorDlg.cxx +++ /dev/null @@ -1,433 +0,0 @@ -// SALOME TOOLSGUI : implementation of desktop "Tools" optioins -// -// 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 : ToolsGUI_CatalogGeneratorDlg.cxx -// Author : Nicolas REJNERI -// - -#include "ToolsGUI_CatalogGeneratorDlg.h" - -#include "SUIT_Application.h" -#include "SUIT_MessageBox.h" -//#include "SUIT_Tools.h" -#include "SUIT_Session.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "utilities.h" - -using namespace std; - -#define SPACING_SIZE 6 -#define MARGIN_SIZE 11 -#define MIN_EDIT_SIZE 250 - -/*! - \class ToolsGUI_CatalogGeneratorDlg - \brief A dialog box which allows converting the IDL files - to the XML description. -*/ - -/*! - \brief Constructor. - \param parent parent widget -*/ -ToolsGUI_CatalogGeneratorDlg::ToolsGUI_CatalogGeneratorDlg( QWidget* parent ) -: QDialog( parent ) -{ - setModal( true ); - - setWindowTitle( tr( "TOOLS_CATALOG_GENERATOR" ) ); - setSizeGripEnabled( true ); - - QGridLayout* aTopLayout = new QGridLayout(this); - aTopLayout->setMargin( MARGIN_SIZE ); - aTopLayout->setSpacing( SPACING_SIZE ); - - QGroupBox* filesGrp = new QGroupBox( tr( "TOOLS_FILES") , this ); - filesGrp->setObjectName( "filesGrp" ); - QGridLayout* filesGrpLayout = new QGridLayout( filesGrp ); - filesGrpLayout->setAlignment( Qt::AlignTop ); - filesGrpLayout->setSpacing( SPACING_SIZE ); - filesGrpLayout->setMargin( MARGIN_SIZE ); - - myIdlEdit = new QLineEdit( filesGrp ); - myIdlEdit->setObjectName( "myIdlEdit" ); - myIdlEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myIdlEdit->setMinimumSize( MIN_EDIT_SIZE, 0 ); - myXmlEdit = new QLineEdit( filesGrp ); - myXmlEdit->setObjectName( "myXmlEdit" ); - myXmlEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myXmlEdit->setMinimumSize( MIN_EDIT_SIZE, 0 ); - - myBrowseIdlBtn = new QPushButton( tr( "TOOLS_BUT_BROWSE" ), filesGrp ); - myBrowseIdlBtn->setObjectName( "myBrowseIdlBtn" ); - myBrowseXmlBtn = new QPushButton( tr( "TOOLS_BUT_BROWSE" ), filesGrp ); - myBrowseXmlBtn->setObjectName( "myBrowseXmlBtn" ); -// QFontMetrics fm(myBrowseIdlBtn->font()); -// myBrowseIdlBtn->setFixedWidth(fm.width(myBrowseIdlBtn->text()) + 10); -// myBrowseXmlBtn->setFixedWidth(fm.width(myBrowseXmlBtn->text()) + 10); - - filesGrpLayout->addWidget( new QLabel( tr( "TOOLS_IDL_FILE" ), filesGrp ), 0, 0); - filesGrpLayout->addWidget( myIdlEdit, 0, 1 ); - filesGrpLayout->addWidget( myBrowseIdlBtn, 0, 2 ); - filesGrpLayout->addWidget( new QLabel( tr( "TOOLS_XML_FILE" ), filesGrp ), 1, 0); - filesGrpLayout->addWidget( myXmlEdit, 1, 1 ); - filesGrpLayout->addWidget( myBrowseXmlBtn, 1, 2 ); - - QGroupBox* supplGrp = new QGroupBox(tr( "TOOLS_SUPPLEMENT" ) , this ); - supplGrp->setObjectName( "SupplGrp" ); - QGridLayout* supplGrpLayout = new QGridLayout( supplGrp ); - supplGrpLayout->setAlignment( Qt::AlignTop ); - supplGrpLayout->setSpacing( SPACING_SIZE ); - supplGrpLayout->setMargin( MARGIN_SIZE ); - - QSize myMinimumSize(int(MIN_EDIT_SIZE*0.3), 0); - - myAuthorEdit = new QLineEdit( supplGrp ); - myAuthorEdit->setObjectName( "myAuthorEdit" ); - myAuthorEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myAuthorEdit->setMinimumSize( myMinimumSize ); - - OSD_Process aProcess; - myAuthorEdit->setText(aProcess.UserName().ToCString()); - - myVersionEdit = new QLineEdit( supplGrp ); - myVersionEdit->setObjectName( "myVersion" ); - myVersionEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myVersionEdit->setMinimumSize( myMinimumSize ); - QStringList aList = tr( "INF_VERSION" ).split(QRegExp("\\s+"), QString::SkipEmptyParts); - myVersionEdit->setText(aList.last()); - - myPngEdit = new QLineEdit( supplGrp ); - myPngEdit->setObjectName( "myCompIcon" ); - myPngEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myPngEdit->setMinimumSize( MIN_EDIT_SIZE, 0 ); - - myBrowsePngBtn = new QPushButton( tr( "TOOLS_BUT_BROWSE" ), supplGrp ); - myBrowsePngBtn->setObjectName( "myBrowsePngBtn" ); - - myCompName = new QLineEdit( supplGrp ); - myCompName->setObjectName( "myCompName" ); - myCompName->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myCompName->setMinimumSize( myMinimumSize ); - - myCompUserName = new QLineEdit( supplGrp ); - myCompUserName->setObjectName( "myCompUserName" ); - myCompUserName->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myCompUserName->setMinimumSize( (int)(MIN_EDIT_SIZE*0.3), 0 ); - - myCompType = new QLineEdit( supplGrp ); - myCompType->setObjectName( "myCompType" ); - myCompType->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myCompType->setMinimumSize( myMinimumSize ); - myCompType->setText("OTHER"); - - myCompMultiStd = new QLineEdit( supplGrp ); - myCompMultiStd->setObjectName( "myCompMultiStd" ); - myCompMultiStd->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - myCompMultiStd->setMinimumSize( myMinimumSize ); - myCompMultiStd->setText("1"); - QIntValidator *ivalidator = new QIntValidator(myVersionEdit); - myCompMultiStd->setValidator(ivalidator); - - supplGrpLayout->addWidget( new QLabel( tr( "TOOLS_AUTHOR" ), supplGrp ), 0, 0); - supplGrpLayout->addWidget( myAuthorEdit, 0, 1 ); - supplGrpLayout->addWidget( new QLabel( tr( "TOOLS_COMP_NAME" ), supplGrp ), 0, 2); - supplGrpLayout->addWidget(myCompName,0,3); - supplGrpLayout->addWidget( new QLabel( tr( "TOOLS_COMP_USERNAME" ), supplGrp ), 0, 4); - supplGrpLayout->addWidget(myCompUserName,0,5); - supplGrpLayout->addWidget( new QLabel( tr( "TOOLS_VERSION" ), supplGrp ), 1, 0); - supplGrpLayout->addWidget( myVersionEdit, 1, 1); - supplGrpLayout->addWidget( new QLabel( tr( "TOOLS_COMP_MULTISTD" ), supplGrp ), 1, 2); - supplGrpLayout->addWidget(myCompMultiStd,1,3); - supplGrpLayout->addWidget( new QLabel( tr( "TOOLS_COMP_TYPE" ), supplGrp ), 1, 4); - supplGrpLayout->addWidget(myCompType,1,5); - supplGrpLayout->addWidget( new QLabel( tr( "TOOLS_PNG_FILE" ), supplGrp ), 2, 0); - supplGrpLayout->addWidget( myPngEdit, 2,1,1,4 ); - supplGrpLayout->addWidget( myBrowsePngBtn, 2, 5 ); - - QHBoxLayout* aBtnLayout = new QHBoxLayout; - aBtnLayout->setSpacing( SPACING_SIZE ); - aBtnLayout->setMargin( 0 ); - - myApplyBtn = new QPushButton( tr( "TOOLS_BUT_APPLY" ), this ); - myApplyBtn->setObjectName( "myApplyBtn" ); - myApplyBtn->setAutoDefault( true ); - myApplyBtn->setDefault( true ); - myCloseBtn = new QPushButton( tr( "TOOLS_BUT_CLOSE" ), this ); - myCloseBtn->setObjectName( "myCloseBtn" ); - myCloseBtn->setAutoDefault( true ); - - aBtnLayout->addWidget( myApplyBtn ); - aBtnLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ) ); - aBtnLayout->addWidget( myCloseBtn ); - - aTopLayout->addWidget( filesGrp, 0, 0 ); - aTopLayout->addWidget( supplGrp, 1, 0 ); - aTopLayout->addLayout( aBtnLayout, 2, 0 ); - - /* signals and slots connections */ - connect( myApplyBtn, SIGNAL( clicked() ), this, SLOT( onApply() ) ); - connect( myCloseBtn, SIGNAL( clicked() ), this, SLOT( reject() ) ); - connect( myBrowseIdlBtn, SIGNAL( clicked() ), this, SLOT( onBrowseBtnClicked() ) ); - connect( myBrowseXmlBtn, SIGNAL( clicked() ), this, SLOT( onBrowseBtnClicked() ) ); - connect( myBrowsePngBtn, SIGNAL( clicked() ), this, SLOT( onBrowseBtnClicked() ) ); - connect( myIdlEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( updateButtonState() ) ); - connect( myXmlEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( updateButtonState() ) ); - - updateButtonState(); -} - -/*! - \brief Destructor -*/ -ToolsGUI_CatalogGeneratorDlg::~ToolsGUI_CatalogGeneratorDlg() -{ -} - -/*! - \brief Get IDL file name - \return IDL file name entered by the user -*/ -QString ToolsGUI_CatalogGeneratorDlg::getIdlFile() -{ - return myIdlEdit->text().trimmed(); -} - -/*! - \brief Get XML file name - \return XML file name entered by the user -*/ -QString ToolsGUI_CatalogGeneratorDlg::getXmlFile() -{ - return myXmlEdit->text().trimmed(); -} - -/*! - \brief Get module icon file name - \return icon file name entered by the user -*/ -QString ToolsGUI_CatalogGeneratorDlg::getPngFile() -{ - return myPngEdit->text().trimmed(); -} - -/*! - \brief Get author name - \return author name entered by the user -*/ -QString ToolsGUI_CatalogGeneratorDlg::getAuthor() -{ - return myAuthorEdit->text().trimmed(); -} - -/*! - \brief Get version number - \return version number entered by the user -*/ -QString ToolsGUI_CatalogGeneratorDlg::getVersion() -{ - return myVersionEdit->text().trimmed(); -} - -/*! - \brief Get component name - \return name of the component entered by the user -*/ -QString ToolsGUI_CatalogGeneratorDlg::getCompName() -{ - return myCompName->text().trimmed(); -} - -/*! - \brief Get component title (user name) - \return title of the component entered by the user -*/ -QString ToolsGUI_CatalogGeneratorDlg::getCompUserName() -{ - return myCompUserName->text().trimmed(); -} - -/*! - \brief Get multistudy flag - \return multistudy flag for the component entered by the user -*/ -QString ToolsGUI_CatalogGeneratorDlg::getCompMultiStd() -{ - return myCompMultiStd->text().trimmed(); -} - -/*! - \brief Get component type - \return type of the component entered by the user -*/ -QString ToolsGUI_CatalogGeneratorDlg::getCompType() -{ - return myCompType->text().trimmed(); -} - -/*! - \brief Get IDL path of the modules - \return IDL path of modules -*/ -QString ToolsGUI_CatalogGeneratorDlg::getIdlPath() -{ - cout << "QAD_Desktop::getCatalogue() is not implemented!!"; - if ( true ) - return QString( "" ); -/* - SALOME_ModuleCatalog::ModuleCatalog_var aCatalog = - SALOME_ModuleCatalog::ModuleCatalog::_narrow( QAD_Application::getDesktop()->getCatalogue() ); - - SALOME_ModuleCatalog::ListOfIAPP_Affich_var list_composants = - aCatalog->GetComponentIconeList(); - - QString IDLpath = ""; - - for (unsigned int ind = 0; ind < list_composants->length();ind++) { - QString modulename = CORBA::string_dup(list_composants[ind].modulename) ; - - QCString dir; - if (dir = getenv( modulename + "_ROOT_DIR")) { - IDLpath = IDLpath + "-I" + SUIT_Tools::addSlash( SUIT_Tools::addSlash(dir) + - SUIT_Tools::addSlash("idl") + - SUIT_Tools::addSlash("salome")) + " "; - } - } - - // MESSAGE ( " IDLpath = " << IDLpath); - - return IDLpath; -*/ -} - -/*! - \brief Called when user presses "Browse" button -*/ -void ToolsGUI_CatalogGeneratorDlg::onBrowseBtnClicked() -{ - QPushButton* send = (QPushButton*)sender(); - - SUIT_Application* app = SUIT_Session::session()->activeApplication(); - - if ( send == myBrowseIdlBtn ) { - QString file = app->getFileName( true, myIdlEdit->text().trimmed(), tr("TOOLS_MEN_IMPORT_IDL"), tr("TOOLS_MEN_IMPORT"), 0 ); - if ( !file.isEmpty() ) { - myIdlEdit->setText(file); - } - } - else if ( send == myBrowseXmlBtn ) { - QString file = app->getFileName( false, myXmlEdit->text().trimmed(), tr("TOOLS_MEN_EXPORT_XML"), tr("TOOLS_MEN_EXPORT"), 0 ); - if ( !file.isEmpty() ) { - myXmlEdit->setText(file); - } - } else if ( send == myBrowsePngBtn ) { - QString file = app->getFileName( true, myPngEdit->text().trimmed(), tr("TOOLS_MEN_IMPORT_PNG"), tr("TOOLS_MEN_IMPORT"), 0 ); - if ( !file.isEmpty() ) { - myPngEdit->setText(file); - - } - } - updateButtonState(); -} - -/*! - \brief Update button's state. -*/ -void ToolsGUI_CatalogGeneratorDlg::updateButtonState() -{ - myApplyBtn->setEnabled( !myIdlEdit->text().trimmed().isEmpty() && - !myXmlEdit->text().trimmed().isEmpty() ); -} - -/*! - \brief Called when user presses button - - Performs IDL to XML file conversion using \c runIDLparser SALOME utility. -*/ -void ToolsGUI_CatalogGeneratorDlg::onApply() -{ - QString IDLpath = getIdlPath(); - QString XmlFile = getXmlFile(); - QString IdlFile = getIdlFile(); - QString Author = getAuthor(); - QString Version = getVersion(); - QString PngFile = getPngFile(); - QString CompName = getCompName(); //gets component name - QString CompUserName = getCompUserName(); //gets component username - QString CompType = getCompType(); //gets component type - QString CompMultiStd = getCompMultiStd(); - - if ( !XmlFile.isEmpty() && !IdlFile.isEmpty() ) { - if ( !QFile::exists( IdlFile ) ) { - SUIT_MessageBox::critical( this, - tr("TOOLS_ERR_ERROR"), - tr("TOOLS_ERR_FILE_NOT_EXIST").arg(IdlFile) ); - } - else { - QString command = ""; - if ( getenv("KERNEL_ROOT_DIR") ) - command = QString( getenv( "KERNEL_ROOT_DIR" ) ) + "/bin/salome/runIDLparser -K " + IDLpath + " -Wbcatalog=" + XmlFile; - else { - SUIT_MessageBox::critical( this, - tr("TOOLS_ERR_ERROR"), - tr("KERNEL_ROOT_DIR variable is not defined") ); - } - - if (!Author.isEmpty()) command += ",author=" + Author; - if (!Version.isEmpty()) command += ",version=" + Version; - if (!PngFile.isEmpty()) { - OSD_Path aPath((Standard_CString)PngFile.toLatin1().constData()); - TCollection_AsciiString aFile = aPath.Name() + aPath.Extension(); - command += QString(",icon=") + QString(aFile.ToCString()); - } - if (!CompName.isEmpty()) command += ",name=" + CompName; - if (!CompUserName.isEmpty()) command += ",username=" + CompUserName; - if (!CompType.isEmpty()) command += ",type=" + CompType; - if (!CompMultiStd.isEmpty()) command += ",multistudy=" + CompMultiStd; - command += " " + IdlFile; - MESSAGE( "shell command is : " << command.toLatin1().constData() ); - int res; - res = system( ( char* )( command.toLatin1().constData() ) ); - if ( res == -1 ) { - MESSAGE( "work failed (system command result = " << res ); - } else if (res == 217) { - MESSAGE( "shell exec failed (system command result = " << res ); - } - } - } -} diff --git a/src/TOOLSGUI/ToolsGUI_CatalogGeneratorDlg.h b/src/TOOLSGUI/ToolsGUI_CatalogGeneratorDlg.h deleted file mode 100755 index 0626abd9f..000000000 --- a/src/TOOLSGUI/ToolsGUI_CatalogGeneratorDlg.h +++ /dev/null @@ -1,78 +0,0 @@ -// SALOME TOOLSGUI : implementation of desktop "Tools" optioins -// -// 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 : ToolsGUI_CatalogGeneratorDlg.h -// Author : Nicolas REJNERI -// - -#ifndef TOOLSGUI_CATALOGGENERATORDLG_H -#define TOOLSGUI_CATALOGGENERATORDLG_H - -#include "ToolsGUI.h" - -#include - -class QLineEdit; -class QPushButton; - -class TOOLSGUI_EXPORT ToolsGUI_CatalogGeneratorDlg : public QDialog -{ - Q_OBJECT - -public: - ToolsGUI_CatalogGeneratorDlg( QWidget* parent = 0 ); - ~ToolsGUI_CatalogGeneratorDlg(); - - QString getIdlPath(); - QString getIdlFile(); - QString getXmlFile(); - QString getPngFile(); - QString getAuthor(); - QString getVersion(); - QString getCompName(); - QString getCompUserName(); - QString getCompType(); - QString getCompMultiStd(); - -protected slots: - void onBrowseBtnClicked(); - void updateButtonState(); - void onApply(); - -private: - QLineEdit* myIdlEdit; - QLineEdit* myXmlEdit; - QLineEdit* myPngEdit; - QLineEdit* myVersionEdit; - QLineEdit* myAuthorEdit; - QLineEdit* myCompName; - QLineEdit* myCompUserName; - QLineEdit* myCompType; - QLineEdit* myCompMultiStd; - QPushButton* myBrowseIdlBtn; - QPushButton* myBrowseXmlBtn; - QPushButton* myBrowsePngBtn; - - QPushButton* myApplyBtn; - QPushButton* myCloseBtn; -}; - -#endif // TOOLSGUI_CATALOGGENERATORDLG_H diff --git a/src/TOOLSGUI/ToolsGUI_RegWidget.cxx b/src/TOOLSGUI/ToolsGUI_RegWidget.cxx deleted file mode 100755 index e6262363b..000000000 --- a/src/TOOLSGUI/ToolsGUI_RegWidget.cxx +++ /dev/null @@ -1,949 +0,0 @@ -// SALOME RegistryDisplay : GUI for Registry server implementation -// -// 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 : ToolsGUI_RegWidget.cxx -// Author : Pascale NOYRET, EDF -// - -# include "ToolsGUI_RegWidget.h" - -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include -# include - -# include -# include -# include -# include - -# include -# include - -# include - -typedef int PIXELS; - -#define MARGIN_SIZE 11 -#define SPACING_SIZE 6 -#define MIN_SPIN_WIDTH 100 - -#define BOLD( text ) ( QString( "" ) + QString( text ) + QString( "" ) ) - -static const char* const time_data[] = { -"16 16 6 1", -". c None", -"b c None", -"# c #000000", -"a c #4c4c4c", -"d c #878787", -"c c #ffffff", -".....#####ab....", -"...##cc#dc##ab..", -"..#ccc###dcc#ab.", -".#ccccc#dcccc#a.", -".#ccccc#dcccc#ab", -"#cccccc#dccccc#a", -"#cccccc#dccc#c#a", -"#c##ccc########a", -"#ccddcccdddd#d#a", -"#cccccccccccdc#a", -".#ccccccccccc#aa", -".#ccccc#ccccc#a.", -"..#cccc#dccc#aa.", -"...##cccdc##aa..", -".....#####aaa...", -"......aaaaa....."}; - -static const char* const close_data[] = { -"16 16 6 1", -"d c None", -". c None", -"# c #000000", -"a c #4c4c4c", -"c c #5b5b5b", -"b c #ffffff", -".....#####a.....", -"...##bbbbb##a...", -"..#bbbbbbbbb#a..", -".#b#cbbbbbb#d#a.", -".#bc#cbbbb#cb#a.", -"#bbbc#cbb#cbbb#a", -"#bbbbc#c#cbbbb#a", -"#bbbbbc#cbbbbb#a", -"#bbbbc#c#cbbbb#a", -"#bbb#ccbb##bbb#a", -".#b#c#bbbbc#b#aa", -".#bc#bbbbbb#c#a.", -"..#bbbbbbbbb#aa.", -"...##bbbbb##aa..", -".....#####aaa...", -"......aaaaa....."}; - -static const char* const refresh_data[] = { -"16 16 5 1", -". c None", -"# c #000000", -"a c #4c4c4c", -"c c #878787", -"b c #ffffff", -".....#####a.....", -"...##bb#bb##a...", -"..#bbbbc#bbb#a..", -".#bbbb####cbb#a.", -".#bbb#cc#cbbb#a.", -"#bbb#cb#cbbbbb#a", -"#bb#cbbbbbb#bb#a", -"#bb#cbbbbbb#cb#a", -"#bb#cbbbbbb#cb#a", -"#bbbbbb#bb#cbb#a", -".#bbbb#cb#cbb#aa", -".#bbb####cbbb#a.", -"..#bbb#cbbbb#aa.", -"...##bb#cb##aa..", -".....#####aaa...", -"......aaaaa....."}; - -/*! - \brief Create components list. - \internal - \param orb CORBA ORB reference - \return list of registered components -*/ -static Registry::Components_var MakeRegistry( CORBA::ORB_var& orb ) -{ - - const char *registryName="Registry" ; - - SALOME_NamingService &naming = *SINGLETON_::Instance() ; - naming.init_orb( orb ) ; - - // Recuperation de la reference de l'objet - CORBA::Object_var object = 0 ; - try - { - SCRUTE(registryName) ; - object = naming.Resolve( registryName ) ; - if(CORBA::is_nil(object)) throw CommException( "unable to find the RegistryService" ) ; - } - catch( const ServiceUnreachable& ex ) - { - MESSAGE( ex.what() ) - exit( EXIT_FAILURE ) ; - } - catch( const CORBA::Exception& ) - { - exit( EXIT_FAILURE ) ; - } - - // Specialisation de l'objet generique - - return Registry::Components::_narrow( object ) ; -} - -/*! - \class ToolsGUI_RegWidget::InfoWindow - \brief Information window. - \internal -*/ - -class ToolsGUI_RegWidget::InfoWindow : public QMainWindow -{ -public: - InfoWindow( QWidget* parent ); - - void setText( const QString& text ); - -protected: - void keyPressEvent( QKeyEvent * e ); - -private: - QTextEdit* myTextView; -}; - -/*! - \brief Constructor. - \internal - \param parent parent widget -*/ -ToolsGUI_RegWidget::InfoWindow::InfoWindow( QWidget* parent ) -: QMainWindow( parent ) -{ - setAttribute( Qt::WA_DeleteOnClose ); - - myTextView = new QTextEdit( this ); - myTextView->setReadOnly( true ); - setCentralWidget( myTextView ); - setMinimumSize( 450, 250 ); -} - -/*! - \brief Set text to the information window. - \internal - \param text ionfo text -*/ -void ToolsGUI_RegWidget::InfoWindow::setText( const QString& text ) -{ - myTextView->setText( text ); -} - -/*! - \brief Key press event handler. Closeswindow on \c Escape key pressing. - \internal - \param e key press event -*/ -void ToolsGUI_RegWidget::InfoWindow::keyPressEvent( QKeyEvent * e ) -{ - QMainWindow::keyPressEvent( e ); - if ( e->key() == Qt::Key_Escape ) - close(); -} - -/*! - \class ToolsGUI_RegWidget::HelpWindow - \brief Help window. - \internal -*/ - -class ToolsGUI_RegWidget::HelpWindow : public QMainWindow -{ -public: - HelpWindow( QWidget* parent ); - ~HelpWindow(); - - void setText( const QString& text ); - -private: - QTextEdit* myTextView; -}; - -/*! - \brief Constructor. - \internal - \param parent parent widget -*/ -ToolsGUI_RegWidget::HelpWindow::HelpWindow( QWidget* parent ) -: QMainWindow( parent ) -{ - setAttribute( Qt::WA_DeleteOnClose ); - setWindowTitle( tr( "Help" ) ); - - myTextView = new QTextEdit( this ); - myTextView->setReadOnly( true ); - QPalette pal = myTextView->palette(); - - pal.setBrush( QPalette::Active, QPalette::Highlight, QBrush( QColor( 0, 0, 128 ) ) ); - pal.setBrush( QPalette::Active, QPalette::HighlightedText, QBrush( Qt::white ) ); - pal.setBrush( QPalette::Active, QPalette::Base, QBrush( QColor( 255,255,220 ) ) ); - pal.setBrush( QPalette::Active, QPalette::Text, QBrush( Qt::black ) ); - - pal.setBrush( QPalette::Inactive, QPalette::Highlight, QBrush( QColor( 0, 0, 128 ) ) ); - pal.setBrush( QPalette::Inactive, QPalette::HighlightedText, QBrush( Qt::white ) ); - pal.setBrush( QPalette::Inactive, QPalette::Base, QBrush( QColor( 255,255,220 ) ) ); - pal.setBrush( QPalette::Inactive, QPalette::Text, QBrush( Qt::black ) ); - - pal.setBrush( QPalette::Disabled, QPalette::Highlight, QBrush( QColor( 0, 0, 128 ) ) ); - pal.setBrush( QPalette::Disabled, QPalette::HighlightedText, QBrush( Qt::white ) ); - pal.setBrush( QPalette::Disabled, QPalette::Base, QBrush( QColor( 255,255,220 ) ) ); - pal.setBrush( QPalette::Disabled, QPalette::Text, QBrush( Qt::black ) ); - - myTextView->setPalette( pal ); - - setCentralWidget( myTextView ); - setMinimumSize( 450, 250 ); - - QFile f ( "tmp.txt" ); - if ( f.open( QIODevice::ReadOnly ) ) { - QTextStream t( &f ); - while ( !t.atEnd() ) { - myTextView->append( t.readLine() ); - } - } - f.close(); -} - -/*! - \brief Destructor. - \internal -*/ -ToolsGUI_RegWidget::HelpWindow::~HelpWindow() -{ -}; - -/*! - \brief Set text to the help window. - \internal - \param text help text -*/ -void ToolsGUI_RegWidget::HelpWindow::setText( const QString& text ) -{ - myTextView->setText( text ); -} - -/*! - \class ToolsGUI_RegWidget::IntervalWindow - \brief Dialog box to enter time delay between registry window updates - \internal -*/ - -class ToolsGUI_RegWidget::IntervalWindow : public QDialog -{ -public: - IntervalWindow( QWidget* parent ); - ~IntervalWindow(); - - QPushButton* Ok(); - QPushButton* Cancel(); - - int getValue(); - void setValue( int ); - -private: - QSpinBox* mySpinBox; - QPushButton* myButtonOk; - QPushButton* myButtonCancel; -}; - -/*! - \brief Constructor. - \internal - \param parent parent widget -*/ -ToolsGUI_RegWidget::IntervalWindow::IntervalWindow ( QWidget* parent ) -: QDialog( parent ) -{ - setModal( true ); - setAttribute( Qt::WA_DeleteOnClose ); - - setWindowTitle( tr( "Refresh Interval" ) ); - setSizeGripEnabled( true ); - - QGridLayout* topLayout = new QGridLayout( this ); - topLayout->setSpacing( SPACING_SIZE ); - topLayout->setMargin( MARGIN_SIZE ); - - QGroupBox* intervalGrp = new QGroupBox( this ); - intervalGrp->setObjectName( "intervalGrp" ); - QGridLayout* intervalGrpLayout = new QGridLayout( intervalGrp ); - intervalGrpLayout->setAlignment( Qt::AlignTop ); - intervalGrpLayout->setSpacing( SPACING_SIZE ); - intervalGrpLayout->setMargin( MARGIN_SIZE ); - - QHBoxLayout* aBtnLayout = new QHBoxLayout; - aBtnLayout->setSpacing( SPACING_SIZE ); - aBtnLayout->setMargin( 0 ); - - myButtonOk = new QPushButton( this ); - myButtonOk->setObjectName( "buttonOk" ); - myButtonOk->setText( tr( "BUT_OK" ) ); - myButtonOk->setAutoDefault( TRUE ); - myButtonOk->setDefault( TRUE ); - - myButtonCancel = new QPushButton( this ); - myButtonCancel->setObjectName( "buttonCancel" ); - myButtonCancel->setText( tr( "BUT_CANCEL" ) ); - myButtonCancel->setAutoDefault( TRUE ); - - QLabel* TextLabel = new QLabel( intervalGrp ); - TextLabel->setObjectName( "TextLabel" ); - TextLabel->setText( tr( "Please, enter a number of seconds:" ) ); - - mySpinBox = new QSpinBox( intervalGrp ); - mySpinBox->setMinimum( 1 ); - mySpinBox->setMaximum( 999999999 ); - mySpinBox->setSingleStep( 1 ); - mySpinBox->setObjectName( "SpinBox" ); - mySpinBox->setValue( 100 ); - mySpinBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); - mySpinBox->setMinimumWidth(MIN_SPIN_WIDTH); - - intervalGrpLayout->addWidget(TextLabel, 0, 0); - intervalGrpLayout->addWidget(mySpinBox, 0, 1); - - aBtnLayout->addWidget( myButtonOk ); - aBtnLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ) ); - aBtnLayout->addWidget( myButtonCancel ); - - topLayout->addWidget( intervalGrp, 0, 0 ); - topLayout->addLayout( aBtnLayout, 1, 0 ); -} - -/*! - \brief Destructor - \internal -*/ -ToolsGUI_RegWidget::IntervalWindow::~IntervalWindow() -{ -} - -/*! - \brief Set time interval value - \internal - \param size interval value -*/ -void ToolsGUI_RegWidget::IntervalWindow::setValue( const int size ) -{ - mySpinBox->setValue(size); -} - -/*! - \brief Get time interval value - \internal - \return interval value -*/ -int ToolsGUI_RegWidget::IntervalWindow::getValue() -{ - return mySpinBox->value(); -} - -/*! - \brief Get \c OK button - \internal - \return a pointer to \c OK button -*/ -QPushButton* ToolsGUI_RegWidget::IntervalWindow::Ok() -{ - return myButtonOk; -} - -/*! - \brief Get \c Cancel button - \internal - \return a pointer to \c Cancel button -*/ -QPushButton* ToolsGUI_RegWidget::IntervalWindow::Cancel() -{ - return myButtonCancel; -} - -/*! - \class ToolsGUI_RegWidget - \brief SALOME Registry tool window. -*/ - -//! The only instance of Registry window -ToolsGUI_RegWidget* ToolsGUI_RegWidget::myRegWidgetPtr = 0; - -/*! - \brief Create/get the only instance of the Registry window. - \param orb CORBA ORB reference - \param parent parent widget -*/ -ToolsGUI_RegWidget* ToolsGUI_RegWidget::GetRegWidget( CORBA::ORB_var& orb, - QWidget* parent ) -{ - if ( !myRegWidgetPtr ) - myRegWidgetPtr = new ToolsGUI_RegWidget( orb, parent ); - return myRegWidgetPtr; -} - -/*! - \brief This virtual function is reimplenented to disable popup menu on dock areas - (instead of QMainWindow::setDockMenuEnabled( false ) method used in Qt3). - \return always 0 to disable menu -*/ -QMenu* ToolsGUI_RegWidget::createPopupMenu() -{ - QMenu* aPopup = 0; - return aPopup; -} - -/*! - \brief Constructor - \param orb CORBA ORB reference - \param parent parent widget -*/ -ToolsGUI_RegWidget::ToolsGUI_RegWidget( CORBA::ORB_var& orb, QWidget* parent ) -: QMainWindow( parent, Qt::Window ), - _VarComponents( MakeRegistry(orb) ), - _clients( 0 ), - _history( 0 ), - _parent( parent ), - _tabWidget( 0 ), - _refresh( 0 ), - _interval( 0 ), - myInfoWindow( 0 ), - myHelpWindow( 0 ), - myIntervalWindow( 0 ) -{ - setAttribute( Qt::WA_DeleteOnClose ); - - if ( parent ) - setWindowIcon( parent->windowIcon() ); - - // pixmap for buttons - QPixmap image_refresh ( ( const char** ) refresh_data ); - QPixmap image_interval( ( const char** ) time_data ); - QPixmap image_close ( ( const char** ) close_data ); - - // Buttons definition - QToolBar* topbar = new QToolBar( tr("Toolbar"), this ); - topbar->setToolButtonStyle( Qt::ToolButtonTextBesideIcon ); - addToolBar( Qt::TopToolBarArea, topbar ); - - _refresh = topbar->addAction(image_refresh, tr( "Refresh" ), this, SLOT( slotListeSelect() )); - _refresh->setToolTip( "" ); - _refresh->setStatusTip( tr("Immediately updates list of components") ); - - /* PAL5540 - this button is needless - QPushButton* help = new QPushButton( tr( "Help" ), topbar ); - connect( help, SIGNAL( clicked() ), this, SLOT( slotHelp() ) ); - QToolTip::add( help, "", toolTipGroup(), tr("Opens Help window") ); - */ - - _interval = topbar->addAction(image_interval, tr( "Interval" ), this, SLOT( slotSelectRefresh() )); - _interval->setToolTip( "" ); - _interval->setStatusTip( tr("Changes refresh interval") ); - - topbar->addSeparator(); - - _close = topbar->addAction( image_close, tr("Close"), this, SLOT( close() )); - _close->setToolTip( "" ); - _close->setStatusTip( tr("Closes Registry window") ); - - // Display area and associated slots definition - _tabWidget = new QTabWidget( this ); - _clients = new QTreeWidget( _tabWidget ); - SetListe(); - _history = new QTreeWidget( _tabWidget ); - SetListeHistory(); - - _tabWidget->addTab( _clients, tr( "Running" ) ); - _tabWidget->addTab( _history, tr( "History" ) ); - connect( _tabWidget, SIGNAL( currentChanged( QWidget* )), this, SLOT( slotListeSelect() ) ); - connect( _clients, SIGNAL( clicked( QTreeWidgetItem* ) ), this, SLOT( slotClientChanged( QTreeWidgetItem* ) ) ); - connect( _history, SIGNAL( clicked( QTreeWidgetItem* ) ), this, SLOT( slotHistoryChanged( QTreeWidgetItem* ) ) ); - setCentralWidget( _tabWidget ); - - // Timer definition (used to automaticaly refresh the display area) - _counter = new QTimer( this ); - connect( _counter, SIGNAL( timeout() ), this, SLOT( slotListeSelect() ) ); - myRefreshInterval = 10; - _counter->start( myRefreshInterval * 1000 ); - - PIXELS xpos = 160 ; - PIXELS ypos = 100 ; - PIXELS largeur = 800 ; - PIXELS hauteur = 350 ; - setGeometry( xpos, ypos, largeur, hauteur ) ; - setWindowTitle( tr( "Registry" ) ) ; - statusBar()->showMessage(" "); -} - -/*! - \brief Destructor -*/ -ToolsGUI_RegWidget::~ToolsGUI_RegWidget() -{ - _counter->stop(); - myRegWidgetPtr = 0; -}; - -/*! - \brief Event filter - \param object event receiver - \param event event being processed - \return \c true if event processing should be stopped -*/ -bool ToolsGUI_RegWidget::eventFilter( QObject* object, QEvent* event ) -{ - if ( object ) { - if ( object == myHelpWindow && event->type() == QEvent::Close ) { - myHelpWindow = 0; - } - else if ( object == myInfoWindow && event->type() == QEvent::Close ) { - myInfoWindow = 0; - } - else if ( object == myIntervalWindow && event->type() == QEvent::Close ) { - myIntervalWindow = 0; - } - else if ( object == _clients && event->type() == QEvent::KeyPress ) { - QKeyEvent* ke = (QKeyEvent*)event; - if ( ke->key() == Qt::Key_Enter || ke->key() == Qt::Key_Return ) { - slotClientChanged( _clients->currentItem() ); - } - } - else if ( object == _history && event->type() == QEvent::KeyPress ) { - QKeyEvent* ke = (QKeyEvent*)event; - if ( ke->key() == Qt::Key_Enter || ke->key() == Qt::Key_Return ) { - slotHistoryChanged( _history->currentItem() ); - } - } - } - return QMainWindow::eventFilter( object, event ); -} - -/*! - \brief Search item in the list. - \param name component name - \param pid PID - \param machine machine name - \param listclient list of registry data - \return item index or -1 if it is not found. -*/ -int ToolsGUI_RegWidget::numitem( const QString& name, - const QString& pid, - const QString& machine, - const Registry::AllInfos* listclient ) -{ - for (CORBA::ULong i=0; ilength(); i++) { - const Registry::Infos & c_info=(*listclient)[i]; - ASSERT( c_info.name!=NULL); - QString b; - b.setNum(int(c_info.pid)); - if ( (name.compare(QString(c_info.name)) == 0) && - (machine.compare(QString(c_info.machine)) == 0) && - (pid.compare(b) == 0) ) { - return i; - } - } - return -1; -} - -/*! - \brief Get description text, containing information about client. - \param c_info client info data - \return formatted client description -*/ -QString ToolsGUI_RegWidget::setlongText( const Registry::Infos& c_info ) -{ - ASSERT( c_info.name != NULL ); - QString a = QString( "

" ) + tr( "Code" ) + QString( " : " ); - a.append( QString( c_info.name ) ); - a.append( "



" ); - a.append( "" ); // ASV: 28.07.06 : added tags to make the text font be - // fixed width (looks much better on Windows) - a.append( tr( "Process Id" ) + QString( " : " ) ); - a.append( BOLD( QString::number( int( c_info.pid ) ) ) ); - a.append( QString( " " ) + tr( "on machine" ) + QString( " " ) ); - a.append( BOLD( c_info.machine ) ); - a.append( QString( " " ) + tr( "ip address" ) + QString( " : " ) ); - a.append( BOLD( c_info.adip ) ); - a.append( "
" ); - - a.append( tr( "launched by user" ) + QString( " " ) ); - a.append( BOLD( c_info.pwname ) ); - a.append( QString( " ( " ) + tr( "pid" ) + QString( " : " ) ); - a.append( BOLD( QString::number( int( c_info.uid ) ) ) ); - a.append( QString( " )
" ) + tr( "in directory" ) + QString( " " )); - a.append( BOLD( c_info.cdir ) ); - - time_t aTime; - a.append( QString( "
" ) + tr( "begins" ) + QString( " " ) ); - aTime = time_t(c_info.tc_start); - char * t1 = (char * )duplicate(ctime(&aTime)); - t1 [strlen(t1) -1 ] = ' '; - a.append( BOLD( t1 ) ); - delete [] t1; - a.append( "
" ); - - if (c_info.tc_hello != 0 ) { - aTime = time_t(c_info.tc_hello); - char * t2 = (char * )duplicate(ctime(&aTime)); - t2 [strlen(t2) -1 ] = ' '; - a.append( tr( "last signal" ) + QString(" : ") ); - a.append( BOLD( t2 ) ); - a.append( "
" ); - delete [] t2; - } - if ((c_info.tc_end - c_info.difftime) != 0) { - aTime = time_t(c_info.tc_end); - char * t3 = (char * )duplicate(ctime(&aTime)); - t3 [strlen(t3) -1 ] = ' '; - a.append( tr( "ends" ) + QString( " " ) ); - a.append( BOLD( t3 ) ); - a.append( "
" ); - delete [] t3; - } - else { - a.append( tr( "still running" ) + QString( "
" ) ); - } - - SCRUTE(c_info.difftime); - if (c_info.difftime!= 0) { - a.append( QString( "(" ) + tr( "Time on" ) + QString( " " ) ); - a.append( BOLD( c_info.machine ) ); - a.append( QString( " " ) + tr( "differs from server's time. The difference is" ) + QString( " " )); - a.append( BOLD( QString::number( int( c_info.difftime ) ) ) ); - a.append( QString( " " ) + tr( "seconds" ) + QString( ")
" ) ); - } - a.append( "
" ); // ASV: 28.07.06 : added tags to make the text font be - // fixed width (looks much better on Windows) - return a; - -} - -/*! - \brief Close event handler. - \param e close event -*/ -void ToolsGUI_RegWidget::closeEvent( QCloseEvent* e ) -{ - if ( myInfoWindow ) - myInfoWindow->close(); - if ( myHelpWindow ) - myHelpWindow->close(); - if (myIntervalWindow) - myIntervalWindow->close(); - e->accept(); -}; - -/*! - \brief Setup clients list. -*/ -void ToolsGUI_RegWidget::SetListe() -{ - _clients->installEventFilter( this ); - _clients->setColumnCount(6); - _clients->setAllColumnsShowFocus( true ); - QStringList aLabels; - aLabels << tr("Component") << tr("PID") << tr("User Name") << tr("Machine") << tr("begins") << tr("hello"); - _clients->setHeaderLabels( aLabels ); - //_clients->setColumnAlignment( 1, Qt::AlignRight ); -} - -/*! - \brief Setup history list. -*/ -void ToolsGUI_RegWidget::SetListeHistory() -{ - _history->installEventFilter( this ); - _history->setColumnCount(6); - _history->setAllColumnsShowFocus( true ); - QStringList aLabels; - aLabels << tr("Component") << tr("PID") << tr("User Name") << tr("Machine") << tr("begins") << tr("ends"); - _history->setHeaderLabels( aLabels ); - //_history->setColumnAlignment( 1, Qt::AlignRight ); -} - -/*! - \brief Update history list -*/ -void ToolsGUI_RegWidget::InfoHistory() -{ - - _history->clear(); - try { - time_t aTime; - _serverhistory = _VarComponents->history(); - for (CORBA::ULong i=0; i<_serverhistory->length(); i++) { - const Registry::Infos & c_info=(*_serverhistory)[i]; - ASSERT( c_info.name!=NULL); - QString a; - a.setNum(int(c_info.pid)); - aTime = time_t(c_info.tc_start); - char * t1 = (char * )duplicate(ctime(&aTime)); - t1 [strlen(t1) -1 ] = ' '; - aTime = time_t(c_info.tc_end); - char * t2 = (char * )duplicate(ctime(&aTime)); - t2 [strlen(t2) -1 ] = ' '; - QStringList anItem; - anItem << QString(c_info.name) << a << QString(c_info.pwname) << QString(c_info.machine) << QString(t1) << QString(t2); - QTreeWidgetItem * item = new QTreeWidgetItem(_history, anItem); - item=0 ; - delete [] t1; - delete [] t2; - - } - } - catch( ... ) { - _interval->setDisabled( TRUE ) ; - _refresh->setDisabled( TRUE ) ; - _counter->stop(); - MESSAGE("Sorry, No more Registry Server") ; - statusBar()->showMessage( tr( "Sorry, No more Registry Server" ) ) ; - } -} - -/*! - \brief Update clients list -*/ -void ToolsGUI_RegWidget::InfoReg() -{ - _clients->clear(); - try { - time_t aTime; - _serverclients = _VarComponents->getall(); - for (CORBA::ULong i=0; i<_serverclients->length(); i++) { - const Registry::Infos & c_info=(*_serverclients)[i]; - ASSERT( c_info.name!=NULL); - QString a; - a.setNum(int(c_info.pid)); - aTime = time_t(c_info.tc_start); - char * t1 = (char * )duplicate(ctime(&aTime)); - t1 [strlen(t1) -1 ] = ' '; - aTime = time_t(c_info.tc_hello); - char * t2 = (char * )duplicate(ctime(&aTime)); - t2 [strlen(t2) -1 ] = ' '; - QStringList anItem; - anItem << QString(c_info.name) << a << QString(c_info.pwname) << QString(c_info.machine) << QString(t1) << QString(t2); - QTreeWidgetItem * item = new QTreeWidgetItem(_clients, anItem); - item=0 ; - delete [] t1; - delete [] t2; - - } - } - catch( ... ) { - _interval->setDisabled( TRUE ) ; - _refresh->setDisabled( TRUE ) ; - _counter->stop(); - MESSAGE("Sorry, No more Registry Server") ; - statusBar()->showMessage( tr( "Sorry, No more Registry Server" ) ) ; - } -} - -/*! - \brief Called when \c Refresh button is clicked -*/ -void ToolsGUI_RegWidget::slotListeSelect() -{ - try { - ASSERT(_tabWidget->currentWidget() != NULL); - if (_tabWidget->currentWidget () == _clients) InfoReg(); - else if (_tabWidget->currentWidget () == _history) InfoHistory(); - } - catch( ... ) { - MESSAGE("Sorry, No more Registry Server") ; - statusBar()->showMessage( tr( "Sorry, No more Registry Server" ) ) ; - } -} - -/*! - \brief Called when \c Interval button is clicked (open dialog box to - change refresh interval). -*/ -void ToolsGUI_RegWidget::slotSelectRefresh() -{ - myIntervalWindow = new ToolsGUI_RegWidget::IntervalWindow(this); - myIntervalWindow->installEventFilter( this ); - myIntervalWindow->setValue(myRefreshInterval); - myIntervalWindow->show(); - connect( myIntervalWindow->Cancel(), SIGNAL( clicked() ), myIntervalWindow, SLOT( close() ) ); - connect( myIntervalWindow->Ok(), SIGNAL( clicked() ), this, SLOT( slotIntervalOk() ) ); -} - -/*! - \brief Called when IntervalWindow's \c OK button is clicked -*/ -void ToolsGUI_RegWidget::slotIntervalOk() -{ - myRefreshInterval = myIntervalWindow->getValue(); - _counter->start( myRefreshInterval * 1000 ); - SCRUTE(myRefreshInterval); - myIntervalWindow->close(); -} -/*! - \brief Called when \c Help button is clicked -*/ -void ToolsGUI_RegWidget::slotHelp() -{ - if ( !myHelpWindow ) { - myHelpWindow = new ToolsGUI_RegWidget::HelpWindow( this ); - myHelpWindow->installEventFilter( this ); - } - myHelpWindow->show(); - myHelpWindow->raise(); - myHelpWindow->activateWindow(); -} - -/*! - \brief Called when user clicks on item in \c Running list - \param item item clicked by the user -*/ -void ToolsGUI_RegWidget::slotClientChanged( QTreeWidgetItem* item ) -{ - if ( item <= 0) - return; - - blockSignals( true ); // for sure that item will not be deleted when refreshing - - int numeroItem = numitem(item->text(0), item->text(1), item->text(3), _serverclients); - SCRUTE(numeroItem) ; - SCRUTE(item->text(1).toLatin1().constData()) ; - - ASSERT(numeroItem>=0) ; - ASSERT((size_t)numeroItem<_serverclients->length()) ; - const Registry::Infos & c_info=(*_serverclients)[numeroItem]; - ASSERT( c_info.name!=NULL); - - if ( !myInfoWindow ) { - myInfoWindow = new ToolsGUI_RegWidget::InfoWindow( this ); - myInfoWindow->installEventFilter( this ); - } - QString a = tr( "More about" ) + QString( " " ) + QString( c_info.name ); - myInfoWindow->setWindowTitle(a); - myInfoWindow->setText( ToolsGUI_RegWidget::setlongText( c_info) ); - myInfoWindow->show(); - myInfoWindow->raise(); - myInfoWindow->activateWindow(); - - blockSignals( false ); // enabling signals again -} - -/*! - \brief Called when user clicks on item in \c History list - \param item item clicked by the user -*/ -void ToolsGUI_RegWidget::slotHistoryChanged( QTreeWidgetItem* item ) -{ - if ( item <= 0) - return; - - blockSignals( true ); // for sure that item will not be deleted when refreshing - - int numeroItem = numitem(item->text(0), item->text(1), item->text(3), _serverhistory); - - SCRUTE(numeroItem) ; - SCRUTE(item->text(1).toLatin1().constData()) ; - ASSERT(numeroItem>=0) ; - ASSERT((size_t)numeroItem<_serverhistory->length()) ; - const Registry::Infos & c_info=(*_serverhistory)[numeroItem]; - ASSERT( c_info.name!=NULL); - - if ( !myInfoWindow ) { - myInfoWindow = new ToolsGUI_RegWidget::InfoWindow( this ); - myInfoWindow->installEventFilter( this ); - } - QString a = tr( "More about" ) + QString( " " ) + QString( c_info.name ); - myInfoWindow->setWindowTitle(a); - myInfoWindow->setText( ToolsGUI_RegWidget::setlongText( c_info ) ); - myInfoWindow->show(); - myInfoWindow->raise(); - myInfoWindow->activateWindow(); - - blockSignals( false ); // enabling signals again -} - diff --git a/src/TOOLSGUI/ToolsGUI_RegWidget.h b/src/TOOLSGUI/ToolsGUI_RegWidget.h deleted file mode 100755 index d91417df9..000000000 --- a/src/TOOLSGUI/ToolsGUI_RegWidget.h +++ /dev/null @@ -1,106 +0,0 @@ -// SALOME RegistryDisplay : GUI for Registry server implementation -// -// 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 : ToolsGUI_RegWidget.h -// Author : Pascale NOYRET, EDF -// - -#ifndef TOOLSGUI_REGWIDGET_H -#define TOOLSGUI_REGWIDGET_H - -#include "ToolsGUI.h" - -#include - -#include -#include CORBA_CLIENT_HEADER(SALOME_Registry) - -class QTabWidget; -class QTreeWidget; -class QTreeWidgetItem; -class QWidget; -class QTimer; -class QCloseEvent; -class QAction; - -class TOOLSGUI_EXPORT ToolsGUI_RegWidget : public QMainWindow -{ - Q_OBJECT - - class HelpWindow; - class IntervalWindow; - class InfoWindow; - - ToolsGUI_RegWidget( CORBA::ORB_var& orb, QWidget* parent = 0 ); - -public: - ~ToolsGUI_RegWidget(); - - void SetListe(); - void SetListeHistory(); - void InfoReg(); - void InfoHistory(); - - bool eventFilter( QObject* object, QEvent* event ); - - static ToolsGUI_RegWidget* GetRegWidget( CORBA::ORB_var& orb, - QWidget* parent = 0 ); - - virtual QMenu* createPopupMenu(); - -public slots: - void slotHelp(); - void slotListeSelect(); - void slotClientChanged( QTreeWidgetItem* ); - void slotHistoryChanged( QTreeWidgetItem* ); - void slotSelectRefresh(); - void slotIntervalOk(); - -protected: - static QString setlongText( const Registry::Infos& c_info ); - int numitem( const QString& name, - const QString& pid, - const QString& machine, - const Registry::AllInfos* clistclient ); - void closeEvent( QCloseEvent* e ); - -protected : - QTreeWidget* _clients; - QTreeWidget* _history; - QWidget* _parent; - QTabWidget* _tabWidget; - QAction* _refresh; - QAction* _interval; - QAction* _close; - QTimer* _counter; - Registry::AllInfos* _serverhistory; - Registry::AllInfos* _serverclients; - InfoWindow* myInfoWindow; - HelpWindow* myHelpWindow; - IntervalWindow* myIntervalWindow; - int myRefreshInterval; - -private: - const Registry::Components_var _VarComponents; - static ToolsGUI_RegWidget* myRegWidgetPtr; -}; - -#endif // TOOLSGUI_REGWIDGET_H diff --git a/src/TOOLSGUI/resources/ToolsGUI_icons.po b/src/TOOLSGUI/resources/ToolsGUI_icons.po deleted file mode 100755 index f59a4fc94..000000000 --- a/src/TOOLSGUI/resources/ToolsGUI_icons.po +++ /dev/null @@ -1,41 +0,0 @@ -# SALOME TOOLSGUI : implementation of desktop "Tools" optioins -# -# 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 : ToolsGUI_icons.po -# Module : SALOME - -msgid "" -msgstr "" -"Project-Id-Version: SALOME VERSION 0.4\n" -"POT-Creation-Date: 2002-04-25 10:04:12 PM CEST\n" -"PO-Revision-Date: YYYY-MM-DD\n" -"Last-Translator: Nicolas REJNERI\n" -"Content-Type: text/plain; charset=iso-8859-1\n" - -# -#============================================================================== -# - -#: ToolsGUI_CatalogGeneratorDlg.cxx:50 -msgid "ToolsGUI_CatalogGeneratorDlg::ICON_SELECT" -msgstr "select1.png" diff --git a/src/TOOLSGUI/resources/ToolsGUI_msg_en.po b/src/TOOLSGUI/resources/ToolsGUI_msg_en.po deleted file mode 100755 index cfab19fbb..000000000 --- a/src/TOOLSGUI/resources/ToolsGUI_msg_en.po +++ /dev/null @@ -1,130 +0,0 @@ -# SALOME TOOLSGUI : implementation of desktop "Tools" optioins -# -# 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 : ToolsGUI_msg_en.po -# Module : SALOME - -msgid "" -msgstr "" -"Project-Id-Version: SALOME VERSION 0.4\n" -"POT-Creation-Date: 2002-04-25 10:04:12 PM CEST\n" -"PO-Revision-Date: YYYY-MM-DD\n" -"Last-Translator: Nicolas REJNERI\n" -"Content-Type: text/plain; charset=iso-8859-1\n" - -# -#============================================================================== -# - -#: ToolsGUI_CatalogGeneratorDlg.cxx:58 -msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_FILES" -msgstr "Files" - -#: ToolsGUI_CatalogGeneratorDlg.cxx:58 -msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_SUPPLEMENT" -msgstr "Component supplementary data" - -#: ToolsGUI_CatalogGeneratorDlg.cxx:150 -msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_MEN_EXPORT" -msgstr "Export" - -msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_MEN_IMPORT" -msgstr "Import" - -#: ToolsGUI_CatalogGeneratorDlg.cxx:47 -msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_CATALOG_GENERATOR" -msgstr "Catalog generator" - -#: ToolsGUI_CatalogGeneratorDlg.cxx:82 -msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_IDL_FILE" -msgstr "IDL : " - -#: ToolsGUI_CatalogGeneratorDlg.cxx:88 -msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_XML_FILE" -msgstr "XML : " - -#: ToolsGUI_CatalogGeneratorDlg.cxx:88 -msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_PNG_FILE" -msgstr "Icon : " - -msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_AUTHOR" -msgstr "Author : " - -msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_VERSION" -msgstr "Version : " - -msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_COMP_NAME" -msgstr "Name : " - -msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_COMP_USERNAME" -msgstr "UserName : " - -msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_COMP_TYPE" -msgstr "Type : " - -msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_COMP_MULTISTD" -msgstr "Multistudy : " - -#: ToolsGUI_CatalogGeneratorDlg.cxx:153 -msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_MEN_EXPORT_XML" -msgstr "XML Files ( *.xml )" - -#: ToolsGUI_CatalogGeneratorDlg.cxx:154 -msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_MEN_IMPORT_IDL" -msgstr "IDL Files ( *.idl )" - -#: ToolsGUI_CatalogGeneratorDlg.cxx:154 -msgid "ToolsGUI_CatalogGeneratorDlg::TOOLS_MEN_IMPORT_PNG" -msgstr "PNG Files ( *.png )" - -# -#============================================================================== -# - -#: ToolsGUI_CatalogGeneratorDlg.cxx:107 -msgid "TOOLS_BUT_CLOSE" -msgstr "&Close" - -#: ToolsGUI_CatalogGeneratorDlg.cxx:113 -msgid "TOOLS_BUT_OK" -msgstr "&Ok" - -msgid "TOOLS_BUT_BROWSE" -msgstr "Browse..." - -msgid "TOOLS_BUT_APPLY" -msgstr "&Apply" - -# -#============================================================================== -# - -#: ToolsGUI_CatalogGeneratorDlg.cxx:53 -msgid "TOOLS_WRN_WARNING" -msgstr "Warning" - -msgid "TOOLS_ERR_ERROR" -msgstr "Error" - -msgid "TOOLS_ERR_FILE_NOT_EXIST" -msgstr "%1\nFile doesn't exist" diff --git a/src/TOOLSGUI/resources/ToolsGUI_msg_en.ts b/src/TOOLSGUI/resources/ToolsGUI_msg_en.ts deleted file mode 100644 index 9e4a28dca..000000000 --- a/src/TOOLSGUI/resources/ToolsGUI_msg_en.ts +++ /dev/null @@ -1,105 +0,0 @@ - - - @default - - TOOLS_WRN_WARNING - Warning - - - TOOLS_BUT_BROWSE - Browse... - - - TOOLS_ERR_ERROR - Error - - - TOOLS_ERR_FILE_NOT_EXIST - %1 -File doesn't exist - - - TOOLS_BUT_OK - &Ok - - - TOOLS_BUT_APPLY - &Apply - - - TOOLS_BUT_CLOSE - &Close - - - - ToolsGUI_CatalogGeneratorDlg - - TOOLS_MEN_EXPORT - Export - - - TOOLS_MEN_IMPORT - Import - - - TOOLS_VERSION - Version : - - - TOOLS_COMP_NAME - Name : - - - TOOLS_COMP_TYPE - Type : - - - TOOLS_XML_FILE - XML : - - - TOOLS_PNG_FILE - Icon : - - - TOOLS_SUPPLEMENT - Component supplementary data - - - TOOLS_AUTHOR - Author : - - - TOOLS_COMP_MULTISTD - Multistudy : - - - TOOLS_COMP_USERNAME - UserName : - - - TOOLS_CATALOG_GENERATOR - Catalog generator - - - TOOLS_FILES - Files - - - TOOLS_MEN_IMPORT_PNG - PNG Files ( *.png ) - - - TOOLS_MEN_IMPORT_IDL - IDL Files ( *.idl ) - - - TOOLS_MEN_EXPORT_XML - XML Files ( *.xml ) - - - TOOLS_IDL_FILE - IDL : - - - -- 2.39.2