]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Issue 0020874: [CEA] Graduated axes in GEOM
authorouv <ouv@opencascade.com>
Thu, 30 Sep 2010 14:49:34 +0000 (14:49 +0000)
committerouv <ouv@opencascade.com>
Thu, 30 Sep 2010 14:49:34 +0000 (14:49 +0000)
41 files changed:
configure.ac
doc/salome/gui/images/graduatedaxes2.png [new file with mode: 0644]
doc/salome/gui/input/occ_3d_viewer.doc
src/LightApp/resources/LightApp.xml
src/Makefile.am
src/OCCViewer/Makefile.am
src/OCCViewer/OCCViewer_CubeAxesDlg.cxx [new file with mode: 0644]
src/OCCViewer/OCCViewer_CubeAxesDlg.h [new file with mode: 0644]
src/OCCViewer/OCCViewer_FontWidget.cxx [new file with mode: 0644]
src/OCCViewer/OCCViewer_FontWidget.h [new file with mode: 0644]
src/OCCViewer/OCCViewer_ViewModel.h
src/OCCViewer/OCCViewer_ViewWindow.cxx
src/OCCViewer/OCCViewer_ViewWindow.h
src/OCCViewer/resources/OCCViewer_images.ts
src/OCCViewer/resources/OCCViewer_msg_en.ts
src/OCCViewer/resources/occ_view_graduated_axes.png [new file with mode: 0755]
src/SVTK/Makefile.am
src/SVTK/SVTK_CubeAxesDlg.cxx
src/SVTK/SVTK_CubeAxesDlg.h
src/SVTK/SVTK_FontWidget.cxx
src/SVTK/SVTK_FontWidget.h
src/SVTK/SVTK_NonIsometricDlg.cxx
src/SVTK/SVTK_NonIsometricDlg.h
src/SVTK/SVTK_SetRotationPointDlg.cxx
src/SVTK/SVTK_SetRotationPointDlg.h
src/SVTK/SVTK_UpdateRateDlg.cxx
src/SVTK/SVTK_UpdateRateDlg.h
src/SVTK/SVTK_ViewParameterDlg.cxx
src/SVTK/SVTK_ViewParameterDlg.h
src/SVTK/SVTK_ViewWindow.cxx
src/SVTK/resources/SVTK_msg_en.ts
src/SalomeApp/resources/SalomeApp.xml
src/ViewerTools/Makefile.am [new file with mode: 0755]
src/ViewerTools/ViewerTools.h [new file with mode: 0644]
src/ViewerTools/ViewerTools_CubeAxesDlgBase.cxx [new file with mode: 0644]
src/ViewerTools/ViewerTools_CubeAxesDlgBase.h [new file with mode: 0644]
src/ViewerTools/ViewerTools_DialogBase.cxx [new file with mode: 0644]
src/ViewerTools/ViewerTools_DialogBase.h [new file with mode: 0644]
src/ViewerTools/ViewerTools_FontWidgetBase.cxx [new file with mode: 0644]
src/ViewerTools/ViewerTools_FontWidgetBase.h [new file with mode: 0644]
src/ViewerTools/resources/ViewerTools_msg_en.ts [new file with mode: 0644]

