]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Preferences filling
authornds <nds@opencascade.com>
Tue, 1 Apr 2008 07:48:40 +0000 (07:48 +0000)
committernds <nds@opencascade.com>
Tue, 1 Apr 2008 07:48:40 +0000 (07:48 +0000)
15 files changed:
src/Plot2d/Plot2d_ViewManager.cxx
src/Plot2d/Plot2d_ViewManager.h
src/Plot2d/resources/Plot2d_msg_en.po
src/Plot2d/resources/Plot2d_msg_en.ts
src/SVTK/SVTK_ViewManager.cxx
src/SVTK/SVTK_ViewManager.h
src/SVTK/resources/SVTK_msg_en.po
src/SVTK/resources/SVTK_msg_en.ts
src/TableViewer/TableViewer_ViewManager.cxx
src/TableViewer/TableViewer_ViewManager.h
src/TableViewer/resources/TableViewer_msg_en.ts
src/VTKViewer/VTKViewer_ViewManager.cxx
src/VTKViewer/VTKViewer_ViewManager.h
src/VTKViewer/resources/VTKViewer_msg_en.po
src/VTKViewer/resources/VTKViewer_msg_en.ts

index 7681bd3f2b4eeba76076ef263cb5581d7f7d6cc4..cccfe186565c00c6c1f2ab35b56952b12587a674 100755 (executable)
@@ -20,6 +20,9 @@
 #include "Plot2d_ViewModel.h"
 #include "Plot2d_ViewWindow.h"
 
+#include "SUIT_PreferenceMgr.h"
+#include "SUIT_ResourceMgr.h"
+
 /*!
   Constructor
 */
@@ -83,3 +86,78 @@ void Plot2d_ViewManager::onCloneView()
   if( newWnd && clonedWnd )
     emit cloneView( clonedWnd->getViewFrame(), newWnd->getViewFrame() );
 }
+
+/*!
+  Fills preference manager for viewer
+*/
+int Plot2d_ViewManager::fillPreferences( SUIT_PreferenceMgr* thePrefMgr, const int theId )
+{
+  int aGrpId = thePrefMgr->addItem( tr( "PREF_GROUP_PLOT2DVIEWER" ), theId,
+                                        SUIT_PreferenceMgr::GroupBox );
+
+  thePrefMgr->addItem( tr( "PREF_SHOW_LEGEND" ), aGrpId,
+                     SUIT_PreferenceMgr::Bool, "Plot2d", "ShowLegend" );
+
+  int legendPosition = thePrefMgr->addItem( tr( "PREF_LEGEND_POSITION" ), aGrpId,
+                                          SUIT_PreferenceMgr::Selector, "Plot2d", "LegendPos" );
+  QStringList aLegendPosList;
+  aLegendPosList.append( tr("PREF_LEFT") );
+  aLegendPosList.append( tr("PREF_RIGHT") );
+  aLegendPosList.append( tr("PREF_TOP") );
+  aLegendPosList.append( tr("PREF_BOTTOM") );
+
+  QList<QVariant> anIndexesList;
+  anIndexesList.append(0);
+  anIndexesList.append(1);
+  anIndexesList.append(2);
+  anIndexesList.append(3);
+
+  thePrefMgr->setItemProperty( "strings", aLegendPosList, legendPosition );
+  thePrefMgr->setItemProperty( "indexes", anIndexesList, legendPosition );
+
+  int curveType = thePrefMgr->addItem( tr( "PREF_CURVE_TYPE" ), aGrpId,
+                                     SUIT_PreferenceMgr::Selector, "Plot2d", "CurveType" );
+  QStringList aCurveTypesList;
+  aCurveTypesList.append( tr("PREF_POINTS") );
+  aCurveTypesList.append( tr("PREF_LINES") );
+  aCurveTypesList.append( tr("PREF_SPLINE") );
+
+  anIndexesList.clear();
+  anIndexesList.append(0);
+  anIndexesList.append(1);
+  anIndexesList.append(2);
+
+  thePrefMgr->setItemProperty( "strings", aCurveTypesList, curveType );
+  thePrefMgr->setItemProperty( "indexes", anIndexesList, curveType );
+
+  int markerSize = thePrefMgr->addItem( tr( "PREF_MARKER_SIZE" ), aGrpId,
+                                      SUIT_PreferenceMgr::IntSpin, "Plot2d", "MarkerSize" );
+
+  thePrefMgr->setItemProperty( "min", 0, markerSize );
+  thePrefMgr->setItemProperty( "max", 100, markerSize );
+
+  QStringList aScaleModesList;
+  aScaleModesList.append( tr("PREF_LINEAR") );
+  aScaleModesList.append( tr("PREF_LOGARITHMIC") );
+
+  anIndexesList.clear();
+  anIndexesList.append(0);
+  anIndexesList.append(1);
+
+  int horScale = thePrefMgr->addItem( tr( "PREF_HOR_AXIS_SCALE" ), aGrpId,
+                                    SUIT_PreferenceMgr::Selector, "Plot2d", "HorScaleMode" );
+
+  thePrefMgr->setItemProperty( "strings", aScaleModesList, horScale );
+  thePrefMgr->setItemProperty( "indexes", anIndexesList, horScale );
+
+  int verScale = thePrefMgr->addItem( tr( "PREF_VERT_AXIS_SCALE" ), aGrpId,
+                                    SUIT_PreferenceMgr::Selector, "Plot2d", "VerScaleMode" );
+
+  thePrefMgr->setItemProperty( "strings", aScaleModesList, verScale );
+  thePrefMgr->setItemProperty( "indexes", anIndexesList, verScale );
+
+  thePrefMgr->addItem( tr( "PREF_VIEWER_BACKGROUND" ), aGrpId,
+                     SUIT_PreferenceMgr::Color, "Plot2d", "Background" );
+
+  return aGrpId;
+}
index a26b01cb69406c7a2eb6582dff135c9d4e1bda7b..42b23a02cce35c2071aa5629d2addcfea5d49cd9 100755 (executable)
@@ -23,6 +23,7 @@
 #include "SUIT_ViewManager.h"
 
 class SUIT_Desktop;
