]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Fix for bug IPAL8977(3.0.0: Add funcitonality for operating of viewer actions by...
authormzn <mzn@opencascade.com>
Wed, 9 Aug 2006 12:33:04 +0000 (12:33 +0000)
committermzn <mzn@opencascade.com>
Wed, 9 Aug 2006 12:33:04 +0000 (12:33 +0000)
src/LightApp/LightApp_Application.cxx
src/SPlot2d/Makefile.in
src/SPlot2d/SPlot2d_ViewModel.cxx
src/SPlot2d/SPlot2d_ViewModel.h
src/SPlot2d/SPlot2d_ViewWindow.cxx [new file with mode: 0644]
src/SPlot2d/SPlot2d_ViewWindow.h [new file with mode: 0644]

index 0ccc31bb46ba2b75ba10bd87e6c4a26b8fa62b91..bdc296e91e242e9562f3079572741cd2660263bb 100644 (file)
@@ -231,6 +231,15 @@ myPrefs( 0 )
   myAccel->setActionKey( SUIT_Accel::RotateUp,    ALT+Key_Up,        VTKViewer_Viewer::Type() );
   myAccel->setActionKey( SUIT_Accel::RotateDown,  ALT+Key_Down,      VTKViewer_Viewer::Type() );
 #endif
+#ifndef DISABLE_PLOT2DKVIEWER
+  myAccel->setActionKey( SUIT_Accel::PanLeft,     CTRL+Key_Left,     Plot2d_Viewer::Type() );
+  myAccel->setActionKey( SUIT_Accel::PanRight,    CTRL+Key_Right,    Plot2d_Viewer::Type() );
+  myAccel->setActionKey( SUIT_Accel::PanUp,       CTRL+Key_Up,       Plot2d_Viewer::Type() );
+  myAccel->setActionKey( SUIT_Accel::PanDown,     CTRL+Key_Down,     Plot2d_Viewer::Type() );
+  myAccel->setActionKey( SUIT_Accel::ZoomIn,      CTRL+Key_Plus,     Plot2d_Viewer::Type() );
+  myAccel->setActionKey( SUIT_Accel::ZoomOut,     CTRL+Key_Minus,    Plot2d_Viewer::Type() );
+  myAccel->setActionKey( SUIT_Accel::ZoomFit,     CTRL+Key_Asterisk, Plot2d_Viewer::Type() );
+#endif
 
   connect( mySelMgr, SIGNAL( selectionChanged() ), this, SLOT( onSelection() ) );
 
index 0304abbeed2c4d31f005a4b1d09bdf6b6241e9dc..7e92409458ebb3108792ab5ac9bf551fc3a413a2 100644 (file)
@@ -29,7 +29,8 @@ EXPORT_HEADERS = \
            SPlot2d.h \
            SPlot2d_Curve.h \
           SPlot2d_Prs.h \
-          SPlot2d_ViewModel.h
+          SPlot2d_ViewModel.h \
+          SPlot2d_ViewWindow.h
 
 # .po files to transform in .qm
 PO_FILES = SPlot2d_msg_en.po
@@ -40,10 +41,12 @@ LIB = libSPlot2d.la
 LIB_SRC =        \
            SPlot2d_Curve.cxx \
           SPlot2d_Prs.cxx \
-          SPlot2d_ViewModel.cxx
+          SPlot2d_ViewModel.cxx \
+          SPlot2d_ViewWindow.cxx
 
 LIB_MOC = \
-          SPlot2d_ViewModel.h
+          SPlot2d_ViewModel.h \
+          SPlot2d_ViewWindow.h
 
 CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(QWT_INCLUDES) $(BOOST_CPPFLAGS)
 LDFLAGS+=$(QT_MT_LIBS) $(QWT_LIBS) -lsuit -lPlot2d -lSalomePrs
index 4ac94388f3f518f1c2aa64a648a8beff54f72cd1..bae8303436f079cd5e61bcf3e05f07c46fa7c282 100644 (file)
@@ -22,6 +22,8 @@
 
 #include "SPlot2d_ViewModel.h"
 
+#include "SPlot2d_ViewWindow.h"
+
 #include "SPlot2d_Prs.h"
 #include "SUIT_Session.h"
 #include "SUIT_Application.h"
@@ -379,3 +381,14 @@ void SPlot2d_Viewer::onCloneView( Plot2d_ViewFrame* clonedVF, Plot2d_ViewFrame*
       newVF->displayCurve( *anIt, false );
   newVF->Repaint();
 }
+
+/*!
+  create SPlot2d_ViewWindow
+*/
+SUIT_ViewWindow* SPlot2d_Viewer::createView( SUIT_Desktop* theDesktop )
+{
+  SPlot2d_ViewWindow* aPlot2dView = new SPlot2d_ViewWindow(theDesktop, this);
+  if (getPrs())
+    aPlot2dView->getViewFrame()->Display(getPrs());
+  return aPlot2dView;
+}
index c9968c0550988c94494882bb3dd9881b63336121..7182def582893641f2b72880c7e3f65035c49691 100644 (file)
@@ -52,6 +52,8 @@ public:
   void rename( const Handle(SALOME_InteractiveObject)&, const QString&, Plot2d_ViewFrame* = 0 );
   void renameAll( const Handle(SALOME_InteractiveObject)&, const QString& );
   bool isInViewer( const Handle(SALOME_InteractiveObject)& IObject );
+
+  virtual   SUIT_ViewWindow* createView(SUIT_Desktop* theDesktop);
   
   /* display */                
   void Display( const Handle(SALOME_InteractiveObject)& IObject, bool update = true );
diff --git a/src/SPlot2d/SPlot2d_ViewWindow.cxx b/src/SPlot2d/SPlot2d_ViewWindow.cxx
new file mode 100644 (file)
index 0000000..0e0a376
--- /dev/null
@@ -0,0 +1,75 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either 
+// version 2.1 of the License.
+// 
+// This library is distributed in the hope that it will be useful 
+// but WITHOUT ANY WARRANTY; without even the implied warranty of 
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public  
+// License along with this library; if not, write to the Free Software 
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#include "SPlot2d_ViewWindow.h"
+
+#include "Plot2d_ViewFrame.h"
+
+#include "SUIT_Accel.h"
+
+/*!
+  Constructor
+*/
+SPlot2d_ViewWindow
+::SPlot2d_ViewWindow( SUIT_Desktop* theDesktop, 
+                     Plot2d_Viewer* theModel)
+  : Plot2d_ViewWindow( theDesktop, theModel )
+{
+}
+
+/*!
+  Destructor
+*/
+SPlot2d_ViewWindow
+::~SPlot2d_ViewWindow()
+{
+}
+
+/*!
+  Performs action
+  \param theAction - type of action
+*/
+bool 
+SPlot2d_ViewWindow
+::action( const int theAction  )
+{
+  switch ( theAction ) {
+  case SUIT_Accel::PanLeft: 
+    getViewFrame()->onPanLeft();
+    break;
+  case SUIT_Accel::PanRight: 
+    getViewFrame()->onPanRight();
+    break;
+  case SUIT_Accel::PanUp: 
+    getViewFrame()->onPanUp();
+    break;
+  case SUIT_Accel::PanDown: 
+    getViewFrame()->onPanDown();
+    break;
+  case SUIT_Accel::ZoomIn: 
+    getViewFrame()->onZoomIn();
+    break;
+  case SUIT_Accel::ZoomOut: 
+    getViewFrame()->onZoomOut();
+    break;
+  case SUIT_Accel::ZoomFit:
+    getViewFrame()->fitAll();
+    break;
+  }
+  return true;
+}
diff --git a/src/SPlot2d/SPlot2d_ViewWindow.h b/src/SPlot2d/SPlot2d_ViewWindow.h
new file mode 100644 (file)
index 0000000..a11b45a
--- /dev/null
@@ -0,0 +1,46 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either 
+// version 2.1 of the License.
+// 
+// This library is distributed in the hope that it will be useful 
+// but WITHOUT ANY WARRANTY; without even the implied warranty of 
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public  
+// License along with this library; if not, write to the Free Software 
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#ifndef SPLOT2D_VIEWWINDOW_H
+#define SPLOT2D_VIEWWINDOW_H
+
+#ifdef WIN32
+#pragma warning( disable:4251 )
+#endif
+
+#include "SPlot2d.h"
+#include "Plot2d_ViewWindow.h"
+
+class SPLOT2D_EXPORT SPlot2d_ViewWindow : public Plot2d_ViewWindow
+{
+  Q_OBJECT;
+
+public:
+  SPlot2d_ViewWindow( SUIT_Desktop*, Plot2d_Viewer* );
+  virtual ~SPlot2d_ViewWindow();
+  
+protected:
+  virtual bool      action( const int );
+
+};
+
+#ifdef WIN32
+#pragma warning( default:4251 )
+#endif
+
+#endif