index bc7d43df9674fe19a4bf52e39171fce13817fab5..2ccf2effde7143094cbc987b8971428626325794 100644 (file)
@@ -625,6 +625,7 @@ AC_OUTPUT([ \
   src/ObjBrowser/Makefile \
   src/Prs/Makefile \
   src/OBJECT/Makefile \
+  src/ViewerTools/Makefile \
   src/GLViewer/Makefile \
   src/VTKViewer/Makefile \
   src/SVTK/Makefile \
diff --git a/doc/salome/gui/images/graduatedaxes2.png b/doc/salome/gui/images/graduatedaxes2.png
new file mode 100644 (file)
index 0000000..aa9dbf3
Binary files /dev/null and b/doc/salome/gui/images/graduatedaxes2.png differ
index dcadc8d28a7eef3dd1dc59b4192996768c27e993..5bd68e8862b50bc0f43889cecfe13e3b16dffde6 100644 (file)
@@ -126,6 +126,42 @@ viewer.</li>
 \image html occviewer_axialscale.png
 \n <center><b>Scaling</b> - represents objects deformed (stretched or
 stuffed) along the axes of coordinates.</center>
+<hr>
+
+\image html image109.png
+\n <center><b>Graduated axes</b> - allows to define parameters of axes
+and graduate them (available only with Open CASCADE 6.3 service pack 10)</center>
+
+\image html graduatedaxes2.png
+
+<ul>
+<li><b>Axis name</b></li>
+<ul>
+<li><b>Is visible</b> - if checked the axis name is displayed in the
+viewer.</li>
+<li><b>Name</b> - allows to redefine the name of the axis.</li>
+<li><b>Font</b> - allows to define color of the font of
+axis name.</li>
+</ul>
+<li><b>Labels</b></li>
+<ul>
+<li><b>Is visible</b> - if checked the labels are displayed in the
+viewer.</li>
+<li><b>Number</b> - allows to define the number of labels.</li>
+<li><b>Offset</b> - allows to define the distance between labels.</li>
+<li><b>Font</b> - allows to define color of the font of
+labels names.</li>
+</ul>
+<li><b>Tick marks</b></li>
+<ul>
+<li><b>Is visible</b> - if checked the tick marks are displayed in the
+viewer.</li>
+<li><b>Length</b> - allows to define the length of tick marks.</li>
+</ul>
+<li><b>Is visible</b> - if checked the axis is displayed in the
+viewer. </li>
+</ul>
+<hr>
 
 <b>Note!</b> OCC Viewer features a special <b>Polyline Selection</b> mechanism, which allows selecting an arbitraty part of the graphic area using a polygon frame, instead of the usual selection with a rectangular frame.
 
index bdfbfae045f04d8c2730dddeeee2809ecb1dd8a5..ba6c4c54e9f7eeb20b495270561e3fbad780f10f 100644 (file)
@@ -60,6 +60,7 @@
     <parameter name="Style"        value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
     <parameter name="SUIT"         value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
     <parameter name="STD"          value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
+    <parameter name="ViewerTools"  value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
     <parameter name="Plot2d"       value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
     <parameter name="SPlot2d"      value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
     <parameter name="GLViewer"     value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
index 8b684ec2e7983a747b0fde954d9b6157b4e974a8..7d4de20d23a97789ba92be777a3c7f18ea2f2842 100755 (executable)
@@ -49,6 +49,7 @@ if ENABLE_VTKVIEWER
   SUBDIRS_VTKVIEWER = VTKViewer
 if ENABLE_SALOMEOBJECT
     SUBDIRS_VTKVIEWER += SVTK
+    SUBDIRS_VIEWERTOOLS = ViewerTools
 endif
 endif
 
@@ -57,6 +58,7 @@ endif
 ##
 if ENABLE_OCCVIEWER
   SUBDIRS_OCCVIEWER = OCCViewer
+  SUBDIRS_VIEWERTOOLS = ViewerTools
 if ENABLE_SALOMEOBJECT
     SUBDIRS_OCCVIEWER += SOCC
 endif
@@ -114,10 +116,10 @@ if ENABLE_PYCONSOLE
   SUBDIRS_PY_LIGHT = SALOME_SWIG SALOME_PY SALOME_PYQT
 endif
 
-SUBDIRS = $(SUBDIRS_COMMON) $(SUBDIRS_OBJECT) $(SUBDIRS_GLVIEWER) $(SUBDIRS_VTKVIEWER) $(SUBDIRS_OCCVIEWER)  \
-          $(SUBDIRS_PLOT2DVIEWER) $(SUBDIRS_SUPERVGRAPHVIEWER) $(SUBDIRS_QXGRAPHVIEWER) $(SUBDIRS_PYCONSOLE) \
-          $(SUBDIRS_LIGHT) $(SUBDIRS_CORBA) $(SUBDIRS_PY_LIGHT)
+SUBDIRS = $(SUBDIRS_COMMON) $(SUBDIRS_OBJECT) $(SUBDIRS_VIEWERTOOLS) $(SUBDIRS_GLVIEWER) $(SUBDIRS_VTKVIEWER) \
+          $(SUBDIRS_OCCVIEWER) $(SUBDIRS_PLOT2DVIEWER) $(SUBDIRS_SUPERVGRAPHVIEWER) $(SUBDIRS_QXGRAPHVIEWER) \
+          $(SUBDIRS_PYCONSOLE) $(SUBDIRS_LIGHT) $(SUBDIRS_CORBA) $(SUBDIRS_PY_LIGHT)
 
 DIST_SUBDIRS = CASCatch Qtx Style DDS QDS ObjBrowser SUIT SUITApp STD CAF CAM LogWindow Prs Event OpenGLUtils \
-               OBJECT GLViewer VTKViewer SVTK OCCViewer SOCC Plot2d SPlot2d SUPERVGraph QxGraph QxScene \
+               OBJECT ViewerTools GLViewer VTKViewer SVTK OCCViewer SOCC Plot2d SPlot2d SUPERVGraph QxGraph QxScene \
                PyInterp PyConsole LightApp ResExporter TOOLSGUI Session SalomeApp SALOME_SWIG SALOME_PY SALOME_PYQT
index a9ab7c7c7a7f64cecb415d730a85708f0ead7b00..4d56e731b0ce9afc015ca386115c0bc02f08dd8b 100755 (executable)
@@ -44,6 +44,8 @@ salomeinclude_HEADERS =                               \
        OCCViewer_AxialScaleDlg.h               \
        OCCViewer_SetRotationPointDlg.h         \
        OCCViewer_Trihedron.h                   \
+       OCCViewer_FontWidget.h                  \
+       OCCViewer_CubeAxesDlg.h                 \
        OCCViewer_ToolTip.h
 
 dist_libOCCViewer_la_SOURCES =                 \
@@ -60,6 +62,8 @@ dist_libOCCViewer_la_SOURCES =                        \
        OCCViewer_ClippingDlg.cxx               \
        OCCViewer_AxialScaleDlg.cxx             \
        OCCViewer_Trihedron.cxx                 \
+       OCCViewer_FontWidget.cxx                \
+       OCCViewer_CubeAxesDlg.cxx               \
        OCCViewer_ToolTip.cxx
 
 MOC_FILES =                                    \
@@ -74,8 +78,10 @@ MOC_FILES =                                  \
        OCCViewer_SetRotationPointDlg_moc.cxx   \
        OCCViewer_ClippingDlg_moc.cxx           \
        OCCViewer_AxialScaleDlg_moc.cxx         \
+       OCCViewer_FontWidget_moc.cxx            \
+       OCCViewer_CubeAxesDlg_moc.cxx           \
        OCCViewer_ToolTip_moc.cxx
-       
+
 nodist_libOCCViewer_la_SOURCES = $(MOC_FILES)
 
 dist_salomeres_DATA =                          \
@@ -86,6 +92,7 @@ dist_salomeres_DATA =                         \
        resources/occ_view_clipping.png         \
        resources/occ_view_clipping_pressed.png \
        resources/occ_view_scaling.png          \
+       resources/occ_view_graduated_axes.png   \
        resources/occ_view_ambient.png          \
        resources/occ_view_fitall.png           \
        resources/occ_view_fitarea.png          \
@@ -109,7 +116,9 @@ nodist_salomeres_DATA =             \
        OCCViewer_msg_fr.qm 
 
 libOCCViewer_la_CPPFLAGS = $(QT_INCLUDES) $(OGL_INCLUDES) $(CAS_CPPFLAGS) \
-       -I$(srcdir)/../SUIT -I$(srcdir)/../Qtx -I$(srcdir)/../OpenGLUtils
+       -I$(srcdir)/../SUIT -I$(srcdir)/../ViewerTools -I$(srcdir)/../Qtx \
+       -I$(srcdir)/../OpenGLUtils
 
 libOCCViewer_la_LDFLAGS  = $(OGL_LIBS) $(QT_MT_LIBS) $(CAS_KERNEL) $(CAS_VIEWER)
-libOCCViewer_la_LIBADD   = ../Qtx/libqtx.la ../SUIT/libsuit.la ../OpenGLUtils/libOpenGLUtils.la
+libOCCViewer_la_LIBADD   = ../Qtx/libqtx.la ../SUIT/libsuit.la \
+       ../ViewerTools/libViewerTools.la ../OpenGLUtils/libOpenGLUtils.la
diff --git a/src/OCCViewer/OCCViewer_CubeAxesDlg.cxx b/src/OCCViewer/OCCViewer_CubeAxesDlg.cxx
new file mode 100644 (file)
index 0000000..198b0f5
--- /dev/null
@@ -0,0 +1,321 @@
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  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 "OCCViewer_CubeAxesDlg.h"
+
+#include "OCCViewer_FontWidget.h"
+#include "OCCViewer_ViewPort3d.h"
+#include "OCCViewer_ViewWindow.h"
+
+#include "QtxAction.h"
+#include "QtxIntSpinBox.h"
+
+#include <QCheckBox>
+#include <QGroupBox>
+#include <QLineEdit>
+
+#include <Standard_Version.hxx>
+
+#ifdef OCC_VERSION_SERVICEPACK
+#define OCC_VERSION_LARGE (OCC_VERSION_MAJOR << 24 | OCC_VERSION_MINOR << 16 | OCC_VERSION_MAINTENANCE << 8 | OCC_VERSION_SERVICEPACK)
+#else
+#define OCC_VERSION_LARGE (OCC_VERSION_MAJOR << 24 | OCC_VERSION_MINOR << 16 | OCC_VERSION_MAINTENANCE << 8)
+#endif
+
+/*!
+  \class OCCViewer_CubeAxesDlg::AxisWidget
+  \brief Axis tab widget of the "Graduated axis" dialog box
+  \internal
+*/
+
+/*!
+  Constructor
+*/
+OCCViewer_AxisWidget::OCCViewer_AxisWidget (QWidget* theParent)
+: ViewerTools_AxisWidgetBase(theParent)
+{
+}
+
+/*!
+  Destructor
+*/
+OCCViewer_AxisWidget::~OCCViewer_AxisWidget()
+{
+}
+
+/*!
+  Create font widget
+*/
+ViewerTools_FontWidgetBase* OCCViewer_AxisWidget::createFontWidget( QWidget* theParent )
+{
+  OCCViewer_FontWidget* aFontWidget = new OCCViewer_FontWidget( theParent );
+  aFontWidget->Initialize();
+  return aFontWidget;
+}
+
+/*!
+  Set axis data
+*/
+void OCCViewer_AxisWidget::SetData( const AxisData& theAxisData )
+{
+  myNameGrp->setChecked( theAxisData.DrawName );
+  myAxisName->setText( theAxisData.Name );
+  myNameFont->SetData( theAxisData.NameColor, 0, false, false, false );
+
+  myLabelsGrp->setChecked( theAxisData.DrawValues );
+  myLabelNumber->setValue( theAxisData.NbValues );
+  myLabelOffset->setValue( theAxisData.Offset );
+  myLabelsFont->SetData( theAxisData.Color, 0, false, false, false );
+
+  myTicksGrp->setChecked( theAxisData.DrawTickmarks );
+  myTickLength->setValue( theAxisData.TickmarkLength );
+}
+
+/*!
+  Get axis data
+*/
+void OCCViewer_AxisWidget::GetData( AxisData& theAxisData )
+{
+  theAxisData.DrawName = myNameGrp->isChecked();
+  theAxisData.Name = myAxisName->text();
+
+  int aNameFamily;
+  bool aNameBold, aNameItalic, aNameShadow;
+  myNameFont->GetData( theAxisData.NameColor, aNameFamily, aNameBold, aNameItalic, aNameShadow );
+
+  theAxisData.DrawValues = myLabelsGrp->isChecked();
+  theAxisData.NbValues = myLabelNumber->value();
+  theAxisData.Offset = myLabelOffset->value();
+
+  int aLabelFamily;
+  bool aLabelBold, aLabelItalic, aLabelShadow;
+  myLabelsFont->GetData( theAxisData.Color, aLabelFamily, aLabelBold, aLabelItalic, aLabelShadow );
+
+  theAxisData.DrawTickmarks = myTicksGrp->isChecked();
+  theAxisData.TickmarkLength = myTickLength->value();
+}
+
+/*
+  Class       : OCCViewer_CubeAxesDlg
+  Description : Dialog for specifying cube axes properties
+*/
+
+/*!
+  Constructor
+*/
+OCCViewer_CubeAxesDlg::OCCViewer_CubeAxesDlg(QtxAction* theAction,
+                                             OCCViewer_ViewWindow* theParent,
+                                             const char* theName):
+  ViewerTools_CubeAxesDlgBase(theAction,
+                              theParent, 
+                              theName),
+  myMainWindow(theParent)
+{
+}
+
+/*!
+  Destructor
+*/
+OCCViewer_CubeAxesDlg::~OCCViewer_CubeAxesDlg()
+{
+}
+
+/*!
+  Create axis widget
+*/
+ViewerTools_AxisWidgetBase* OCCViewer_CubeAxesDlg::createAxisWidget( QWidget* theParent )
+{
+  OCCViewer_AxisWidget* anAxisWidget = new OCCViewer_AxisWidget( theParent );
+  anAxisWidget->initialize();
+  return anAxisWidget;
+}
+
+/*!
+  Update dialog fields, connect signals and slots, show dialog
+*/
+void OCCViewer_CubeAxesDlg::initialize()
+{
+  ViewerTools_CubeAxesDlgBase::initialize();
+
+  for( int i = 0; i < 3; i++ )
+  {
+    if( OCCViewer_AxisWidget* anAxisWidget = dynamic_cast<OCCViewer_AxisWidget*>( myAxes[ i ] ) )
+    {
+      OCCViewer_AxisWidget::AxisData anAxisData;
+      switch( i )
+      {
+        case 0:
+          anAxisData.Name = "X";
+          anAxisData.NameColor = anAxisData.Color = Qt::red;
+          break;
+        case 1:
+          anAxisData.Name = "Y";
+          anAxisData.NameColor = anAxisData.Color = Qt::green;
+          break;
+        case 2:
+          anAxisData.Name = "Z";
+          anAxisData.NameColor = anAxisData.Color = Qt::blue;
+          break;
+      }
+      anAxisData.DrawName       = true;
+      anAxisData.DrawValues     = true;
+      anAxisData.NbValues       = 3;
+      anAxisData.Offset         = 2;
+      anAxisData.DrawTickmarks  = true;
+      anAxisData.TickmarkLength = 5;
+      anAxisWidget->SetData( anAxisData );
+    }
+  }
+}
+
+/*!
+  Update dialog fields, connect signals and slots, show dialog
+*/
+void OCCViewer_CubeAxesDlg::Update()
+{
+  ViewerTools_CubeAxesDlgBase::Update();
+}
+
+/*!
+  Verify validity of entry data
+*/
+bool OCCViewer_CubeAxesDlg::onApply()
+{
+  bool isOk = ViewerTools_CubeAxesDlgBase::onApply();
+
+  try
+  {
+    QWidget *aCurrWid = this->focusWidget();
+    aCurrWid->clearFocus();
+    aCurrWid->setFocus();
+
+    if( OCCViewer_ViewPort3d* aViewPort = myMainWindow->getViewPort() )
+    {
+      Handle(V3d_View) aView = aViewPort->getView();
+      if( !aView.IsNull() )
+        ApplyData( aView );
+    }
+  }
+  catch(...)
+  {
+    isOk = false;
+  }
+
+  return isOk;
+}
+
+/*!
+  Get graduated trihedron parameters
+*/
+void OCCViewer_CubeAxesDlg::GetData( bool& theIsVisible, OCCViewer_AxisWidget::AxisData theAxisData[3] )
+{
+  theIsVisible = myIsVisible->isChecked();
+  for( int i = 0; i < 3; i++ )
+    if( OCCViewer_AxisWidget* anAxisWidget = dynamic_cast<OCCViewer_AxisWidget*>( myAxes[ i ] ) )
+      anAxisWidget->GetData( theAxisData[i] );
+}
+
+/*!
+  Set graduated trihedron parameters
+*/
+void OCCViewer_CubeAxesDlg::SetData( bool theIsVisible, OCCViewer_AxisWidget::AxisData theAxisData[3] )
+{
+  myIsVisible->setChecked( theIsVisible );
+  for( int i = 0; i < 3; i++ )
+    if( OCCViewer_AxisWidget* anAxisWidget = dynamic_cast<OCCViewer_AxisWidget*>( myAxes[ i ] ) )
+      anAxisWidget->SetData( theAxisData[i] );
+}
+
+/*!
+  Apply graduated trihedron parameters
+*/
+void OCCViewer_CubeAxesDlg::ApplyData( const Handle(V3d_View)& theView )
+{
+#if OCC_VERSION_LARGE > 0x06030009 // available only with OCC-6.3-sp10 and higher version
+  if( theView.IsNull() )
+    return;
+
+  if( myIsVisible->isChecked() )
+  {
+    OCCViewer_AxisWidget::AxisData anAxisData[3];
+    for( int i = 0; i < 3; i++ )
+      if( OCCViewer_AxisWidget* anAxisWidget = dynamic_cast<OCCViewer_AxisWidget*>( myAxes[ i ] ) )
+        anAxisWidget->GetData( anAxisData[i] );
+
+    theView->GraduatedTrihedronDisplay(
+      anAxisData[0].Name.toLatin1().constData(),
+      anAxisData[1].Name.toLatin1().constData(),
+      anAxisData[2].Name.toLatin1().constData(),
+      anAxisData[0].DrawName,
+      anAxisData[1].DrawName,
+      anAxisData[2].DrawName,
+      anAxisData[0].DrawValues,
+      anAxisData[1].DrawValues,
+      anAxisData[2].DrawValues,
+      Standard_True, // draw grid
+      anAxisData[0].NbValues - 1,
+      anAxisData[1].NbValues - 1,
+      anAxisData[2].NbValues - 1,
+      anAxisData[0].Offset,
+      anAxisData[1].Offset,
+      anAxisData[2].Offset,
+      anAxisData[0].Offset + 20, // tmp
+      anAxisData[1].Offset + 20, // tmp
+      anAxisData[2].Offset + 20, // tmp
+      anAxisData[0].DrawTickmarks,
+      anAxisData[1].DrawTickmarks,
+      anAxisData[2].DrawTickmarks,
+      anAxisData[0].TickmarkLength,
+      anAxisData[1].TickmarkLength,
+      anAxisData[2].TickmarkLength,
+      Quantity_NOC_WHITE, // grid color
+      Quantity_Color( anAxisData[0].NameColor.redF(),
+                      anAxisData[0].NameColor.greenF(),
+                      anAxisData[0].NameColor.blueF(),
+                      Quantity_TOC_RGB ),
+      Quantity_Color( anAxisData[1].NameColor.redF(),
+                      anAxisData[1].NameColor.greenF(),
+                      anAxisData[1].NameColor.blueF(),
+                      Quantity_TOC_RGB ),
+      Quantity_Color( anAxisData[2].NameColor.redF(),
+                      anAxisData[2].NameColor.greenF(),
+                      anAxisData[2].NameColor.blueF(),
+                      Quantity_TOC_RGB ),
+      Quantity_Color( anAxisData[0].Color.redF(),
+                      anAxisData[0].Color.greenF(),
+                      anAxisData[0].Color.blueF(),
+                      Quantity_TOC_RGB ),
+      Quantity_Color( anAxisData[1].Color.redF(),
+                      anAxisData[1].Color.greenF(),
+                      anAxisData[1].Color.blueF(),
+                      Quantity_TOC_RGB ),
+      Quantity_Color( anAxisData[2].Color.redF(),
+                      anAxisData[2].Color.greenF(),
+                      anAxisData[2].Color.blueF(),
+                      Quantity_TOC_RGB ) );
+  }
+  else
+    theView->GraduatedTrihedronErase();
+
+  theView->Redraw();
+#endif
+}
diff --git a/src/OCCViewer/OCCViewer_CubeAxesDlg.h b/src/OCCViewer/OCCViewer_CubeAxesDlg.h
new file mode 100644 (file)
index 0000000..b570d38
--- /dev/null
@@ -0,0 +1,99 @@
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  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 OCCVIEWER_CUBEAXESDLG_H
+#define OCCVIEWER_CUBEAXESDLG_H
+
+#include "OCCViewer.h"
+
+#include <ViewerTools_CubeAxesDlgBase.h>
+
+#include <V3d_View.hxx>
+
+class OCCViewer_ViewWindow;
+
+/*!
+ * Class       : OCCViewer_AxisWidget
+ * Description : Axis tab widget of the "Graduated axis" dialog box
+*/
+class OCCVIEWER_EXPORT OCCViewer_AxisWidget : public ViewerTools_AxisWidgetBase
+{
+public:
+  struct AxisData
+  {
+    bool    DrawName;
+    QString Name;
+    QColor  NameColor;
+    bool    DrawValues;
+    int     NbValues;
+    int     Offset;
+    QColor  Color;
+    bool    DrawTickmarks;
+    int     TickmarkLength;
+  };
+
+public:
+  OCCViewer_AxisWidget( QWidget* );
+  ~OCCViewer_AxisWidget();
+
+public:
+  void             SetData( const AxisData& );
+  void             GetData( AxisData& );
+
+protected:
+  virtual ViewerTools_FontWidgetBase* createFontWidget( QWidget* );
+};
+
+/*!
+ * Class       : OCCViewer_CubeAxesDlg
+ * Description : Dialog for specifynig cube axes properties
+ */
+class OCCVIEWER_EXPORT OCCViewer_CubeAxesDlg : public ViewerTools_CubeAxesDlgBase
+{
+  Q_OBJECT
+
+public:
+                  OCCViewer_CubeAxesDlg(QtxAction* theAction,
+                                        OCCViewer_ViewWindow* theParent,
+                                        const char* theName);
+  virtual         ~OCCViewer_CubeAxesDlg();
+
+  virtual void    initialize();
+
+  void            GetData( bool& theIsVisible, OCCViewer_AxisWidget::AxisData theAxisData[3] );
+  void            SetData( bool theIsVisible, OCCViewer_AxisWidget::AxisData theAxisData[3] );
+
+  void            ApplyData( const Handle(V3d_View)& theView );
+
+  virtual void    Update();
+
+private slots:
+  virtual bool    onApply();
+
+private:
+  virtual ViewerTools_AxisWidgetBase* createAxisWidget( QWidget* );
+
+private:
+  OCCViewer_ViewWindow* myMainWindow;
+};
+
+#endif
diff --git a/src/OCCViewer/OCCViewer_FontWidget.cxx b/src/OCCViewer/OCCViewer_FontWidget.cxx
new file mode 100644 (file)
index 0000000..d0a61ae
--- /dev/null
@@ -0,0 +1,99 @@
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  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 "OCCViewer_FontWidget.h"
+
+#include <QComboBox>
+
+//#include <vtkTextProperty.h>
+
+/*!
+ * Class       : OCCViewer_FontWidget
+ * Description : Dialog for specifynig font
+ */
+
+/*!
+  Constructor
+*/
+OCCViewer_FontWidget::OCCViewer_FontWidget( QWidget* theParent )
+: ViewerTools_FontWidgetBase( theParent )
+{
+}
+
+/*!
+  Destructor
+*/
+OCCViewer_FontWidget::~OCCViewer_FontWidget()
+{
+}
+
+void OCCViewer_FontWidget::InitializeFamilies()
+{
+  //myFamily->insertItem( myFamily->count(), tr( "ARIAL" ) );
+  //myFamily->insertItem( myFamily->count(), tr( "COURIER" ) );
+  //myFamily->insertItem( myFamily->count(), tr( "TIMES" ) );
+}
+
+void OCCViewer_FontWidget::SetData( const QColor& theColor,
+                                    const int theFamily,
+                                    const bool theBold,
+                                    const bool theItalic,
+                                    const bool theShadow )
+{
+  ViewerTools_FontWidgetBase::SetData( theColor,
+                                       theFamily,
+                                       theBold,
+                                       theItalic,
+                                       theShadow );
+
+  /*
+  if ( theFamily == VTK_ARIAL )
+    myFamily->setCurrentIndex( 0 );
+  else if ( theFamily == VTK_COURIER )
+    myFamily->setCurrentIndex( 1 );
+  else
+    myFamily->setCurrentIndex( 2 );
+  */
+}
+
+void OCCViewer_FontWidget::GetData( QColor& theColor,
+                                    int& theFamily,
+                                    bool& theBold,
+                                    bool& theItalic,
+                                    bool& theShadow ) const
+{
+  ViewerTools_FontWidgetBase::GetData( theColor,
+                                       theFamily,
+                                       theBold,
+                                       theItalic,
+                                       theShadow );
+
+  /*
+  int anItem = myFamily->currentIndex();
+  if ( anItem == 0 )
+    theFamily = VTK_ARIAL;
+  else if ( anItem == 1 )
+    theFamily = VTK_COURIER;
+  else
+    theFamily = VTK_TIMES;
+  */
+}
diff --git a/src/OCCViewer/OCCViewer_FontWidget.h b/src/OCCViewer/OCCViewer_FontWidget.h
new file mode 100644 (file)
index 0000000..506d583
--- /dev/null
@@ -0,0 +1,50 @@
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  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 OCCVIEWER_FONTWIDGET_H
+#define OCCVIEWER_FONTWIDGET_H
+
+#include "OCCViewer.h"
+
+#include <ViewerTools_FontWidgetBase.h>
+
+/*!
+ * Class       : OCCViewer_FontWidget
+ * Description : Dialog for specifynig font
+ */
+class OCCVIEWER_EXPORT OCCViewer_FontWidget : public ViewerTools_FontWidgetBase
+{
+  Q_OBJECT
+
+public:
+                OCCViewer_FontWidget( QWidget* );
+  virtual       ~OCCViewer_FontWidget();
+
+  virtual void  SetData( const QColor&, const int, const bool, const bool, const bool );
+
+  virtual void  GetData( QColor&, int&, bool&, bool&, bool& ) const;
+
+protected:
+  virtual void  InitializeFamilies();
+};
+
+#endif
index 925b2dc05d7aa1e4e481eaaa0c4d56f8f162979a..fc0463e79e91c73f27af2f1f25f4dfa6a13c6b9a 100755 (executable)
@@ -65,6 +65,47 @@ public:
         QString    name;
         bool     isVisible;
         double   size;
+        // graduated trihedron
+        bool    gtIsVisible;
+        bool    gtDrawNameX;
+        bool    gtDrawNameY;
+        bool    gtDrawNameZ;
+        QString gtNameX;
+        QString gtNameY;
+        QString gtNameZ;
+        int     gtNameColorRX;
+        int     gtNameColorGX;
+        int     gtNameColorBX;
+        int     gtNameColorRY;
+        int     gtNameColorGY;
+        int     gtNameColorBY;
+        int     gtNameColorRZ;
+        int     gtNameColorGZ;
+        int     gtNameColorBZ;
+        bool    gtDrawValuesX;
+        bool    gtDrawValuesY;
+        bool    gtDrawValuesZ;
+        int     gtNbValuesX;
+        int     gtNbValuesY;
+        int     gtNbValuesZ;
+        int     gtOffsetX;
+        int     gtOffsetY;
+        int     gtOffsetZ;
+        int     gtColorRX;
+        int     gtColorGX;
+        int     gtColorBX;
+        int     gtColorRY;
+        int     gtColorGY;
+        int     gtColorBY;
+        int     gtColorRZ;
+        int     gtColorGZ;
+        int     gtColorBZ;
+        bool    gtDrawTickmarksX;
+        bool    gtDrawTickmarksY;
+        bool    gtDrawTickmarksZ;
+        int     gtTickmarkLengthX;
+        int     gtTickmarkLengthY;
+        int     gtTickmarkLengthZ;
 };
 
 typedef QList<viewAspect> viewAspectList;
index fd0992fbaef6f84cdd1a9ea6f23a49b302eca9ed..9ac36b842bf55dc9804d27b3d0d34098a3ea7d62 100755 (executable)
@@ -32,6 +32,7 @@
 #include "OCCViewer_ClippingDlg.h"
 #include "OCCViewer_SetRotationPointDlg.h"
 #include "OCCViewer_AxialScaleDlg.h"
+#include "OCCViewer_CubeAxesDlg.h"
 
 #include <SUIT_Desktop.h>
 #include <SUIT_Session.h>
 #include <Graphic3d_Structure.hxx>
 #include <Graphic3d_ExportFormat.hxx>
 
+#include <Standard_Version.hxx>
+
+#ifdef OCC_VERSION_SERVICEPACK
+#define OCC_VERSION_LARGE (OCC_VERSION_MAJOR << 24 | OCC_VERSION_MINOR << 16 | OCC_VERSION_MAINTENANCE << 8 | OCC_VERSION_SERVICEPACK)
+#else
+#define OCC_VERSION_LARGE (OCC_VERSION_MAJOR << 24 | OCC_VERSION_MINOR << 16 | OCC_VERSION_MAINTENANCE << 8)
+#endif
+
 static QEvent* l_mbPressEvent = 0;
 
 #ifdef WIN32
@@ -250,6 +259,11 @@ void OCCViewer_ViewWindow::initLayout()
 
   createActions();
   createToolBar();
+
+  // Graduated axes dialog
+  QtxAction* anAction = dynamic_cast<QtxAction*>( toolMgr()->action( GraduatedAxesId ) );
+  myCubeAxesDlg = new OCCViewer_CubeAxesDlg( anAction, this, "OCCViewer_CubeAxesDlg" );
+  myCubeAxesDlg->initialize();
 }
 
 /*!
@@ -1131,6 +1145,13 @@ void OCCViewer_ViewWindow::createActions()
   connect(aAction, SIGNAL(triggered()), this, SLOT(onAxialScale()));
   toolMgr()->registerAction( aAction, AxialScaleId );
 
+  // Graduated axes 
+  aAction = new QtxAction(tr("MNU_GRADUATED_AXES"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_GRADUATED_AXES" ) ),
+                           tr( "MNU_GRADUATED_AXES" ), 0, this);
+  aAction->setStatusTip(tr("DSC_GRADUATED_AXES"));
+  connect(aAction, SIGNAL(triggered()), this, SLOT(onGraduatedAxes()));
+  toolMgr()->registerAction( aAction, GraduatedAxesId );
+
   // Active only ambient light or not
   aAction = new QtxAction(tr("MNU_AMBIENT"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_AMBIENT" ) ),
                            tr( "MNU_AMBIENT" ), 0, this);
@@ -1195,6 +1216,9 @@ void OCCViewer_ViewWindow::createToolBar()
   toolMgr()->append( toolMgr()->separator(), tid );
   toolMgr()->append( ClippingId, tid );
   toolMgr()->append( AxialScaleId, tid );
+#if OCC_VERSION_LARGE > 0x06030009 // available only with OCC-6.3-sp10 and higher version
+  toolMgr()->append( GraduatedAxesId, tid );
+#endif
   toolMgr()->append( AmbientId, tid );
 }
 
@@ -1394,6 +1418,15 @@ void OCCViewer_ViewWindow::onAxialScale()
     myScalingDlg->show();
 }
 
+/*!
+  Shows Graduated Axes dialog
+*/
+void OCCViewer_ViewWindow::onGraduatedAxes()
+{
+  myCubeAxesDlg->Update();
+  myCubeAxesDlg->show();
+}
+
 void OCCViewer_ViewWindow::onAmbientToogle()
 {
   Handle(V3d_Viewer) viewer = myViewPort->getViewer();
@@ -1453,6 +1486,54 @@ void OCCViewer_ViewWindow::performRestoring( const viewAspect& anItem )
   myModel->setTrihedronShown( anItem.isVisible );
   myModel->setTrihedronSize( anItem.size );
         
+#if OCC_VERSION_LARGE > 0x06030009 // available only with OCC-6.3-sp10 and higher version
+  // graduated trihedron
+  bool anIsVisible = anItem.gtIsVisible;
+  OCCViewer_AxisWidget::AxisData anAxisData[3];
+  anAxisData[0].DrawName = anItem.gtDrawNameX;
+  anAxisData[1].DrawName = anItem.gtDrawNameZ;
+  anAxisData[2].DrawName = anItem.gtDrawNameZ;
+  anAxisData[0].Name = anItem.gtNameX;
+  anAxisData[1].Name = anItem.gtNameZ;
+  anAxisData[2].Name = anItem.gtNameZ;
+  anAxisData[0].NameColor = QColor( anItem.gtNameColorRX,
+                                    anItem.gtNameColorGX,
+                                    anItem.gtNameColorBX );
+  anAxisData[1].NameColor = QColor( anItem.gtNameColorRY,
+                                    anItem.gtNameColorGY,
+                                    anItem.gtNameColorBY );
+  anAxisData[2].NameColor = QColor( anItem.gtNameColorRZ,
+                                    anItem.gtNameColorGZ,
+                                    anItem.gtNameColorBZ );
+  anAxisData[0].DrawValues = anItem.gtDrawValuesX;
+  anAxisData[1].DrawValues = anItem.gtDrawValuesY;
+  anAxisData[2].DrawValues = anItem.gtDrawValuesZ;
+  anAxisData[0].NbValues = anItem.gtNbValuesX;
+  anAxisData[1].NbValues = anItem.gtNbValuesY;
+  anAxisData[2].NbValues = anItem.gtNbValuesZ;
+  anAxisData[0].Offset = anItem.gtOffsetX;
+  anAxisData[1].Offset = anItem.gtOffsetY;
+  anAxisData[2].Offset = anItem.gtOffsetZ;
+  anAxisData[0].Color = QColor( anItem.gtColorRX,
+                                anItem.gtColorGX,
+                                anItem.gtColorBX );
+  anAxisData[1].Color = QColor( anItem.gtColorRY,
+                                anItem.gtColorGY,
+                                anItem.gtColorBY );
+  anAxisData[2].Color = QColor( anItem.gtColorRZ,
+                                anItem.gtColorGZ,
+                                anItem.gtColorBZ );
+  anAxisData[0].DrawTickmarks = anItem.gtDrawTickmarksX;
+  anAxisData[1].DrawTickmarks = anItem.gtDrawTickmarksY;
+  anAxisData[2].DrawTickmarks = anItem.gtDrawTickmarksZ;
+  anAxisData[0].TickmarkLength = anItem.gtTickmarkLengthX;
+  anAxisData[1].TickmarkLength = anItem.gtTickmarkLengthY;
+  anAxisData[2].TickmarkLength = anItem.gtTickmarkLengthZ;
+
+  myCubeAxesDlg->SetData( anIsVisible, anAxisData );
+  myCubeAxesDlg->ApplyData( aView3d );
+#endif
+
   myRestoreFlag = 0;
 }
 