+class SUIT_PreferenceMgr;
 class Plot2d_Viewer;
 class Plot2d_ViewFrame;
 
@@ -36,6 +37,8 @@ public:
 
   Plot2d_Viewer*     getPlot2dModel() const;
 
+  static int         fillPreferences( SUIT_PreferenceMgr*, const int );
+
 protected:
   bool         insertView(SUIT_ViewWindow* theView);
 
index e0d764da7b31e25c828ee10071f9ab02914e0ed2..33937e349185c3060061da86e43de35eead05236 100755 (executable)
@@ -409,3 +409,55 @@ msgstr "PostScript files (*.ps)"
 
 msgid "Plot2d_ViewManager::PLOT2D_VIEW_TITLE"
 msgstr "Plot2d scene:%M - viewer:%V"
+
+msgid "Plot2d_ViewManager::PREF_GROUP_PLOT2DVIEWER"
+msgstr "Plot2d Viewer"
+
+msgid "Plot2d_ViewManager::PREF_SHOW_LEGEND"
+msgstr "Show legend"
+
+msgid "Plot2d_ViewManager::PREF_LEGEND_POSITION"
+msgstr "Legend position:"
+
+msgid "Plot2d_ViewManager::PREF_LEFT"
+msgstr "Left"
+
+msgid "Plot2d_ViewManager::PREF_RIGHT"
+msgstr "Right"
+
+msgid "Plot2d_ViewManager::PREF_TOP"
+msgstr "Top"
+
+msgid "Plot2d_ViewManager::PREF_BOTTOM<"
+msgstr "Bottom"
+
+msgid "Plot2d_ViewManager::PREF_CURVE_TYPE"
+msgstr "Curve type:"
+
+msgid "Plot2d_ViewManager::PREF_POINTS"
+msgstr "Points"
+
+msgid "Plot2d_ViewManager::PREF_LINES"
+msgstr "Lines"
+
+msgid "Plot2d_ViewManager::PREF_SPLINE"
+msgstr "Spline"
+
+msgid "Plot2d_ViewManager::PREF_MARKER_SIZE"
+msgstr "Marker size:"
+
+msgid "Plot2d_ViewManager::PREF_LINEAR"
+msgstr "Linear"
+
+msgid "Plot2d_ViewManager::PREF_LOGARITHMIC"
+msgstr "Logarithmic"
+
+msgid "Plot2d_ViewManager::PREF_HOR_AXIS_SCALE"
+msgstr "Horizontal axis scale:"
+
+msgid "Plot2d_ViewManager::PREF_VERT_AXIS_SCALE"
+msgstr "Vertical axis scale:"
+
+msgid "Plot2d_ViewManager::PREF_VIEWER_BACKGROUND"
+msgstr "Background color"
+
index e21439e0d7c8b982a309813c4c39ada0a2a8c327..c7567489876fc460e12c46817f5671185ce2ef71 100644 (file)
@@ -509,5 +509,73 @@ Logarithmic scale for ordinate axis is not allowed.</translation>
         <source>PLOT2D_VIEW_TITLE</source>
         <translation>Plot2d scene:%M - viewer:%V</translation>
     </message>
