From: mzn Date: Wed, 9 Aug 2006 12:33:04 +0000 (+0000) Subject: Fix for bug IPAL8977(3.0.0: Add funcitonality for operating of viewer actions by... X-Git-Tag: For_OCT_611~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=56a7c5c4f1d5ad1d615c6443697353de056b6435;p=modules%2Fgui.git Fix for bug IPAL8977(3.0.0: Add funcitonality for operating of viewer actions by buttons). --- diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 0ccc31bb4..bdc296e91 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -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() ) ); diff --git a/src/SPlot2d/Makefile.in b/src/SPlot2d/Makefile.in index 0304abbee..7e9240945 100644 --- a/src/SPlot2d/Makefile.in +++ b/src/SPlot2d/Makefile.in @@ -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 diff --git a/src/SPlot2d/SPlot2d_ViewModel.cxx b/src/SPlot2d/SPlot2d_ViewModel.cxx index 4ac94388f..bae830343 100644 --- a/src/SPlot2d/SPlot2d_ViewModel.cxx +++ b/src/SPlot2d/SPlot2d_ViewModel.cxx @@ -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; +} diff --git a/src/SPlot2d/SPlot2d_ViewModel.h b/src/SPlot2d/SPlot2d_ViewModel.h index c9968c055..7182def58 100644 --- a/src/SPlot2d/SPlot2d_ViewModel.h +++ b/src/SPlot2d/SPlot2d_ViewModel.h @@ -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 index 000000000..0e0a376b2 --- /dev/null +++ b/src/SPlot2d/SPlot2d_ViewWindow.cxx @@ -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 index 000000000..a11b45a64 --- /dev/null +++ b/src/SPlot2d/SPlot2d_ViewWindow.h @@ -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