@@ -1681,6 +1762,54 @@ viewAspect OCCViewer_ViewWindow::getViewParams() const
   params.isVisible= isShown;
   params.size     = size;
 
+#if OCC_VERSION_LARGE > 0x06030009 // available only with OCC-6.3-sp10 and higher version
+  // graduated trihedron
+  bool anIsVisible = false;
+  OCCViewer_AxisWidget::AxisData anAxisData[3];
+  myCubeAxesDlg->GetData( anIsVisible, anAxisData );
+
+  params.gtIsVisible = anIsVisible;
+  params.gtDrawNameX = anAxisData[0].DrawName;
+  params.gtDrawNameY = anAxisData[1].DrawName;
+  params.gtDrawNameZ = anAxisData[2].DrawName;
+  params.gtNameX = anAxisData[0].Name;
+  params.gtNameY = anAxisData[1].Name;
+  params.gtNameZ = anAxisData[2].Name;
+  params.gtNameColorRX = anAxisData[0].NameColor.red();
+  params.gtNameColorGX = anAxisData[0].NameColor.green();
+  params.gtNameColorBX = anAxisData[0].NameColor.blue();
+  params.gtNameColorRY = anAxisData[1].NameColor.red();
+  params.gtNameColorGY = anAxisData[1].NameColor.green();
+  params.gtNameColorBY = anAxisData[1].NameColor.blue();
+  params.gtNameColorRZ = anAxisData[2].NameColor.red();
+  params.gtNameColorGZ = anAxisData[2].NameColor.green();
+  params.gtNameColorBZ = anAxisData[2].NameColor.blue();
+  params.gtDrawValuesX = anAxisData[0].DrawValues;
+  params.gtDrawValuesY = anAxisData[1].DrawValues;
+  params.gtDrawValuesZ = anAxisData[2].DrawValues;
+  params.gtNbValuesX = anAxisData[0].NbValues;
+  params.gtNbValuesY = anAxisData[1].NbValues;
+  params.gtNbValuesZ = anAxisData[2].NbValues;
+  params.gtOffsetX = anAxisData[0].Offset;
+  params.gtOffsetY = anAxisData[1].Offset;
+  params.gtOffsetZ = anAxisData[2].Offset;
+  params.gtColorRX = anAxisData[0].Color.red();
+  params.gtColorGX = anAxisData[0].Color.green();
+  params.gtColorBX = anAxisData[0].Color.blue();
+  params.gtColorRY = anAxisData[1].Color.red();
+  params.gtColorGY = anAxisData[1].Color.green();
+  params.gtColorBY = anAxisData[1].Color.blue();
+  params.gtColorRZ = anAxisData[2].Color.red();
+  params.gtColorGZ = anAxisData[2].Color.green();
+  params.gtColorBZ = anAxisData[2].Color.blue();
+  params.gtDrawTickmarksX = anAxisData[0].DrawTickmarks;
+  params.gtDrawTickmarksY = anAxisData[1].DrawTickmarks;
+  params.gtDrawTickmarksZ = anAxisData[2].DrawTickmarks;
+  params.gtTickmarkLengthX = anAxisData[0].TickmarkLength;
+  params.gtTickmarkLengthY = anAxisData[1].TickmarkLength;
+  params.gtTickmarkLengthZ = anAxisData[2].TickmarkLength;
+#endif
+
   return params;
 }
 
@@ -1693,11 +1822,71 @@ 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 );
-  retStr += QString().sprintf("*%u*%.2f", params.isVisible, params.size );
+
+  retStr += QString().sprintf( "scale=%.12e*", params.scale );
+  retStr += QString().sprintf( "centerX=%.12e*", params.centerX );
+  retStr += QString().sprintf( "centerY=%.12e*", params.centerY );
+  retStr += QString().sprintf( "projX=%.12e*", params.projX );
+  retStr += QString().sprintf( "projY=%.12e*", params.projY );
+  retStr += QString().sprintf( "projZ=%.12e*", params.projZ );
+  retStr += QString().sprintf( "twist=%.12e*", params.twist );
+  retStr += QString().sprintf( "atX=%.12e*", params.atX );
+  retStr += QString().sprintf( "atY=%.12e*", params.atY );
+  retStr += QString().sprintf( "atZ=%.12e*", params.atZ );
+  retStr += QString().sprintf( "eyeX=%.12e*", params.eyeX );
+  retStr += QString().sprintf( "eyeY=%.12e*", params.eyeY );
+  retStr += QString().sprintf( "eyeZ=%.12e*", params.eyeZ );
+  retStr += QString().sprintf( "scaleX=%.12e*", params.scaleX );
+  retStr += QString().sprintf( "scaleY=%.12e*", params.scaleY );
+  retStr += QString().sprintf( "scaleZ=%.12e*", params.scaleZ );
+
+  retStr += QString().sprintf( "isVisible=%.u*", params.isVisible );
+  retStr += QString().sprintf( "size=%.2f", params.size );
+
+#if OCC_VERSION_LARGE > 0x06030009 // available only with OCC-6.3-sp10 and higher version
+  // graduated trihedron
+  retStr += QString().sprintf( "*gtIsVisible=%u*", params.gtIsVisible );
+  retStr += QString().sprintf( "gtDrawNameX=%u*", params.gtDrawNameX );
+  retStr += QString().sprintf( "gtDrawNameY=%u*", params.gtDrawNameY );
+  retStr += QString().sprintf( "gtDrawNameZ=%u*", params.gtDrawNameZ );
+  retStr += QString().sprintf( "gtNameX=%s*", params.gtNameX.toLatin1().constData() );
+  retStr += QString().sprintf( "gtNameY=%s*", params.gtNameY.toLatin1().constData() );
+  retStr += QString().sprintf( "gtNameZ=%s*", params.gtNameZ.toLatin1().constData() );
+  retStr += QString().sprintf( "gtNameColorRX=%u*", params.gtNameColorRX );
+  retStr += QString().sprintf( "gtNameColorGX=%u*", params.gtNameColorGX );
+  retStr += QString().sprintf( "gtNameColorBX=%u*", params.gtNameColorBX );
+  retStr += QString().sprintf( "gtNameColorRY=%u*", params.gtNameColorRY );
+  retStr += QString().sprintf( "gtNameColorGY=%u*", params.gtNameColorGY );
+  retStr += QString().sprintf( "gtNameColorBY=%u*", params.gtNameColorBY );
+  retStr += QString().sprintf( "gtNameColorRZ=%u*", params.gtNameColorRZ );
+  retStr += QString().sprintf( "gtNameColorGZ=%u*", params.gtNameColorGZ );
+  retStr += QString().sprintf( "gtNameColorBZ=%u*", params.gtNameColorBZ );
+  retStr += QString().sprintf( "gtDrawValuesX=%u*", params.gtDrawValuesX );
+  retStr += QString().sprintf( "gtDrawValuesY=%u*", params.gtDrawValuesY );
+  retStr += QString().sprintf( "gtDrawValuesZ=%u*", params.gtDrawValuesZ );
+  retStr += QString().sprintf( "gtNbValuesX=%u*", params.gtNbValuesX );
+  retStr += QString().sprintf( "gtNbValuesY=%u*", params.gtNbValuesY );
+  retStr += QString().sprintf( "gtNbValuesZ=%u*", params.gtNbValuesZ );
+  retStr += QString().sprintf( "gtOffsetX=%u*", params.gtOffsetX );
+  retStr += QString().sprintf( "gtOffsetY=%u*", params.gtOffsetY );
+  retStr += QString().sprintf( "gtOffsetZ=%u*", params.gtOffsetZ );
+  retStr += QString().sprintf( "gtColorRX=%u*", params.gtColorRX );
+  retStr += QString().sprintf( "gtColorGX=%u*", params.gtColorGX );
+  retStr += QString().sprintf( "gtColorBX=%u*", params.gtColorBX );
+  retStr += QString().sprintf( "gtColorRY=%u*", params.gtColorRY );
+  retStr += QString().sprintf( "gtColorGY=%u*", params.gtColorGY );
+  retStr += QString().sprintf( "gtColorBY=%u*", params.gtColorBY );
+  retStr += QString().sprintf( "gtColorRZ=%u*", params.gtColorRZ );
+  retStr += QString().sprintf( "gtColorGZ=%u*", params.gtColorGZ );
+  retStr += QString().sprintf( "gtColorBZ=%u*", params.gtColorBZ );
+  retStr += QString().sprintf( "gtDrawTickmarksX=%u*", params.gtDrawTickmarksX );
+  retStr += QString().sprintf( "gtDrawTickmarksY=%u*", params.gtDrawTickmarksY );
+  retStr += QString().sprintf( "gtDrawTickmarksZ=%u*", params.gtDrawTickmarksZ );
+  retStr += QString().sprintf( "gtTickmarkLengthX=%u*", params.gtTickmarkLengthX );
+  retStr += QString().sprintf( "gtTickmarkLengthY=%u*", params.gtTickmarkLengthY );
+  retStr += QString().sprintf( "gtTickmarkLengthZ=%u", params.gtTickmarkLengthZ );
+#endif
+
   return retStr;
 }
 