+    <message>
+        <source>PREF_GROUP_PLOT2DVIEWER</source>
+        <translation>Plot2d Viewer</translation>
+    </message>
+    <message>
+        <source>PREF_SHOW_LEGEND</source>
+        <translation>Show legend</translation>
+    </message>
+    <message>
+        <source>PREF_LEGEND_POSITION</source>
+        <translation>Legend position:</translation>
+    </message>
+    <message>
+        <source>PREF_LEFT</source>
+        <translation>Left</translation>
+    </message>
+    <message>
+        <source>PREF_RIGHT</source>
+        <translation>Right</translation>
+    </message>
+    <message>
+        <source>PREF_TOP</source>
+        <translation>Top</translation>
+    </message>
+    <message>
+        <source>PREF_BOTTOM</source>
+        <translation>Bottom</translation>
+    </message>
+    <message>
+        <source>PREF_CURVE_TYPE</source>
+        <translation>Curve type:</translation>
+    </message>
+    <message>
+        <source>PREF_POINTS</source>
+        <translation>Points</translation>
+    </message>
+    <message>
+        <source>PREF_LINES</source>
+        <translation>Lines</translation>
+    </message>
+    <message>
+        <source>PREF_SPLINE</source>
+        <translation>Spline</translation>
+    </message>
+    <message>
+        <source>PREF_MARKER_SIZE</source>
+        <translation>Marker size:</translation>
+    </message>
+    <message>
+        <source>PREF_LINEAR</source>
+        <translation>Linear</translation>
+    </message>
+    <message>
+        <source>PREF_LOGARITHMIC</source>
+        <translation>Logarithmic</translation>
+    </message>
+    <message>
+        <source>PREF_HOR_AXIS_SCALE</source>
+        <translation>Horizontal axis scale:</translation>
+    </message>
+    <message>
+        <source>PREF_VERT_AXIS_SCALE</source>
+        <translation>Vertical axis scale:</translation>
+    </message>
+    <message>
+        <source>PREF_VIEWER_BACKGROUND</source>
+        <translation>Background color</translation>
+    </message>
 </context>
 </TS>
index b7856fdc7e22a225621233ec698f090e9bf64451..53a7a1cc6035d9ed0f8d22498caeded9ec4086a0 100644 (file)
@@ -21,6 +21,9 @@
 
 #include <VTKViewer_ViewManager.h>
 
+#include <SUIT_PreferenceMgr.h>
+#include <SUIT_ResourceMgr.h>
+
 /*!
   Constructor
 */
@@ -44,3 +47,40 @@ SUIT_Desktop* SVTK_ViewManager::getDesktop()
 {
   return myDesktop;
 }