@@ -1707,36 +1896,109 @@ QString OCCViewer_ViewWindow::getVisualParameters()
 */
 void OCCViewer_ViewWindow::setVisualParameters( const QString& parameters )
 {
+  viewAspect params;
   QStringList paramsLst = parameters.split( '*' );
-  if ( paramsLst.size() >= 15 ) {
-    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() == 18 ) {
-      params.scaleX    = paramsLst[13].toDouble();
-      params.scaleY    = paramsLst[14].toDouble();
-      params.scaleZ    = paramsLst[15].toDouble();
-      params.isVisible = paramsLst[16].toDouble();
-      params.size      = paramsLst[17].toDouble();
-    } 
-    else {
-      params.scaleX    = 1.;
-      params.scaleY    = 1.;
-      params.scaleZ    = 1.;
+  if( parameters.contains( '=' )  ) // new format - "scale=1.000e+00*centerX=0.000e+00..."
+  {
+    QStringList::const_iterator it = paramsLst.begin(), itEnd = paramsLst.end();
+    for( ; it != itEnd; it++ ) {
+      QString param = *it;
+      QString paramName = param.section( '=', 0, 0 );
+      QString paramStr = param.section( '=', 1, 1 );
+      double paramDouble = paramStr.toDouble();
+      int paramInt = paramStr.toInt();
+      if( paramName == "scale" )          params.scale = paramDouble;
+      else if( paramName == "centerX" )   params.centerX = paramDouble;
+      else if( paramName == "centerY" )   params.centerY = paramDouble;
+      else if( paramName == "projX" )     params.projX = paramDouble;
+      else if( paramName == "projY" )     params.projY = paramDouble;
+      else if( paramName == "projZ" )     params.projZ = paramDouble;
+      else if( paramName == "twist" )     params.twist = paramDouble;
+      else if( paramName == "atX" )       params.atX = paramDouble;
+      else if( paramName == "atY" )       params.atY = paramDouble;
+      else if( paramName == "atZ" )       params.atZ = paramDouble;
+      else if( paramName == "eyeX" )      params.eyeX = paramDouble;
+      else if( paramName == "eyeY" )      params.eyeY = paramDouble;
+      else if( paramName == "eyeZ" )      params.eyeZ = paramDouble;
+      else if( paramName == "scaleX" )    params.scaleX = paramDouble;
+      else if( paramName == "scaleY" )    params.scaleY = paramDouble;
+      else if( paramName == "scaleZ" )    params.scaleZ = paramDouble;
+      else if( paramName == "isVisible" ) params.isVisible = paramInt;
+      else if( paramName == "size" )      params.size = paramDouble;
+      // graduated trihedron
+      else if( paramName == "gtIsVisible" )       params.gtIsVisible = paramInt;
+      else if( paramName == "gtDrawNameX" )       params.gtDrawNameX = paramInt;
+      else if( paramName == "gtDrawNameY" )       params.gtDrawNameY = paramInt;
+      else if( paramName == "gtDrawNameZ" )       params.gtDrawNameZ = paramInt;
+      else if( paramName == "gtNameX" )           params.gtNameX = paramStr;
+      else if( paramName == "gtNameY" )           params.gtNameY = paramStr;
+      else if( paramName == "gtNameZ" )           params.gtNameZ = paramStr;
+      else if( paramName == "gtNameColorRX" )     params.gtNameColorRX = paramInt;
+      else if( paramName == "gtNameColorGX" )     params.gtNameColorGX = paramInt;
+      else if( paramName == "gtNameColorBX" )     params.gtNameColorBX = paramInt;
+      else if( paramName == "gtNameColorRY" )     params.gtNameColorRY = paramInt;
+      else if( paramName == "gtNameColorGY" )     params.gtNameColorGY = paramInt;
+      else if( paramName == "gtNameColorBY" )     params.gtNameColorBY = paramInt;
+      else if( paramName == "gtNameColorRZ" )     params.gtNameColorRZ = paramInt;
+      else if( paramName == "gtNameColorGZ" )     params.gtNameColorGZ = paramInt;
+      else if( paramName == "gtNameColorBZ" )     params.gtNameColorBZ = paramInt;
+      else if( paramName == "gtDrawValuesX" )     params.gtDrawValuesX = paramInt;
+      else if( paramName == "gtDrawValuesY" )     params.gtDrawValuesY = paramInt;
+      else if( paramName == "gtDrawValuesZ" )     params.gtDrawValuesZ = paramInt;
+      else if( paramName == "gtNbValuesX" )       params.gtNbValuesX = paramInt;
+      else if( paramName == "gtNbValuesY" )       params.gtNbValuesY = paramInt;
+      else if( paramName == "gtNbValuesZ" )       params.gtNbValuesZ = paramInt;
+      else if( paramName == "gtOffsetX" )         params.gtOffsetX = paramInt;
+      else if( paramName == "gtOffsetY" )         params.gtOffsetY = paramInt;
+      else if( paramName == "gtOffsetZ" )         params.gtOffsetZ = paramInt;
+      else if( paramName == "gtColorRX" )         params.gtColorRX = paramInt;
+      else if( paramName == "gtColorGX" )         params.gtColorGX = paramInt;
+      else if( paramName == "gtColorBX" )         params.gtColorBX = paramInt;
+      else if( paramName == "gtColorRY" )         params.gtColorRY = paramInt;
+      else if( paramName == "gtColorGY" )         params.gtColorGY = paramInt;
+      else if( paramName == "gtColorBY" )         params.gtColorBY = paramInt;
+      else if( paramName == "gtColorRZ" )         params.gtColorRZ = paramInt;
+      else if( paramName == "gtColorGZ" )         params.gtColorGZ = paramInt;
+      else if( paramName == "gtColorBZ" )         params.gtColorBZ = paramInt;
+      else if( paramName == "gtDrawTickmarksX" )  params.gtDrawTickmarksX = paramInt;
+      else if( paramName == "gtDrawTickmarksY" )  params.gtDrawTickmarksY = paramInt;
+      else if( paramName == "gtDrawTickmarksZ" )  params.gtDrawTickmarksZ = paramInt;
+      else if( paramName == "gtTickmarkLengthX" ) params.gtTickmarkLengthX = paramInt;
+      else if( paramName == "gtTickmarkLengthY" ) params.gtTickmarkLengthY = paramInt;
+      else if( paramName == "gtTickmarkLengthZ" ) params.gtTickmarkLengthZ = paramInt;
+    }
+  }
+  else // old format - "1.000e+00*0.000e+00..."
+  {
+    if ( paramsLst.size() >= 15 ) {
+      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() == 18 ) {
+        params.scaleX    = paramsLst[13].toDouble();
+        params.scaleY    = paramsLst[14].toDouble();
+        params.scaleZ    = paramsLst[15].toDouble();
+        params.isVisible = paramsLst[16].toDouble();
+        params.size      = paramsLst[17].toDouble();
+      } 
+      else {
+        params.scaleX    = 1.;
+        params.scaleY    = 1.;
+        params.scaleZ    = 1.;
+      }
     }
-    performRestoring( params );
   }
+  performRestoring( params );
 }
 
 /*!
index 56558b5b7e64939dbc90910403eee34fcba0b77d..02300ef18aa6e7f647addfef69c74adbfaae2dbc 100755 (executable)
@@ -35,6 +35,7 @@ class OCCViewer_ClippingDlg;
 class OCCViewer_AxialScaleDlg;
 class OCCViewer_SetRotationPointDlg;
 class OCCViewer_Viewer;
+class OCCViewer_CubeAxesDlg;
 class viewAspect;
 class QtxAction;
 
@@ -50,7 +51,7 @@ public:
   enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId,
          ChangeRotationPointId, RotationId,
          FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId, CloneId, ClippingId, MemId, RestoreId,
-         TrihedronShowId, AxialScaleId, AmbientId, SwitchInteractionStyleId };
+         TrihedronShowId, AxialScaleId, GraduatedAxesId, AmbientId, SwitchInteractionStyleId };
 
   enum OperationType{ NOTHING, PANVIEW, ZOOMVIEW, ROTATE, 
                       PANGLOBAL, WINDOWFIT, FITALLVIEW, RESETVIEW,
@@ -111,6 +112,7 @@ public slots:
   void onCloneView();
   void onClipping( bool on );
   void onAxialScale();
+  void onGraduatedAxes();
   void onAmbientToogle();
   void onMemorizeView();
   void onRestoreView();
@@ -179,6 +181,8 @@ protected:
   OCCViewer_Viewer*     myModel;
   OCCViewer_ViewPort3d* myViewPort;
 
+  OCCViewer_CubeAxesDlg* myCubeAxesDlg;
+
   RotationPointType     myCurrPointType;
   RotationPointType     myPrevPointType;
   gp_Pnt                mySelectedPoint;
index bdd523e49e659f0458877d0cef1922a09ce17fa7..bcc888b208a90cf8899c4a7902d5e16907b5fffc 100644 (file)
         <source>ICON_OCCVIEWER_SCALING</source>
         <translation>occ_view_scaling.png</translation>
     </message>
+    <message>
+        <source>ICON_OCCVIEWER_GRADUATED_AXES</source>
+        <translation>occ_view_graduated_axes.png</translation>
+    </message>
     <message>
         <source>ICON_OCCVIEWER_AMBIENT</source>
         <translation>occ_view_ambient.png</translation>
index 8b19e4c5b9859d9fcecdd7c3b814555b04f0cdea..aea134ee6cb04865dca17317b3f8c51cfcba71a2 100644 (file)
         <source>MNU_SCALING</source>
         <translation>Scaling</translation>
     </message>
+    <message>
+        <source>DSC_GRADUATED_AXES</source>
+        <translation>Graduated axes</translation>
+    </message>
+    <message>
+        <source>MNU_GRADUATED_AXES</source>
+        <translation>Graduated axes</translation>
+    </message>
     <message>
         <source>DSC_AMBIENT</source>
         <translation>Toogle keep only ambient light</translation>
diff --git a/src/OCCViewer/resources/occ_view_graduated_axes.png b/src/OCCViewer/resources/occ_view_graduated_axes.png
new file mode 100755 (executable)
index 0000000..2b44c06
Binary files /dev/null and b/src/OCCViewer/resources/occ_view_graduated_axes.png differ
index 4ae5a82fa4226f809a7f577992666f6210e00c9b..3842a639f648364983a395d892007ed9cad74a7f 100755 (executable)
@@ -36,7 +36,6 @@ salomeinclude_HEADERS= \
        SALOME_Actor.h \
        SVTK_RectPicker.h \
        SVTK_DeviceActor.h \
-       SVTK_DialogBase.h \
        SVTK_FontWidget.h \
        SVTK_CubeAxesActor2D.h \
        SVTK_Functor.h \
@@ -73,7 +72,6 @@ dist_libSVTK_la_SOURCES= \
        SVTK_NonIsometricDlg.cxx \
        SVTK_UpdateRateDlg.cxx \
        SVTK_CubeAxesDlg.cxx \
-       SVTK_DialogBase.cxx \
        SVTK_FontWidget.cxx \
        SVTK_Trihedron.cxx \
        SVTK_View.cxx \
@@ -110,7 +108,6 @@ MOC_FILES= \
        SVTK_UpdateRateDlg_moc.cxx \
        SVTK_CubeAxesDlg_moc.cxx \
        SVTK_FontWidget_moc.cxx \
-       SVTK_DialogBase_moc.cxx \
        SVTK_ViewModelBase_moc.cxx \
        SVTK_ViewManager_moc.cxx \
        SVTK_ViewWindow_moc.cxx \
@@ -148,6 +145,7 @@ libSVTK_la_CPPFLAGS =               \
        $(BOOST_CPPFLAGS)       \
        -I$(srcdir)/../Qtx      \
        -I$(srcdir)/../SUIT     \
+       -I$(srcdir)/../ViewerTools \
        -I$(srcdir)/../OBJECT   \
        -I$(srcdir)/../Prs      \
        -I$(srcdir)/../VTKViewer \
@@ -160,9 +158,10 @@ libSVTK_la_LDFLAGS =                       \
        $(KERNEL_LDFLAGS)
 
 
-libSVTK_la_LIBADD = ../Qtx/libqtx.la ../SUIT/libsuit.la ../OBJECT/libSalomeObject.la \
-                   ../Prs/libSalomePrs.la ../VTKViewer/libVTKViewer.la \
-                   ../OpenGLUtils/libOpenGLUtils.la -lSALOMELocalTrace
+libSVTK_la_LIBADD = ../Qtx/libqtx.la ../SUIT/libsuit.la ../ViewerTools/libViewerTools.la \
+                   ../OBJECT/libSalomeObject.la ../Prs/libSalomePrs.la \
+                   ../VTKViewer/libVTKViewer.la ../OpenGLUtils/libOpenGLUtils.la \
+                   -lSALOMELocalTrace
 
 # Executable
 bin_PROGRAMS = SVTK
index 942e9af6222a50c1ff00d66326ea568b38b6e5d7..b979f550883ff3f7fdcb9a145b86db57fb05935c 100644 (file)
 #include "QtxAction.h"
 #include "QtxIntSpinBox.h"
 
-#include <QHBoxLayout>
-#include <QVBoxLayout>
-#include <QPushButton>
-#include <QTabWidget>
 #include <QCheckBox>
 #include <QGroupBox>
 #include <QLineEdit>
-#include <QLabel>
 
 #include <vtkAxisActor2D.h>
 #include <vtkTextProperty.h>
   \internal
 */
 
-class SVTK_CubeAxesDlg::AxisWidget : public QFrame
-{
-public:
-  AxisWidget( QWidget* );
-  ~AxisWidget();
-
-  void             UseName( const bool );
-  void             SetName( const QString& );
-  void             SetNameFont( const QColor&, const int, const bool, const bool, const bool );
-  bool             ReadData( vtkAxisActor2D* );
-  bool             Apply( vtkAxisActor2D* );
-
-private:
-  // name
-  QGroupBox*       myNameGrp;
-  QLineEdit*       myAxisName;
-  SVTK_FontWidget* myNameFont;
-
-  // labels
-  QGroupBox*       myLabelsGrp;
-  QtxIntSpinBox*   myLabelNumber;
-  QtxIntSpinBox*   myLabelOffset;
-  SVTK_FontWidget* myLabelsFont;
-
-  // tick marks
-  QGroupBox*       myTicksGrp;
-  QtxIntSpinBox*   myTickLength;
-
-  friend class SVTK_CubeAxesDlg;
-};
-
 /*!
   Constructor
 */
-SVTK_CubeAxesDlg::AxisWidget::AxisWidget (QWidget* theParent)
-:  QFrame(theParent)
+SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent)
+: ViewerTools_AxisWidgetBase(theParent)
 {
-  QList< QLabel* > aLabels;
-
-  // "Name" grp
-
-  myNameGrp = new QGroupBox(SVTK_CubeAxesDlg::tr("AXIS_NAME"), this);
-  myNameGrp->setCheckable( true );
-
-  QVBoxLayout* aVBox = new QVBoxLayout;
-  
-  QHBoxLayout* aHBox = new QHBoxLayout;
-  aHBox->setSpacing(5);
-  QLabel* aLabel = new QLabel(SVTK_CubeAxesDlg::tr("NAME"));
-  aHBox->addWidget(aLabel);
-  myAxisName = new QLineEdit;
-  aHBox->addWidget(myAxisName);
-  aLabels.append(aLabel);
-  aVBox->addLayout(aHBox);
-
-  aHBox = new QHBoxLayout;
-  aHBox->setSpacing(5);
-  aLabel = new QLabel(SVTK_CubeAxesDlg::tr("FONT"));
-  aHBox->addWidget(aLabel);
-  myNameFont = new SVTK_FontWidget(myNameGrp);
-  aHBox->addWidget(myNameFont);
-  aLabels.append(aLabel);
-  aVBox->addLayout(aHBox);
-
-  myNameGrp->setLayout(aVBox);
-
-  // "Labels" grp
-
-  myLabelsGrp = new QGroupBox(SVTK_CubeAxesDlg::tr("LABELS"), this);
-  myLabelsGrp->setCheckable( true );
-
-  aVBox = new QVBoxLayout;
-
-  aHBox = new QHBoxLayout;
-  aHBox->setSpacing(5);
-  aLabel = new QLabel(SVTK_CubeAxesDlg::tr("NUMBER"));
-  aHBox->addWidget(aLabel);
-  myLabelNumber = new QtxIntSpinBox(0,25,1,myLabelsGrp);
-  aHBox->addWidget(myLabelNumber);
-  aLabels.append(aLabel);
-  aVBox->addLayout(aHBox);
-
-  aHBox = new QHBoxLayout;
-  aHBox->setSpacing(5);
-  aLabel = new QLabel(SVTK_CubeAxesDlg::tr("OFFSET"));
-  aHBox->addWidget(aLabel);
-  myLabelOffset = new QtxIntSpinBox(0,100,1,myLabelsGrp);
-  aHBox->addWidget(myLabelOffset);
-  aLabels.append(aLabel);
-  aVBox->addLayout(aHBox);
-
-  aHBox = new QHBoxLayout;
-  aHBox->setSpacing(5);
-  aLabel = new QLabel(SVTK_CubeAxesDlg::tr("FONT"));
-  aHBox->addWidget(aLabel);
-  myLabelsFont = new SVTK_FontWidget(myLabelsGrp);
-  aHBox->addWidget(myLabelsFont);
-  aLabels.append(aLabel);
-  aVBox->addLayout(aHBox);
-
-  myLabelsGrp->setLayout(aVBox);
-
-  // "Tick marks" grp
-
-  myTicksGrp = new QGroupBox(SVTK_CubeAxesDlg::tr("TICK_MARKS"), this);
-  myTicksGrp->setCheckable( true );
-
-  aVBox = new QVBoxLayout;
-
-  aHBox = new QHBoxLayout;
-  aHBox->setSpacing(5);
-  aLabel = new QLabel(SVTK_CubeAxesDlg::tr("LENGTH"));
-  aHBox->addWidget(aLabel);
-  myTickLength = new QtxIntSpinBox(0,100,1,myTicksGrp);
-  aHBox->addWidget(myTickLength);
-  aLabels.append(aLabel);
-  aVBox->addLayout(aHBox);
-
-  myTicksGrp->setLayout(aVBox);
-
-  // Layout
-
-  QVBoxLayout* aLay = new QVBoxLayout(this);
-  aLay->setMargin(5);
-  aLay->setSpacing(5);
-  aLay->addWidget(myNameGrp);
-  aLay->addWidget(myLabelsGrp);
-  aLay->addWidget(myTicksGrp);
-
-  // init
-  myNameGrp->setChecked( true );
-  myLabelsGrp->setChecked( true );
-  myTicksGrp->setChecked( true );
-
-  // Adjust label widths
-  QList< QLabel* >::iterator anIter;
-  int aMaxWidth = 0;
-  for (anIter = aLabels.begin(); anIter != aLabels.end(); anIter++)
-    aMaxWidth = qMax(aMaxWidth, (*anIter)->sizeHint().width());
-  for (anIter = aLabels.begin(); anIter != aLabels.end(); anIter++)
-    (*anIter)->setFixedWidth(aMaxWidth);
 }
 
 /*!
   Destructor
 */
-SVTK_CubeAxesDlg::AxisWidget::~AxisWidget()
+SVTK_AxisWidget::~SVTK_AxisWidget()
 {
 }
 
-void SVTK_CubeAxesDlg::AxisWidget::UseName(const bool toUse)
+ViewerTools_FontWidgetBase* SVTK_AxisWidget::createFontWidget( QWidget* theParent )
 {
-  myNameGrp->setChecked(toUse);
+  SVTK_FontWidget* aFontWidget = new SVTK_FontWidget( theParent );
+  aFontWidget->Initialize();
+  return aFontWidget;
 }
 
-void SVTK_CubeAxesDlg::AxisWidget::SetName(const QString& theName)
-{
-  myAxisName->setText(theName);
-}
-
-void SVTK_CubeAxesDlg::AxisWidget::SetNameFont(const QColor& theColor,
-                                               const int theFont,
-                                               const bool theIsBold,
-                                               const bool theIsItalic,
-                                               const bool theIsShadow)
-{
-  myNameFont->SetData(theColor, theFont, theIsBold, theIsItalic, theIsShadow);
-}
-
-bool SVTK_CubeAxesDlg::AxisWidget::ReadData(vtkAxisActor2D* theActor)
+bool SVTK_AxisWidget::ReadData(vtkAxisActor2D* theActor)
 {
   if (theActor == 0)
     return false;
@@ -293,7 +141,7 @@ bool SVTK_CubeAxesDlg::AxisWidget::ReadData(vtkAxisActor2D* theActor)
   return true;
 }
 
-bool SVTK_CubeAxesDlg::AxisWidget::Apply(vtkAxisActor2D* theActor)
+bool SVTK_AxisWidget::Apply(vtkAxisActor2D* theActor)
 {
    if (theActor == 0)
     return false;
@@ -378,86 +226,28 @@ bool SVTK_CubeAxesDlg::AxisWidget::Apply(vtkAxisActor2D* theActor)
 SVTK_CubeAxesDlg::SVTK_CubeAxesDlg(QtxAction* theAction,
                                    SVTK_ViewWindow* theParent,
                                    const char* theName):
-  SVTK_DialogBase(theAction,
-                  theParent, 
-                  theName),
+  ViewerTools_CubeAxesDlgBase(theAction,
+                              theParent, 
+                              theName),
   myMainWindow(theParent)
 {
-  setWindowTitle(tr("CAPTION"));
-
-  QVBoxLayout* aLay = new QVBoxLayout(this);
-  aLay->setMargin(5);
-  aLay->setSpacing(5);
-  aLay->addWidget(createMainFrame(this));
-  aLay->addWidget(createButtonFrame(this));
-
-  connect(theParent, SIGNAL(Show( QShowEvent * )), this, SLOT(onParentShow()));
-  connect(theParent, SIGNAL(Hide( QHideEvent * )), this, SLOT(onParentHide()));
 }
 
 /*!
-  Create frame containing dialog's input fields
-*/
-QWidget* SVTK_CubeAxesDlg::createMainFrame(QWidget* theParent)
-{
-  QFrame* aFrame = new QFrame(theParent);
-
-  myTabWg = new QTabWidget(aFrame);
-
-  myAxes[ 0 ] = new AxisWidget(myTabWg);
-  myAxes[ 1 ] = new AxisWidget(myTabWg);
-  myAxes[ 2 ] = new AxisWidget(myTabWg);
-
-  myTabWg->addTab(myAxes[ 0 ], tr("X_AXIS"));
-  myTabWg->addTab(myAxes[ 1 ], tr("Y_AXIS"));
-  myTabWg->addTab(myAxes[ 2 ], tr("Z_AXIS"));
-
-  myIsVisible = new QCheckBox(tr("IS_VISIBLE"), aFrame);
-
-  QVBoxLayout* aLay = new QVBoxLayout(aFrame);
-  aLay->setMargin(0);
-  aLay->setSpacing(5);
-  aLay->addWidget(myTabWg);
-  aLay->addWidget(myIsVisible);
-
-  return aFrame;
-}
-
-/*!
-  Create frame containing buttons
+  Destructor
 */
-QWidget* SVTK_CubeAxesDlg::createButtonFrame(QWidget* theParent)
+SVTK_CubeAxesDlg::~SVTK_CubeAxesDlg()
 {
-  QFrame* aFrame = new QFrame(theParent);
-  aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);
-
-  myOkBtn    = new QPushButton(tr("BUT_OK"), aFrame);
-  myApplyBtn = new QPushButton(tr("BUT_APPLY"), aFrame);
-  myCloseBtn = new QPushButton(tr("BUT_CLOSE"), aFrame);
-
-  QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
-
-  QHBoxLayout* aLay = new QHBoxLayout(aFrame);
-  aLay->setMargin(5);
-  aLay->setSpacing(5);
-
-  aLay->addWidget(myOkBtn);
-  aLay->addWidget(myApplyBtn);
-  aLay->addItem(aSpacer);
-  aLay->addWidget(myCloseBtn);
-
-  connect(myOkBtn,    SIGNAL(clicked()), SLOT(onOk()));
-  connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply()));
-  connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));
-
-  return aFrame;
 }
 
 /*!
-  Destructor
+  Create axis widget
 */
-SVTK_CubeAxesDlg::~SVTK_CubeAxesDlg()
+ViewerTools_AxisWidgetBase* SVTK_CubeAxesDlg::createAxisWidget( QWidget* theParent )
 {
+  SVTK_AxisWidget* anAxisWidget = new SVTK_AxisWidget( theParent );
+  anAxisWidget->initialize();
+  return anAxisWidget;
 }
 
 /*!
@@ -465,29 +255,23 @@ SVTK_CubeAxesDlg::~SVTK_CubeAxesDlg()
 */
 void SVTK_CubeAxesDlg::Update()
 {
+  ViewerTools_CubeAxesDlgBase::Update();
+
   myActor = myMainWindow->GetCubeAxes();
 
-  myAxes[ 0 ]->ReadData(myActor->GetXAxisActor2D());
-  myAxes[ 1 ]->ReadData(myActor->GetYAxisActor2D());
-  myAxes[ 2 ]->ReadData(myActor->GetZAxisActor2D());
+  ((SVTK_AxisWidget*)myAxes[ 0 ])->ReadData(myActor->GetXAxisActor2D());
+  ((SVTK_AxisWidget*)myAxes[ 1 ])->ReadData(myActor->GetYAxisActor2D());
+  ((SVTK_AxisWidget*)myAxes[ 2 ])->ReadData(myActor->GetZAxisActor2D());
 
   myIsVisible->setChecked(myActor->GetVisibility() ? true : false);
 }
 