+
+/*!
+  Fills preference manager for viewer
+*/
+int SVTK_ViewManager::fillPreferences( SUIT_PreferenceMgr* thePrefMgr, const int theId )
+{
+  int aGrpId = thePrefMgr->addItem( tr( "PREF_GROUP_VTKVIEWER" ), theId,
+                                    SUIT_PreferenceMgr::GroupBox );
+
+  int vtkTS = thePrefMgr->addItem( tr( "PREF_TRIHEDRON_SIZE" ), aGrpId,
+                                   SUIT_PreferenceMgr::DblSpin, "VTKViewer", "trihedron_size" );
+  thePrefMgr->addItem( tr( "PREF_RELATIVE_SIZE" ), aGrpId, SUIT_PreferenceMgr::Bool,
+                       "VTKViewer", "relative_size" );
+  thePrefMgr->addItem( tr( "PREF_VIEWER_BACKGROUND" ), aGrpId,
+                       SUIT_PreferenceMgr::Color, "VTKViewer", "background" );
+
+  thePrefMgr->setItemProperty( "min", 1.0E-06, vtkTS );
+  thePrefMgr->setItemProperty( "max", 150, vtkTS );
+
+  return aGrpId;
+}
+
+/**
+ * Fills values from resources
+ */
+void SVTK_ViewManager::fillFrom( SUIT_ResourceMgr* theMgr )
+{
+  SVTK_Viewer* aModel = dynamic_cast<SVTK_Viewer*>( getViewModel() );
+  if ( !aModel )
+    return;
+
+  aModel->setBackgroundColor( theMgr->colorValue( "VTKViewer", "background",
+                                                  aModel->backgroundColor() ) );
+  aModel->setTrihedronSize(
+     theMgr->doubleValue( "VTKViewer", "trihedron_size", aModel->trihedronSize() ),
+     theMgr->booleanValue( "VTKViewer", "relative_size", aModel->trihedronRelative() ) );
+}
index 8ff4efcc97545af264e2e59be6a20ff9ed3990ae..d14a9fa4171a2bb20465abcb6ea2b789c7910d59 100644 (file)
@@ -23,6 +23,8 @@
 #include "SVTK.h"
 
 class SUIT_Desktop;
+class SUIT_PreferenceMgr;
+class SUIT_ResourceMgr;
 
 //! Extend SUIT_ViewManager to deal with SVTK_Viewer
 class SVTK_EXPORT SVTK_ViewManager : public SUIT_ViewManager
@@ -37,6 +39,9 @@ public:
   virtual ~SVTK_ViewManager();
 
   SUIT_Desktop* getDesktop();
+
+  static int  fillPreferences( SUIT_PreferenceMgr*, const int );
+  void        fillFrom( SUIT_ResourceMgr* );
 };
 
 #endif
index 609f62c2b81337ab9f5d39c50344c0cdef857050..d2112a2dc4348eacc086957125fc51c77cd63134 100755 (executable)
@@ -149,6 +149,15 @@ msgstr "Change background..."
 msgid "SVTK_ViewManager::VTK_VIEW_TITLE"
 msgstr "VTK scene:%1 - viewer:%2"
 
+msgid "SVTK_ViewManager::PREF_TRIHEDRON_SIZE"
+msgstr "Trihedron size"
+
+msgid "SVTK_ViewManager::PREF_VIEWER_BACKGROUND"
+msgstr "Background color"
+
+msgid "SVTK_ViewManager::PREF_RELATIVE_SIZE"
+msgstr "Relative size"
+
 msgid "MNU_SHOW_TRIHEDRON"
 msgstr "Show/Hide trihedron"
 
index e48e72b8f65565778dc3471278fe2efaa6e1c2a8..d58468fc21373be4a372952912080eea6c54f06a 100644 (file)
         <source>VTK_VIEW_TITLE</source>
         <translation>VTK scene:%1 - viewer:%2</translation>
     </message>
+    <message>
+        <source>PREF_GROUP_VTKVIEWER</source>
+        <translation>VTK Viewer 3d</translation>
+    </message>
+    <message>
+        <source>PREF_TRIHEDRON_SIZE</source>
+        <translation>Trihedron size</translation>
+    </message>
+    <message>
+        <source>PREF_VIEWER_BACKGROUND</source>
+        <translation>Background color</translation>
+    </message>
+    <message>
+        <source>PREF_RELATIVE_SIZE</source>
+        <translation>Relative size</translation>
+    </message>
 </context>
 <context>
     <name>SVTK_Viewer</name>