-/*!
-  Verify validity of entry data
-*/
-bool SVTK_CubeAxesDlg::isValid() const
-{
-  return true;
-}
-
 /*!
   Verify validity of entry data
 */
 bool SVTK_CubeAxesDlg::onApply()
 {
-  bool isOk = true;
+  bool isOk = ViewerTools_CubeAxesDlgBase::onApply();
 
   try
   {
@@ -495,16 +279,15 @@ bool SVTK_CubeAxesDlg::onApply()
     aCurrWid->clearFocus();
     aCurrWid->setFocus();
 
-    isOk = isOk && myAxes[ 0 ]->Apply(myActor->GetXAxisActor2D());
-    isOk = isOk && myAxes[ 1 ]->Apply(myActor->GetYAxisActor2D());
-    isOk = isOk && myAxes[ 2 ]->Apply(myActor->GetZAxisActor2D());
-
+    isOk = isOk && ((SVTK_AxisWidget*)myAxes[ 0 ])->Apply(myActor->GetXAxisActor2D());
+    isOk = isOk && ((SVTK_AxisWidget*)myAxes[ 1 ])->Apply(myActor->GetYAxisActor2D());
+    isOk = isOk && ((SVTK_AxisWidget*)myAxes[ 2 ])->Apply(myActor->GetZAxisActor2D());
 
-    //myActor->SetXLabel(myAxes[ 0 ]->myAxisName->text());
-    //myActor->SetYLabel(myAxes[ 1 ]->myAxisName->text());
-    //myActor->SetZLabel(myAxes[ 2 ]->myAxisName->text());
+    //myActor->SetXLabel(myAxes[ 0 ]->myAxisName->text()); // to remove?
+    //myActor->SetYLabel(myAxes[ 1 ]->myAxisName->text()); // to remove?
+    //myActor->SetZLabel(myAxes[ 2 ]->myAxisName->text()); // to remove?
 
-    //myActor->SetNumberOfLabels(myActor->GetXAxisActor2D()->GetNumberOfLabels());
+    //myActor->SetNumberOfLabels(myActor->GetXAxisActor2D()->GetNumberOfLabels()); // to remove?
     if (myIsVisible->isChecked())
       myActor->VisibilityOn();
     else
@@ -520,20 +303,3 @@ bool SVTK_CubeAxesDlg::onApply()
 
   return isOk;
 }
-
-/*!
-  SLOT called when "Ok" button pressed.
-*/
-void SVTK_CubeAxesDlg::onOk()
-{
-  if (onApply())
-    onClose();
-}
-
-/*!
-  SLOT: called when "Close" button pressed. Close dialog
-*/
-void SVTK_CubeAxesDlg::onClose()
-{
-  reject();
-}
index 6d615b8c6646c586b0ae54c98f1a5e5516832b33..57efc3b027cd03269dc66dc598b046ddd832e93f 100644 (file)
 #ifndef SVTK_CubeAxesDlg_H
 #define SVTK_CubeAxesDlg_H
 
-#include "SVTK_DialogBase.h"
+#include "SVTK.h"
 
-class QWidget;
-class QPushButton;
-class QTabWidget;
-class QCheckBox;
+#include <ViewerTools_CubeAxesDlgBase.h>
 
-class QtxAction;
+class SVTK_ViewWindow;
 class SVTK_CubeAxesActor2D;
 
-class SVTK_FontWidget;
-class SVTK_AxisWidget;
-class SVTK_ViewWindow;
+class vtkAxisActor2D;
+
+/*!
+ * Class       : SVTK_AxisWidget
+ * Description : Axis tab widget of the "Graduated axis" dialog box
+*/
+class SVTK_EXPORT SVTK_AxisWidget : public ViewerTools_AxisWidgetBase
+{
+public:
+  SVTK_AxisWidget( QWidget* );
+  ~SVTK_AxisWidget();
+
+public:
+  bool             ReadData( vtkAxisActor2D* );
+  bool             Apply( vtkAxisActor2D* );
+
+protected:
+  virtual ViewerTools_FontWidgetBase* createFontWidget( QWidget* );
+};
 
 /*!
  * Class       : SVTK_CubeAxesDlg
  * Description : Dialog for specifynig cube axes properties
  */
-class SVTK_CubeAxesDlg : public SVTK_DialogBase
+class SVTK_EXPORT SVTK_CubeAxesDlg : public ViewerTools_CubeAxesDlgBase
 {
   Q_OBJECT
 
-  class AxisWidget;
-
 public:
                   SVTK_CubeAxesDlg(QtxAction* theAction,
                                    SVTK_ViewWindow* theParent,
                                    const char* theName);
   virtual         ~SVTK_CubeAxesDlg();
 
-  void            Update();
+  virtual void    Update();
 
 private slots:
-  void            onOk();
-  bool            onApply();
-  void            onClose();
+  virtual bool    onApply();
 
 private:
-  QWidget*        createButtonFrame( QWidget* );
-  QWidget*        createMainFrame  ( QWidget* );
-  bool            isValid() const;
+  virtual ViewerTools_AxisWidgetBase* createAxisWidget( QWidget* );
 
 private:
-  SVTK_ViewWindow *myMainWindow;
+  SVTK_ViewWindow*      myMainWindow;
   SVTK_CubeAxesActor2D* myActor;
-
-  QTabWidget*     myTabWg;
-  QCheckBox*      myIsVisible;
-
-  QPushButton*    myOkBtn;
-  QPushButton*    myApplyBtn;
-  QPushButton*    myCloseBtn;
-  AxisWidget*     myAxes[ 3 ];
 };
 
 #endif
index b8e3b28a8a5fe02e82ffa1d047bfffb944060829..fdbb838ba70d9c98f569619b0fcc0b8114e35850 100644 (file)
 //
 #include "SVTK_FontWidget.h"
 
-#include <QToolButton>
 #include <QComboBox>
-#include <QColorDialog>
-#include <QCheckBox>
-#include <QHBoxLayout>
 
 #include <vtkTextProperty.h>
 
   Constructor
 */
 SVTK_FontWidget::SVTK_FontWidget( QWidget* theParent )
-: QWidget( theParent )
+: ViewerTools_FontWidgetBase( theParent )
 {
-  myColorBtn = new QToolButton( this );
-  myColorBtn->setMinimumWidth( 20 );
-
-  myFamily = new QComboBox( this );
-  myFamily->insertItem( myFamily->count(), tr( "ARIAL" ) );
-  myFamily->insertItem( myFamily->count(), tr( "COURIER" ) );
-  myFamily->insertItem( myFamily->count(), tr( "TIMES" ) );
-
-  myBold = new QCheckBox( tr( "BOLD" ), this );
-  myItalic = new QCheckBox( tr( "ITALIC" ), this );
-  myShadow = new QCheckBox( tr( "SHADOW" ), this );
-
-  QHBoxLayout* aHBLayout = new QHBoxLayout;
-  aHBLayout->setSpacing( 5 );
-  aHBLayout->addWidget(myColorBtn);
-  aHBLayout->addWidget(myFamily);
-  aHBLayout->addWidget(myBold);
-  aHBLayout->addWidget(myItalic);
-  aHBLayout->addWidget(myShadow);
-  this->setLayout(aHBLayout);
-
-  connect( myColorBtn, SIGNAL( clicked() ), SLOT( onColor() ) );
 }
 
 /*!
@@ -77,32 +51,24 @@ SVTK_FontWidget::~SVTK_FontWidget()
 {
 }
 
-void SVTK_FontWidget::SetColor( const QColor& theColor )
-{
-  QPalette palette;
-  palette.setColor(myColorBtn->backgroundRole(), theColor);
-  myColorBtn->setPalette(palette);
-}
-
-QColor SVTK_FontWidget::GetColor() const
+void SVTK_FontWidget::InitializeFamilies()
 {
-  return myColorBtn->palette().color( myColorBtn->backgroundRole() );
-}
-
-void SVTK_FontWidget::onColor()
-{
-  QColor aColor = QColorDialog::getColor( GetColor(), this );
-  if ( aColor.isValid() )
-    SetColor( aColor );
+  myFamily->insertItem( myFamily->count(), tr( "ARIAL" ) );
+  myFamily->insertItem( myFamily->count(), tr( "COURIER" ) );
+  myFamily->insertItem( myFamily->count(), tr( "TIMES" ) );
 }
 
 void SVTK_FontWidget::SetData( const QColor& theColor,
-                              const int theFamily,
-                              const bool theBold,
-                              const bool theItalic,
-                              const bool theShadow )
+                               const int theFamily,
+                               const bool theBold,
+                               const bool theItalic,
+                               const bool theShadow )
 {
-  SetColor( theColor );
+  ViewerTools_FontWidgetBase::SetData( theColor,
+                                       theFamily,
+                                       theBold,
+                                       theItalic,
+                                       theShadow );
 
   if ( theFamily == VTK_ARIAL )
     myFamily->setCurrentIndex( 0 );
@@ -110,10 +76,6 @@ void SVTK_FontWidget::SetData( const QColor& theColor,
     myFamily->setCurrentIndex( 1 );
   else
     myFamily->setCurrentIndex( 2 );
-
-  myBold->setChecked( theBold );
-  myItalic->setChecked( theItalic );
-  myShadow->setChecked( theShadow );
 }
 
 void SVTK_FontWidget::GetData( QColor& theColor,
@@ -122,17 +84,17 @@ void SVTK_FontWidget::GetData( QColor& theColor,
                                bool& theItalic,
                                bool& theShadow ) const
 {
-  theColor = GetColor();
+  ViewerTools_FontWidgetBase::GetData( theColor,
+                                       theFamily,
+                                       theBold,
+                                       theItalic,
+                                       theShadow );
 
-  int anItem =myFamily->currentIndex();
+  int anItem = myFamily->currentIndex();
   if ( anItem == 0 )
     theFamily = VTK_ARIAL;
   else if ( anItem == 1 )
     theFamily = VTK_COURIER;
   else
     theFamily = VTK_TIMES;
-
-  theBold = myBold->isChecked();
-  theItalic = myItalic->isChecked();
-  theShadow = myShadow->isChecked();
 }
index 6150dfe5ff82d94ba1f62ca8632d2acdbe31a165..dde1e4be7686e07b727911339a4c3da6d06b76f9 100644 (file)
 
 #include "SVTK.h"
 
-#include <QWidget>
-
-class QToolButton;
-class QComboBox;
-class QCheckBox;
-class QColor;
-
+#include <ViewerTools_FontWidgetBase.h>
 
 /*!
  * Class       : SVTK_FontWidget
  * Description : Dialog for specifynig font
  */
-class SVTK_EXPORT SVTK_FontWidget : public QWidget
+class SVTK_EXPORT SVTK_FontWidget : public ViewerTools_FontWidgetBase
 {
   Q_OBJECT
 
@@ -49,22 +43,12 @@ public:
                 SVTK_FontWidget( QWidget* );
   virtual       ~SVTK_FontWidget();
 
-  void          SetColor( const QColor& );
-  QColor        GetColor() const;
-
-  void          SetData( const QColor&, const int, const bool, const bool, const bool );
-
-  void          GetData( QColor&, int&, bool&, bool&, bool& ) const;
+  virtual void  SetData( const QColor&, const int, const bool, const bool, const bool );
 
-private slots:
-  void          onColor();
+  virtual void  GetData( QColor&, int&, bool&, bool&, bool& ) const;
 
-private:
-  QToolButton*  myColorBtn;
-  QComboBox*    myFamily;
-  QCheckBox*    myBold;
-  QCheckBox*    myItalic;
-  QCheckBox*    myShadow;
+protected:
+  virtual void  InitializeFamilies();
 };
 
 #endif
index a1c5c6da081c194fd6c976567668c847a9a46673..ac35cdc10c2504f00bca4497c7dfd4f4e82146c6 100644 (file)
@@ -47,9 +47,9 @@ SVTK_NonIsometricDlg
 ::SVTK_NonIsometricDlg(QtxAction* theAction,
                        SVTK_ViewWindow* theParent,
                        const char* theName):
-  SVTK_DialogBase(theAction,
-                  theParent, 
-                  theName),
+  ViewerTools_DialogBase(theAction,
+                         theParent, 
+                         theName),
   m_MainWindow(theParent)
 {
   setWindowTitle(tr("DLG_TITLE"));
index 1e2573d1d44b04a6f39976040af7fb81710c08bd..dced659d9a365fd5e5263b7916821002f41bc5b3 100644 (file)
@@ -29,7 +29,7 @@
 #ifndef SVTK_NONISOMETRICDLG_H
 #define SVTK_NONISOMETRICDLG_H
 
-#include "SVTK_DialogBase.h"
+#include <ViewerTools_DialogBase.h>
 
 class SVTK_ViewWindow;
 
@@ -39,7 +39,7 @@ class QtxAction;
 class QPushButton;
 
 
-class SVTK_NonIsometricDlg : public SVTK_DialogBase
+class SVTK_NonIsometricDlg : public ViewerTools_DialogBase
 {
   Q_OBJECT;
 
index 28ac37ec72fc945dd4c151fe1700843f3c60077e..eec869920d60730b97a269df7babbfb4e997c327 100755 (executable)
@@ -55,9 +55,9 @@ SVTK_SetRotationPointDlg
 ::SVTK_SetRotationPointDlg(QtxAction* theAction,
                            SVTK_ViewWindow* theParent,
                            const char* theName):
-  SVTK_DialogBase(theAction,
-                  theParent, 
-                  theName),
+  ViewerTools_DialogBase(theAction,
+                         theParent, 
+                         theName),
   myMainWindow(theParent),
   myPriority(0.0),
   myEventCallbackCommand(vtkCallbackCommand::New()),
index e87335e3f09a5bff874422de7250a0ff4487345c..ed807b66c921ebd8b7cee87331a3b18bfa6f28b6 100755 (executable)
@@ -31,7 +31,7 @@
 
 #include "SVTK.h"
 
-#include "SVTK_DialogBase.h"
+#include <ViewerTools_DialogBase.h>
 
 #include <vtkSmartPointer.h>
 
@@ -48,7 +48,7 @@ class QCheckBox;
 class vtkCallbackCommand;
 class vtkObject;
 
-class SVTK_EXPORT SVTK_SetRotationPointDlg : public SVTK_DialogBase
+class SVTK_EXPORT SVTK_SetRotationPointDlg : public ViewerTools_DialogBase
 {
   Q_OBJECT;
 
index 373471ffe17651c71521a671ecd78c2e7e2aa713..d73408be73f40f4875023d9103ab188705ba1a32 100644 (file)
@@ -169,9 +169,9 @@ SVTK_UpdateRateDlg
 ::SVTK_UpdateRateDlg(QtxAction* theAction,
                      SVTK_ViewWindow* theParent,
                      const char* theName):
-  SVTK_DialogBase(theAction,
-                  theParent, 
-                  theName),
+  ViewerTools_DialogBase(theAction,
+                         theParent, 
+                         theName),
   myPriority(0.0),
   myEventCallbackCommand(vtkCallbackCommand::New()),
   myRWInteractor(theParent->GetInteractor()),
index 045c2d35aa56d7bfd9c2a336cacdcea6d80cea88..61ec0a622f0a50e518bf9723381d634402496276 100644 (file)
@@ -29,7 +29,7 @@
 #ifndef SVTK_UPDATERATEDLG_H
 #define SVTK_UPDATERATEDLG_H
 
-#include "SVTK_DialogBase.h"
+#include <ViewerTools_DialogBase.h>
 
 #include <vtkSmartPointer.h>
 
@@ -46,7 +46,7 @@ class vtkCallbackCommand;
 class vtkObject;
 
 
-class SVTK_UpdateRateDlg : public SVTK_DialogBase
+class SVTK_UpdateRateDlg : public ViewerTools_DialogBase
 {
   Q_OBJECT;
 
index 600250b4d16a2722651f04fe2feab9e0d04034a8..b4400f55854185e0ee182ef5bb19ac318427e7e8 100755 (executable)
@@ -56,7 +56,7 @@ using namespace std;
 SVTK_ViewParameterDlg::SVTK_ViewParameterDlg(QtxAction* theAction,
                                              SVTK_ViewWindow* theParent,
                                              const char* theName):
-  SVTK_DialogBase(theAction, theParent, theName),
+  ViewerTools_DialogBase(theAction, theParent, theName),
   myMainWindow(theParent),
   myPriority(0.0),
   myEventCallbackCommand(vtkCallbackCommand::New()),
index b987700639b5a820c29fb027656d44453fd7e97e..acef99e54f8ef12efd7266aef095db12f02d3f8f 100755 (executable)
@@ -28,7 +28,7 @@
 
 #include "SVTK.h"
 
-#include "SVTK_DialogBase.h"
+#include <ViewerTools_DialogBase.h>
 
 #include <vtkSmartPointer.h>
 #include <vtkTimeStamp.h>
@@ -47,7 +47,7 @@ class QButtonGroup;
 class vtkCallbackCommand;
 class vtkObject;
 
-class SVTK_EXPORT SVTK_ViewParameterDlg : public SVTK_DialogBase
+class SVTK_EXPORT SVTK_ViewParameterDlg : public ViewerTools_DialogBase
 {
   Q_OBJECT;
 
index a8fa48f19400b477a2c2607ff2e07cf3204ad52e..440bf08cedf48ba3edf07fc020545093c48138f6 100755 (executable)
@@ -165,6 +165,7 @@ void SVTK_ViewWindow::Initialize(SVTK_ViewModelBase* theModel)
   myUpdateRateDlg = new SVTK_UpdateRateDlg( getAction( UpdateRate ), this, "SVTK_UpdateRateDlg" );
   myNonIsometricDlg = new SVTK_NonIsometricDlg( getAction( NonIsometric ), this, "SVTK_NonIsometricDlg" );
   myCubeAxesDlg = new SVTK_CubeAxesDlg( getAction( GraduatedAxes ), this, "SVTK_CubeAxesDlg" );
+  myCubeAxesDlg->initialize();
   mySetRotationPointDlg = new SVTK_SetRotationPointDlg
     ( getAction( ChangeRotationPointId ), this, "SVTK_SetRotationPointDlg" );
   myViewParameterDlg = new SVTK_ViewParameterDlg
index 3663ce51edc8a9b7a6e6e8d511e5517d8bcffc41..8593ed6fa76aeecb9cf431fef086780c835d639e 100644 (file)
         <translation>Interaction Style Switch</translation>
     </message>
 </context>
-<context>
-    <name>SVTK_CubeAxesDlg</name>
-    <message>
-        <source>X_AXIS</source>
-        <translation>X axis</translation>
-    </message>
-    <message>
-        <source>Y_AXIS</source>
-        <translation>Y axis</translation>
-    </message>
-    <message>
-        <source>Z_AXIS</source>
-        <translation>Z axis</translation>
-    </message>
-    <message>
-        <source>CAPTION</source>
-        <translation>Graduated axes</translation>
-    </message>
-    <message>
-        <source>IS_VISIBLE</source>
-        <translation>Is visible</translation>
-    </message>
-    <message>
-        <source>FONT</source>
-        <translation>Font</translation>
-    </message>
-    <message>
-        <source>NAME</source>
-        <translation>Name</translation>
-    </message>
-    <message>
-        <source>TICK_MARKS</source>
-        <translation>Tick marks</translation>
-    </message>
-    <message>
-        <source>LABELS</source>
-        <translation>Labels</translation>
-    </message>
-    <message>
-        <source>LENGTH</source>
-        <translation>Length</translation>
-    </message>
-    <message>
-        <source>NUMBER</source>
-        <translation>Number</translation>
-    </message>
-    <message>
-        <source>OFFSET</source>
-        <translation>Offset</translation>
-    </message>
-    <message>
-        <source>AXIS_NAME</source>
-        <translation>Axis name</translation>
-    </message>
-</context>
 <context>
     <name>SVTK_FontWidget</name>
-    <message>
-        <source>BOLD</source>
-        <translation>Bold</translation>
-    </message>
     <message>
         <source>ARIAL</source>
         <translation>Arial</translation>
         <source>TIMES</source>
         <translation>Times</translation>
     </message>
-    <message>
-        <source>ITALIC</source>
-        <translation>Italic</translation>
-    </message>
-    <message>
-        <source>SHADOW</source>
-        <translation>Shadow</translation>
-    </message>
     <message>
         <source>COURIER</source>
         <translation>Courier</translation>
index 542811fc798615783821c0a91bc299d917d3ca44..0a037a064ba443bc11f330395ae50d2801c10be6 100644 (file)
@@ -69,6 +69,7 @@
     <parameter name="Style"        value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
     <parameter name="SUIT"         value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
     <parameter name="STD"          value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
+    <parameter name="ViewerTools"  value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
     <parameter name="Plot2d"       value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
     <parameter name="SPlot2d"      value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
     <parameter name="GLViewer"     value="${GUI_ROOT_DIR}/share/salome/resources/gui"/>
diff --git a/src/ViewerTools/Makefile.am b/src/ViewerTools/Makefile.am
new file mode 100755 (executable)
index 0000000..eefbd3a
--- /dev/null
@@ -0,0 +1,55 @@
+#  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+#
+#  Copyright (C) 2003-2007  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 $(top_srcdir)/adm_local/unix/make_common_starter.am
+
+lib_LTLIBRARIES = libViewerTools.la
+
+salomeinclude_HEADERS= \
+       ViewerTools.h \
+       ViewerTools_CubeAxesDlgBase.h \
+       ViewerTools_DialogBase.h \
+       ViewerTools_FontWidgetBase.h
+
+dist_libViewerTools_la_SOURCES= \
+       ViewerTools_CubeAxesDlgBase.cxx \
+       ViewerTools_DialogBase.cxx \
+       ViewerTools_FontWidgetBase.cxx
+
+MOC_FILES= \
+       ViewerTools_CubeAxesDlgBase_moc.cxx \
+       ViewerTools_DialogBase_moc.cxx \
+       ViewerTools_FontWidgetBase_moc.cxx
+
+nodist_libViewerTools_la_SOURCES= $(MOC_FILES)
+
+nodist_salomeres_DATA =        \
+       ViewerTools_msg_en.qm
+
+libViewerTools_la_CPPFLAGS =   \
+       $(QT_INCLUDES)          \
+       -I$(srcdir)/../Qtx
+
+libViewerTools_la_LDFLAGS =    \
+       $(QT_MT_LIBS)
+
+libViewerTools_la_LIBADD = ../Qtx/libqtx.la
diff --git a/src/ViewerTools/ViewerTools.h b/src/ViewerTools/ViewerTools.h
new file mode 100644 (file)
index 0000000..f79e2c2
--- /dev/null
@@ -0,0 +1,41 @@
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  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 VIEWERTOOLS_H
+#define VIEWERTOOLS_H
+
+#ifdef WIN32
+#  if defined VIEWERTOOLS_EXPORTS
+#    define VIEWERTOOLS_EXPORT __declspec(dllexport)
+#  else
+#   define VIEWERTOOLS_EXPORT __declspec(dllimport)
+#  endif
+#else
+#  define VIEWERTOOLS_EXPORT
+#endif
+
+#if defined WIN32
+#pragma warning ( disable: 4251 )
+#pragma warning ( disable: 4786 )
+#endif
+
+#endif
diff --git a/src/ViewerTools/ViewerTools_CubeAxesDlgBase.cxx b/src/ViewerTools/ViewerTools_CubeAxesDlgBase.cxx
new file mode 100644 (file)
index 0000000..f3f1e0e
--- /dev/null
@@ -0,0 +1,322 @@
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  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 "ViewerTools_CubeAxesDlgBase.h"
+
+#include "ViewerTools_FontWidgetBase.h"
+
+#include "QtxAction.h"
+#include "QtxIntSpinBox.h"
+
+#include <QHBoxLayout>
+#include <QVBoxLayout>
+#include <QPushButton>
+#include <QTabWidget>
+#include <QCheckBox>
+#include <QGroupBox>
+#include <QLineEdit>
+#include <QLabel>
+
+/*!
+ * Class       : ViewerTools_AxisWidgetBase
+ * Description : Axis tab widget of the "Graduated axis" dialog box
+*/
+
+/*!
+  Constructor
+*/
+ViewerTools_AxisWidgetBase::ViewerTools_AxisWidgetBase (QWidget* theParent)
+: QFrame(theParent)
+{
+}
+
+/*!
+  Destructor
+*/
+ViewerTools_AxisWidgetBase::~ViewerTools_AxisWidgetBase()
+{
+}
+
+/*!
+  Initialize controls
+*/
+void ViewerTools_AxisWidgetBase::initialize()
+{
+  QList< QLabel* > aLabels;
+
+  // "Name" grp
+
+  myNameGrp = new QGroupBox(ViewerTools_CubeAxesDlgBase::tr("AXIS_NAME"), this);
+  myNameGrp->setCheckable( true );
+
+  QVBoxLayout* aVBox = new QVBoxLayout;
+  
+  QHBoxLayout* aHBox = new QHBoxLayout;
+  aHBox->setSpacing(5);
+  QLabel* aLabel = new QLabel(ViewerTools_CubeAxesDlgBase::tr("NAME"));
+  aHBox->addWidget(aLabel);
+  myAxisName = new QLineEdit;
+  aHBox->addWidget(myAxisName);
+  aLabels.append(aLabel);
+  aVBox->addLayout(aHBox);
+
+  aHBox = new QHBoxLayout;
+  aHBox->setSpacing(5);
+  aLabel = new QLabel(ViewerTools_CubeAxesDlgBase::tr("FONT"));
+  aHBox->addWidget(aLabel);
+  myNameFont = createFontWidget(myNameGrp);
+  aHBox->addWidget(myNameFont);
+  aLabels.append(aLabel);
+  aVBox->addLayout(aHBox);
+
+  myNameGrp->setLayout(aVBox);
+
+  // "Labels" grp
+
+  myLabelsGrp = new QGroupBox(ViewerTools_CubeAxesDlgBase::tr("LABELS"), this);
+  myLabelsGrp->setCheckable( true );
+
+  aVBox = new QVBoxLayout;
+
+  aHBox = new QHBoxLayout;
+  aHBox->setSpacing(5);
+  aLabel = new QLabel(ViewerTools_CubeAxesDlgBase::tr("NUMBER"));
+  aHBox->addWidget(aLabel);
+  myLabelNumber = new QtxIntSpinBox(2,25,1,myLabelsGrp);
+  aHBox->addWidget(myLabelNumber);
+  aLabels.append(aLabel);
+  aVBox->addLayout(aHBox);
+
+  aHBox = new QHBoxLayout;
+  aHBox->setSpacing(5);
+  aLabel = new QLabel(ViewerTools_CubeAxesDlgBase::tr("OFFSET"));
+  aHBox->addWidget(aLabel);
+  myLabelOffset = new QtxIntSpinBox(0,100,1,myLabelsGrp);
+  aHBox->addWidget(myLabelOffset);
+  aLabels.append(aLabel);
+  aVBox->addLayout(aHBox);
+
+  aHBox = new QHBoxLayout;
+  aHBox->setSpacing(5);
+  aLabel = new QLabel(ViewerTools_CubeAxesDlgBase::tr("FONT"));
+  aHBox->addWidget(aLabel);
+  myLabelsFont = createFontWidget(myLabelsGrp);
+  aHBox->addWidget(myLabelsFont);
+  aLabels.append(aLabel);
+  aVBox->addLayout(aHBox);
+
+  myLabelsGrp->setLayout(aVBox);
+
+  // "Tick marks" grp
+
+  myTicksGrp = new QGroupBox(ViewerTools_CubeAxesDlgBase::tr("TICK_MARKS"), this);
+  myTicksGrp->setCheckable( true );
+
+  aVBox = new QVBoxLayout;
+
+  aHBox = new QHBoxLayout;
+  aHBox->setSpacing(5);
+  aLabel = new QLabel(ViewerTools_CubeAxesDlgBase::tr("LENGTH"));
+  aHBox->addWidget(aLabel);
+  myTickLength = new QtxIntSpinBox(0,100,1,myTicksGrp);
+  aHBox->addWidget(myTickLength);
+  aLabels.append(aLabel);
+  aVBox->addLayout(aHBox);
+
+  myTicksGrp->setLayout(aVBox);
+
+  // Layout
+
+  QVBoxLayout* aLay = new QVBoxLayout(this);
+  aLay->setMargin(5);
+  aLay->setSpacing(5);
+  aLay->addWidget(myNameGrp);
+  aLay->addWidget(myLabelsGrp);
+  aLay->addWidget(myTicksGrp);
+
+  // init
+  myNameGrp->setChecked( true );
+  myLabelsGrp->setChecked( true );
+  myTicksGrp->setChecked( true );
+
+  // Adjust label widths
+  QList< QLabel* >::iterator anIter;
+  int aMaxWidth = 0;
+  for (anIter = aLabels.begin(); anIter != aLabels.end(); anIter++)
+    aMaxWidth = qMax(aMaxWidth, (*anIter)->sizeHint().width());
+  for (anIter = aLabels.begin(); anIter != aLabels.end(); anIter++)
+    (*anIter)->setFixedWidth(aMaxWidth);
+}
+
+void ViewerTools_AxisWidgetBase::UseName(const bool toUse)
+{
+  myNameGrp->setChecked(toUse);
+}
+
+void ViewerTools_AxisWidgetBase::SetName(const QString& theName)
+{
+  myAxisName->setText(theName);
+}
+
+void ViewerTools_AxisWidgetBase::SetNameFont(const QColor& theColor,
+                                             const int theFont,
+                                             const bool theIsBold,
+                                             const bool theIsItalic,
+                                             const bool theIsShadow)
+{
+  myNameFont->SetData(theColor, theFont, theIsBold, theIsItalic, theIsShadow);
+}
+
+/*
+  Class       : ViewerTools_CubeAxesDlgBase
+  Description : Dialog for specifying cube axes properties
+*/
+
+/*!
+  Constructor
+*/
+ViewerTools_CubeAxesDlgBase::ViewerTools_CubeAxesDlgBase(QtxAction* theAction,
+                                                         QWidget* theParent,
+                                                         const char* theName):
+  ViewerTools_DialogBase(theAction,
+                         theParent,
+                         theName)
+{
+  setWindowTitle(tr("CAPTION"));
+}
+
+/*!
+  Initialize controls
+*/
+void ViewerTools_CubeAxesDlgBase::initialize()
+{
+  QVBoxLayout* aLay = new QVBoxLayout(this);
+  aLay->setMargin(5);
+  aLay->setSpacing(5);
+  aLay->addWidget(createMainFrame(this));
+  aLay->addWidget(createButtonFrame(this));
+}
+
+/*!
+  Create frame containing dialog's input fields
+*/
+QWidget* ViewerTools_CubeAxesDlgBase::createMainFrame(QWidget* theParent)
+{
+  QFrame* aFrame = new QFrame(theParent);
+
+  myTabWg = new QTabWidget(aFrame);
+
+  myAxes[ 0 ] = createAxisWidget(myTabWg);
+  myAxes[ 1 ] = createAxisWidget(myTabWg);
+  myAxes[ 2 ] = createAxisWidget(myTabWg);
+
+  myTabWg->addTab(myAxes[ 0 ], tr("X_AXIS"));
+  myTabWg->addTab(myAxes[ 1 ], tr("Y_AXIS"));
+  myTabWg->addTab(myAxes[ 2 ], tr("Z_AXIS"));
+
+  myIsVisible = new QCheckBox(tr("IS_VISIBLE"), aFrame);
+
+  QVBoxLayout* aLay = new QVBoxLayout(aFrame);
+  aLay->setMargin(0);
+  aLay->setSpacing(5);
+  aLay->addWidget(myTabWg);
+  aLay->addWidget(myIsVisible);
+
+  return aFrame;
+}
+
+/*!
+  Create frame containing buttons
+*/
+QWidget* ViewerTools_CubeAxesDlgBase::createButtonFrame(QWidget* theParent)
+{
+  QFrame* aFrame = new QFrame(theParent);
+  aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);
+
+  myOkBtn    = new QPushButton(tr("BUT_OK"), aFrame);
+  myApplyBtn = new QPushButton(tr("BUT_APPLY"), aFrame);
+  myCloseBtn = new QPushButton(tr("BUT_CLOSE"), aFrame);
+
+  QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
+
+  QHBoxLayout* aLay = new QHBoxLayout(aFrame);
+  aLay->setMargin(5);
+  aLay->setSpacing(5);
+
+  aLay->addWidget(myOkBtn);
+  aLay->addWidget(myApplyBtn);
+  aLay->addItem(aSpacer);
+  aLay->addWidget(myCloseBtn);
+
+  connect(myOkBtn,    SIGNAL(clicked()), SLOT(onOk()));
+  connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply()));
+  connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));
+
+  return aFrame;
+}
+
+/*!
+  Destructor
+*/
+ViewerTools_CubeAxesDlgBase::~ViewerTools_CubeAxesDlgBase()
+{
+}
+
+/*!
+  Update dialog fields, connect signals and slots, show dialog
+*/
+void ViewerTools_CubeAxesDlgBase::Update()
+{
+}
+
+/*!
+  Verify validity of entry data
+*/
+bool ViewerTools_CubeAxesDlgBase::isValid() const
+{
+  return true;
+}
+
+/*!
+  Verify validity of entry data
+*/
+bool ViewerTools_CubeAxesDlgBase::onApply()
+{
+  return true;
+}
+
+/*!
+  SLOT called when "Ok" button pressed.
+*/
+void ViewerTools_CubeAxesDlgBase::onOk()
+{
+  if (onApply())
+    onClose();
+}
+
+/*!
+  SLOT: called when "Close" button pressed. Close dialog
+*/
+void ViewerTools_CubeAxesDlgBase::onClose()
+{
+  reject();
+}
diff --git a/src/ViewerTools/ViewerTools_CubeAxesDlgBase.h b/src/ViewerTools/ViewerTools_CubeAxesDlgBase.h
new file mode 100644 (file)
index 0000000..d7e7b85
--- /dev/null
@@ -0,0 +1,119 @@
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  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 VIEWERTOOLS_CUBEAXESDLGBASE_H
+#define VIEWERTOOLS_CUBEAXESDLGBASE_H
+
+#include "ViewerTools_DialogBase.h"
+
+#include <QFrame>
+
+class QWidget;
+class QPushButton;
+class QTabWidget;
+class QCheckBox;
+class QGroupBox;
+class QLineEdit;
+
+class QtxAction;
+class QtxIntSpinBox;
+
+class ViewerTools_FontWidgetBase;
+
+/*!
+ * Class       : ViewerTools_AxisWidgetBase
+ * Description : Axis tab widget of the "Graduated axis" dialog box
+*/
+class VIEWERTOOLS_EXPORT ViewerTools_AxisWidgetBase : public QFrame
+{
+public:
+  ViewerTools_AxisWidgetBase( QWidget* );
+  ~ViewerTools_AxisWidgetBase();
+
+  void             UseName( const bool );
+  void             SetName( const QString& );
+  void             SetNameFont( const QColor&, const int, const bool, const bool, const bool );
+
+public:
+  virtual void     initialize();
+
+protected:
+  virtual ViewerTools_FontWidgetBase* createFontWidget( QWidget* ) = 0;
+
+protected:
+  // name
+  QGroupBox*       myNameGrp;
+  QLineEdit*       myAxisName;
+  ViewerTools_FontWidgetBase* myNameFont;
+
+  // labels
+  QGroupBox*       myLabelsGrp;
+  QtxIntSpinBox*   myLabelNumber;
+  QtxIntSpinBox*   myLabelOffset;
+  ViewerTools_FontWidgetBase* myLabelsFont;
+
+  // tick marks
+  QGroupBox*       myTicksGrp;
+  QtxIntSpinBox*   myTickLength;
+};
+
+/*!
+ * Class       : ViewerTools_CubeAxesDlgBase
+ * Description : Dialog for specifying cube axes properties
+ */
+class VIEWERTOOLS_EXPORT ViewerTools_CubeAxesDlgBase : public ViewerTools_DialogBase
+{
+  Q_OBJECT
+
+public:
+                  ViewerTools_CubeAxesDlgBase(QtxAction* theAction,
+                                              QWidget* theParent,
+                                              const char* theName);
+  virtual         ~ViewerTools_CubeAxesDlgBase();
+
+  virtual void    initialize();
+
+  virtual void    Update();
+
+protected slots:
+  virtual void    onOk();
+  virtual bool    onApply();
+  virtual void    onClose();
+
+protected:
+  virtual QWidget* createButtonFrame( QWidget* );
+  virtual QWidget* createMainFrame  ( QWidget* );
+  virtual bool    isValid() const;
+
+  virtual ViewerTools_AxisWidgetBase* createAxisWidget( QWidget* ) = 0;
+
+protected:
+  QTabWidget*     myTabWg;
+  QCheckBox*      myIsVisible;
+
+  QPushButton*    myOkBtn;
+  QPushButton*    myApplyBtn;
+  QPushButton*    myCloseBtn;
+  ViewerTools_AxisWidgetBase* myAxes[ 3 ];
+};
+
+#endif
diff --git a/src/ViewerTools/ViewerTools_DialogBase.cxx b/src/ViewerTools/ViewerTools_DialogBase.cxx
new file mode 100644 (file)
index 0000000..2fc0e40
--- /dev/null
@@ -0,0 +1,79 @@
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  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 "ViewerTools_DialogBase.h"
+
+#include "QtxAction.h"
+
+/*!
+  Constructor
+*/
+ViewerTools_DialogBase
+::ViewerTools_DialogBase(QtxAction* theAction,
+                         QWidget* theParent,
+                         const char* theName, 
+                         bool theModal, 
+                         Qt::WindowFlags theWFalgs):
+  QDialog(theParent, 
+          theWFalgs | Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
+  myAction(theAction)
+{
+  setObjectName(theName);
+  setModal(theModal);
+
+  connect(theParent, SIGNAL(Show( QShowEvent * )), this, SLOT(onParentShow()));
+  connect(theParent, SIGNAL(Hide( QHideEvent * )), this, SLOT(onParentHide()));
+}
+
+/*
+ *  Destroys the object and frees any allocated resources
+ */
+ViewerTools_DialogBase
+::~ViewerTools_DialogBase()
+{
+  // no need to delete child widgets, Qt does it all for us
+}
+
+void 
+ViewerTools_DialogBase
+::onParentShow()
+{
+  if(myAction->isChecked())
+    show();
+  else
+    hide();
+}
+
+void 
+ViewerTools_DialogBase
+::onParentHide()
+{
+  hide();
+}
+
+void 
+ViewerTools_DialogBase
+::done( int r )
+{
+  myAction->setChecked( false );
+  QDialog::done( r );
+}
diff --git a/src/ViewerTools/ViewerTools_DialogBase.h b/src/ViewerTools/ViewerTools_DialogBase.h
new file mode 100644 (file)
index 0000000..e9fcd56
--- /dev/null
@@ -0,0 +1,54 @@
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  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 VIEWERTOOLS_DIALOGBASE_H
+#define VIEWERTOOLS_DIALOGBASE_H
+
+#include "ViewerTools.h"
+
+#include <QDialog>
+
+class QtxAction;
+
+class VIEWERTOOLS_EXPORT ViewerTools_DialogBase : public QDialog
+{
+  Q_OBJECT;
+
+public:
+  ViewerTools_DialogBase(QtxAction* theAction,
+                         QWidget* theParent,
+                         const char* theName = "", 
+                         bool theModal = FALSE, 
+                         Qt::WindowFlags theWFalgs = 0);
+
+  ~ViewerTools_DialogBase();
+
+protected slots:
+  void onParentShow();
+  void onParentHide();
+  virtual void done( int );
+
+protected:
+  QtxAction* myAction;
+};
+
+#endif // VIEWERTOOLS_DIALOGBASE_H
diff --git a/src/ViewerTools/ViewerTools_FontWidgetBase.cxx b/src/ViewerTools/ViewerTools_FontWidgetBase.cxx
new file mode 100644 (file)
index 0000000..2558546
--- /dev/null
@@ -0,0 +1,128 @@
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  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 "ViewerTools_FontWidgetBase.h"
+
+#include <QToolButton>
+#include <QComboBox>
+#include <QColorDialog>
+#include <QCheckBox>
+#include <QHBoxLayout>
+
+/*!
+ * Class       : ViewerTools_FontWidgetBase
+ * Description : Dialog for specifynig font
+ */
+
+/*!
+  Constructor
+*/
+ViewerTools_FontWidgetBase::ViewerTools_FontWidgetBase( QWidget* theParent )
+: QWidget( theParent )
+{
+}
+
+/*!
+  Destructor
+*/
+ViewerTools_FontWidgetBase::~ViewerTools_FontWidgetBase()
+{
+}
+
+void ViewerTools_FontWidgetBase::Initialize()
+{
+  myColorBtn = new QToolButton( this );
+  myColorBtn->setMinimumWidth( 20 );
+
+  myFamily = new QComboBox( this );
+  InitializeFamilies();
+
+  myBold = new QCheckBox( tr( "BOLD" ), this );
+  myItalic = new QCheckBox( tr( "ITALIC" ), this );
+  myShadow = new QCheckBox( tr( "SHADOW" ), this );
+
+  QHBoxLayout* aHBLayout = new QHBoxLayout;
+  aHBLayout->setMargin( 0 );
+  aHBLayout->setSpacing( 5 );
+  aHBLayout->addWidget(myColorBtn);
+  aHBLayout->addWidget(myFamily);
+  aHBLayout->addWidget(myBold);
+  aHBLayout->addWidget(myItalic);
+  aHBLayout->addWidget(myShadow);
+  aHBLayout->addStretch();
+  this->setLayout(aHBLayout);
+
+  connect( myColorBtn, SIGNAL( clicked() ), SLOT( onColor() ) );
+
+  if( myFamily->count() == 0 )
+  {
+    myFamily->hide();
+    myBold->hide();
+    myItalic->hide();
+    myShadow->hide();
+  }
+}
+
+void ViewerTools_FontWidgetBase::SetColor( const QColor& theColor )
+{
+  QPalette palette;
+  palette.setColor(myColorBtn->backgroundRole(), theColor);
+  myColorBtn->setPalette(palette);
+}
+
+QColor ViewerTools_FontWidgetBase::GetColor() const
+{
+  return myColorBtn->palette().color( myColorBtn->backgroundRole() );
+}
+
+void ViewerTools_FontWidgetBase::onColor()
+{
+  QColor aColor = QColorDialog::getColor( GetColor(), this );
+  if ( aColor.isValid() )
+    SetColor( aColor );
+}
+
+void ViewerTools_FontWidgetBase::SetData( const QColor& theColor,
+                                          const int theFamily,
+                                          const bool theBold,
+                                          const bool theItalic,
+                                          const bool theShadow )
+{
+  SetColor( theColor );
+
+  myBold->setChecked( theBold );
+  myItalic->setChecked( theItalic );
+  myShadow->setChecked( theShadow );
+}
+
+void ViewerTools_FontWidgetBase::GetData( QColor& theColor,
+                                          int& theFamily,
+                                          bool& theBold,
+                                          bool& theItalic,
+                                          bool& theShadow ) const
+{
+  theColor = GetColor();
+
+  theBold = myBold->isChecked();
+  theItalic = myItalic->isChecked();
+  theShadow = myShadow->isChecked();
+}
diff --git a/src/ViewerTools/ViewerTools_FontWidgetBase.h b/src/ViewerTools/ViewerTools_FontWidgetBase.h
new file mode 100644 (file)
index 0000000..9ade57a
--- /dev/null
@@ -0,0 +1,71 @@
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  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 VIEWERTOOLS_FONTWIDGETBASE_H
+#define VIEWERTOOLS_FONTWIDGETBASE_H
+
+#include "ViewerTools.h"
+
+#include <QWidget>
+
+class QToolButton;
+class QComboBox;
+class QCheckBox;
+class QColor;
+
+/*!
+ * Class       : ViewerTools_FontWidgetBase
+ * Description : Dialog for specifying font
+ */
+class VIEWERTOOLS_EXPORT ViewerTools_FontWidgetBase : public QWidget
+{
+  Q_OBJECT
+
+public:
+                ViewerTools_FontWidgetBase( QWidget* );
+  virtual       ~ViewerTools_FontWidgetBase();
+
+  void          SetColor( const QColor& );
+  QColor        GetColor() const;
+
+  virtual void  SetData( const QColor&, const int, const bool, const bool, const bool );
+
+  virtual void  GetData( QColor&, int&, bool&, bool&, bool& ) const;
+
+public:
+  virtual void  Initialize();
+
+protected:
+  virtual void  InitializeFamilies() = 0;
+
+protected slots:
+  void          onColor();
+
+protected:
+  QToolButton*  myColorBtn;
+  QComboBox*    myFamily;
+  QCheckBox*    myBold;
+  QCheckBox*    myItalic;
+  QCheckBox*    myShadow;
+};
+
+#endif
diff --git a/src/ViewerTools/resources/ViewerTools_msg_en.ts b/src/ViewerTools/resources/ViewerTools_msg_en.ts
new file mode 100644 (file)
index 0000000..fe8c859
--- /dev/null
@@ -0,0 +1,95 @@
+<!DOCTYPE TS><TS>
+<!--
+  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+
+  Copyright (C) 2003-2007  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
+
+-->
+<context>
+    <name>ViewerTools_CubeAxesDlgBase</name>
+    <message>
+        <source>X_AXIS</source>
+        <translation>X axis</translation>
+    </message>
+    <message>
+        <source>Y_AXIS</source>
+        <translation>Y axis</translation>
+    </message>
+    <message>
+        <source>Z_AXIS</source>
+        <translation>Z axis</translation>
+    </message>
+    <message>
+        <source>CAPTION</source>
+        <translation>Graduated axes</translation>
+    </message>
+    <message>
+        <source>IS_VISIBLE</source>
+        <translation>Is visible</translation>
+    </message>
+    <message>
+        <source>FONT</source>
+        <translation>Font</translation>
+    </message>
+    <message>
+        <source>NAME</source>
+        <translation>Name</translation>
+    </message>
+    <message>
+        <source>TICK_MARKS</source>
+        <translation>Tick marks</translation>
+    </message>
+    <message>
+        <source>LABELS</source>
+        <translation>Labels</translation>
+    </message>
+    <message>
+        <source>LENGTH</source>
+        <translation>Length</translation>
+    </message>
+    <message>
+        <source>NUMBER</source>
+        <translation>Number</translation>
+    </message>
+    <message>
+        <source>OFFSET</source>
+        <translation>Offset</translation>
+    </message>
+    <message>
+        <source>AXIS_NAME</source>
+        <translation>Axis name</translation>
+    </message>
+</context>
+<context>
+    <name>ViewerTools_FontWidgetBase</name>
+    <message>
+        <source>BOLD</source>
+        <translation>Bold</translation>
+    </message>
+    <message>
+        <source>ITALIC</source>
+        <translation>Italic</translation>
+    </message>
+    <message>
+        <source>SHADOW</source>
+        <translation>Shadow</translation>
+    </message>
+</context>
+</TS>