index 14ee13d54ae49e25b24266c806ee9a2230ded6c7..8de154b770a64c2ce212414542641a768325f0dc 100755 (executable)
@@ -22,6 +22,8 @@
 
 #include <SUIT_Study.h>
 #include <SUIT_Desktop.h>
+#include <SUIT_PreferenceMgr.h>
+#include <SUIT_ResourceMgr.h>
 
 /*!
   Constructor
@@ -87,3 +89,21 @@ void TableViewer_ViewManager::createView()
     emit cloneView( clonedWnd->getViewFrame(), newWnd->getViewFrame() );
 }
 */
+
+/*!
+  Fills preference manager for viewer
+*/
+int TableViewer_ViewManager::fillPreferences( SUIT_PreferenceMgr* thePrefMgr, const int theId )
+{
+  int aGrpId = thePrefMgr->addItem( tr( "PREF_GROUP_TABLEVIEWER" ), theId,
+                                        SUIT_PreferenceMgr::GroupBox );
+  return aGrpId;
+}
+
+/**
+ * Fills values from resources
+ */
+void TableViewer_ViewManager::fillFrom( SUIT_ResourceMgr* theMgr )
+{
+
+}
index b80d8381ef69b7fe4d3d933a327b9b88278e3df0..dfdf0a8082514a3f62988551803abb2dee19bd1f 100755 (executable)
@@ -24,6 +24,8 @@
 
 class SUIT_Study;
 class SUIT_Desktop;
+class SUIT_PreferenceMgr;
+class SUIT_ResourceMgr;
 class TableViewer_Viewer;
 class TableViewer_ViewFrame;
 
@@ -37,6 +39,10 @@ public:
 
   TableViewer_Viewer*     getTableModel() const;
 
+  static int   fillPreferences( SUIT_PreferenceMgr*, const int );
+  void         fillFrom( SUIT_ResourceMgr* );
+
+
 //protected:
 //  bool         insertView(SUIT_ViewWindow* theView);
 
index 552848f346ee6ee1de1793e66b8a082ae287fd3f..638f96ea18a780311811dc09763620d096342856 100644 (file)
@@ -1,10 +1,6 @@
 <!DOCTYPE TS><TS>
 <context>
     <name>@default</name>
-    <message>
-        <source>TABLE_VIEWER_VIEW_TITLE</source>
-        <translation>TableViewer scene:%M - viewer %V</translation>
-    </message>
     <message>
         <source>LBL_TOOLBAR_LABEL</source>
         <translation>View operations</translation>
         <translation>Export table to file</translation>
     </message>
 </context>
+<context>
+    <name>TableViewer_ViewManager</name>
+    <message>
+        <source>TABLE_VIEWER_VIEW_TITLE</source>
+        <translation>TableViewer scene:%M - viewer %V</translation>
+    </message>
+    <message>
+        <source>PREF_GROUP_TABLEVIEWER</source>
+        <translation>Table Viewer</translation>
+    </message>
+</context>
 </TS>
index a206be6ee9e95495d382ba2d3bf70ac42fd41b13..0e3f32bb7b26d1173f9b8cd20701b534b97d4794 100755 (executable)
@@ -19,6 +19,9 @@
 #include "VTKViewer_ViewManager.h"
 #include "VTKViewer_ViewModel.h"
 
+#include <SUIT_PreferenceMgr.h>
+#include <SUIT_ResourceMgr.h>
+
 /*!Constructor.Initialize SIUT_ViewManager by \a study and \a theDesktop.
  * Create new instance of VTKViewer_Viewer and set view model by it.
  */
@@ -33,3 +36,37 @@ VTKViewer_ViewManager::~VTKViewer_ViewManager()
 {
   /*!Do nothing.*/
 }
+
+/*!
+  Fills preference manager for viewer
+*/
+int VTKViewer_ViewManager::fillPreferences( SUIT_PreferenceMgr* thePrefMgr, const int theId )
+{
+  int aGrpId = thePrefMgr->addItem( tr( "PREF_GROUP_VTKVIEWER" ), theId,
+                                    SUIT_PreferenceMgr::GroupBox );
+
+  int vtkTS = thePrefMgr->addItem( tr( "PREF_TRIHEDRON_SIZE" ), aGrpId,
+                                   SUIT_PreferenceMgr::DblSpin, "VTKViewer", "trihedron_size" );
+  thePrefMgr->addItem( tr( "PREF_RELATIVE_SIZE" ), aGrpId, SUIT_PreferenceMgr::Bool,
+                       "VTKViewer", "relative_size" );
+  thePrefMgr->addItem( tr( "PREF_VIEWER_BACKGROUND" ), aGrpId,
+                       SUIT_PreferenceMgr::Color, "VTKViewer", "background" );
+
+  thePrefMgr->setItemProperty( "min", 1.0E-06, vtkTS );
+  thePrefMgr->setItemProperty( "max", 150, vtkTS );
+
+  return aGrpId;
+}
+
+/**
+ * Fills values from resources
+ */
+void VTKViewer_ViewManager::fillFrom( SUIT_ResourceMgr* theMgr )
+{
+  VTKViewer_Viewer* aModel = dynamic_cast<VTKViewer_Viewer*>( getViewModel() );
+  if ( !aModel )
+    return;
+
+  aModel->setBackgroundColor( theMgr->colorValue( "VTKViewer", "background",
+                                                  aModel->backgroundColor() ) );
+}
index 38518fe06d3877eab6c8efb41ed671e974c3bf74..c8e20081726a81c84bcf9050e1c78e3875ed5c94 100755 (executable)
@@ -24,6 +24,8 @@
 #include <SUIT_ViewManager.h>
 
 class SUIT_Desktop;
+class SUIT_PreferenceMgr;
+class SUIT_ResourceMgr;
 
 /*!View manager.*/
 class VTKVIEWER_EXPORT VTKViewer_ViewManager : public SUIT_ViewManager
@@ -33,6 +35,9 @@ class VTKVIEWER_EXPORT VTKViewer_ViewManager : public SUIT_ViewManager
 public:
   VTKViewer_ViewManager( SUIT_Study* study, SUIT_Desktop* );
   virtual ~VTKViewer_ViewManager();
+
+  static int  fillPreferences( SUIT_PreferenceMgr*, const int );
+  void        fillFrom( SUIT_ResourceMgr* );
 };
 
 #endif
index ea26f2678875ca2e535d66c477d9434b9fa0b74f..a33df65706f5f63210b6d7ce90a66a1326f8a0a0 100755 (executable)
@@ -143,6 +143,18 @@ msgstr "Change background..."
 msgid "VTKViewer_ViewManager::VTK_VIEW_TITLE"
 msgstr "VTK scene:%M - viewer:%V"
 
+msgid "VTKViewer_ViewManager::PREF_GROUP_VTKVIEWER"
+msgstr "VTK Viewer 3d"
+
+msgid "VTKViewer_ViewManager::PREF_TRIHEDRON_SIZE"
+msgstr "Trihedron size"
+
+msgid "VTKViewer_ViewManager::PREF_VIEWER_BACKGROUND"
+msgstr "Background color"
+
+msgid "VTKViewer_ViewManager::PREF_RELATIVE_SIZE"
+msgstr "Relative size"
+
 msgid "MNU_SHOW_TRIHEDRON"
 msgstr "Show/Hide trihedron"
 
index 4d2c8b61331a99e081f52ee2111413d0df7931b9..2134863ee0a674378b99ecede4658174a0ba86bc 100644 (file)
         <source>VTK_VIEW_TITLE</source>
         <translation>VTK scene:%M - viewer:%V</translation>
     </message>
+    <message>
+        <source>PREF_GROUP_VTKVIEWER</source>
+        <translation>VTK Viewer 3d</translation>
+    </message>
+    <message>
+        <source>PREF_TRIHEDRON_SIZE</source>
+        <translation>Trihedron size</translation>
+    </message>
+    <message>
+        <source>PREF_VIEWER_BACKGROUND</source>
+        <translation>Background color</translation>
+    </message>
+    <message>
+        <source>PREF_RELATIVE_SIZE</source>
+        <translation>Relative size</translation>
+    </message>
 </context>
 <context>
     <name>VTKViewer_Viewer</name>