Salome HOME
Merge remote branch 'origin/V7_dev' into V8_0_0_BR
[modules/gui.git] / src / Plot2d / Plot2d_ViewWindow.cxx
index 95b49ab033cfc65acfc3eb32861604b58b8bcdba..69e1310e15704c24a376144a90389911aca9404d 100755 (executable)
-// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
-// 
+// Copyright (C) 2007-2015  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 
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// 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 
+// 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/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-// Plot2d_ViewWindow.cxx: implementation of the Plot2d_ViewWindow class.
+
+// File   : Plot2d_ViewWindow.cxx
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
 //
-//////////////////////////////////////////////////////////////////////
 #include "Plot2d_ViewWindow.h"
 #include "Plot2d_ViewFrame.h"
 
-#include "SUIT_ViewManager.h"
-#include "SUIT_ResourceMgr.h"
-#include "SUIT_Session.h"
-#include "SUIT_ToolButton.h"
-#include "SUIT_Desktop.h"
-
-#include "QtxAction.h"
-
-#include <qstatusbar.h>
-#include <qlayout.h>
-#include <qapplication.h>
-#include <qpopupmenu.h>
-
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
-
-Plot2d_ViewWindow::Plot2d_ViewWindow(SUIT_Desktop* theDesktop, Plot2d_Viewer* theModel)
-: SUIT_ViewWindow(theDesktop)
+#include <SUIT_ViewManager.h>
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
+#include <SUIT_Desktop.h>
+#include <SUIT_MessageBox.h>
+
+#include <Qtx.h>
+#include <QtxAction.h>
+#include <QtxMultiAction.h>
+#include <QtxActionToolMgr.h>
+
+#include <QStatusBar>
+#include <QLayout>
+#include <QApplication>
+#include <QMenu>
+#include <QImage>
+#include <QToolBar>
+#include <QPaintEvent>
+#include <QActionGroup>
+#include <QPainter>
+#include <QPrinter>
+#include <QPrintDialog>
+
+#include <qwt_plot_curve.h>
+
+/*!
+  \class Plot2d_ViewWindow
+  \brief Plot2d view window.
+*/
+
+/*!
+  \brief Constructor.
+  \param theDesktop parent desktop window
+  \param theModel plt2d view model
+*/
+Plot2d_ViewWindow::Plot2d_ViewWindow( SUIT_Desktop* theDesktop, Plot2d_Viewer* theModel )
+: SUIT_ViewWindow( theDesktop )
 {
   myModel = theModel;
+}
+
+/*!
+  \brief Destructor.
+*/
+Plot2d_ViewWindow::~Plot2d_ViewWindow()
+{
+}
 
-  myViewFrame = new Plot2d_ViewFrame(this, "plotView");
-  setCentralWidget(myViewFrame);
+/*!
+  \brief Internal initialization.
+*/
+void Plot2d_ViewWindow::initLayout()
+{
+  myDumpImage = QImage();
+  myViewFrame = new Plot2d_ViewFrame( this, "plotView" );
+  setCentralWidget( myViewFrame );
 
-  myToolBar = new QToolBar(this);
-  myToolBar->setCloseMode(QDockWindow::Undocked);
-  myToolBar->setLabel(tr("LBL_TOOLBAR_LABEL"));
   createActions();
   createToolBar();
 
-  connect(myViewFrame, SIGNAL(vpModeHorChanged()), this, SLOT(onChangeHorMode()));
-  connect(myViewFrame, SIGNAL(vpModeVerChanged()), this, SLOT(onChangeVerMode()));
-  connect(myViewFrame, SIGNAL(vpCurveChanged()),   this, SLOT(onChangeCurveMode()));
-  connect(myViewFrame, SIGNAL(contextMenuRequested( QContextMenuEvent * )),
-          this,        SIGNAL(contextMenuRequested( QContextMenuEvent * )) );
+  connect( myViewFrame, SIGNAL( vpModeHorChanged() ), this, SLOT( onChangeHorMode() ) );
+  connect( myViewFrame, SIGNAL( vpModeVerChanged() ), this, SLOT( onChangeVerMode() ) );
+  connect( myViewFrame, SIGNAL( vpNormLModeChanged() ), this, SLOT( onChangeNormLMode() ) );
+  connect( myViewFrame, SIGNAL( vpNormRModeChanged() ), this, SLOT( onChangeNormRMode() ) );
+  connect( myViewFrame, SIGNAL( vpCurveChanged() ),   this, SLOT( onChangeCurveMode() ) );
+  connect( myViewFrame, SIGNAL( contextMenuRequested( QContextMenuEvent* ) ),
+           this,        SIGNAL( contextMenuRequested( QContextMenuEvent* ) ) );
 
+  myViewFrame->installEventFilter( this );
 }
 
-Plot2d_ViewWindow::~Plot2d_ViewWindow()
+/*!
+  \brief Get view model.
+  \return Plot2d view model
+*/
+Plot2d_Viewer* Plot2d_ViewWindow::getModel()
+{
+  return myModel;
+}
+
+/*!
+  \brief Put message to the status bar.
+  \param theMsg message text
+*/
+void Plot2d_ViewWindow::putInfo( const QString& theMsg )
 {
+  QStatusBar* aStatusBar = myDesktop->statusBar();
+  aStatusBar->showMessage( theMsg/*, 3000*/ );
+}
+
+/*!
+  \brief Get view frame window.
+  \return view frame window
+*/
+Plot2d_ViewFrame* Plot2d_ViewWindow::getViewFrame()
+{ 
+  return myViewFrame;
 }
 
-//****************************************************************
-void Plot2d_ViewWindow::putInfo(QString theMsg)
+/*!
+  \brief Get view window's toolbar.
+  \return toolbar
+*/
+QToolBar* Plot2d_ViewWindow::getToolBar()
 {
-  QStatusBar*  aStatusBar = myDesktop->statusBar();
-  aStatusBar->message(theMsg/*, 3000*/);
+  return toolMgr()->toolBar( myToolBar );
 }
 
-//****************************************************************
-void Plot2d_ViewWindow::contextMenuPopup( QPopupMenu* thePopup )
+/*!
+  \brief Fill popup menu with the actions,
+  \param thePopup popup menu
+*/
+void Plot2d_ViewWindow::contextMenuPopup( QMenu* thePopup )
 {
+  QtxActionToolMgr* mgr = toolMgr();
   // scaling
-  QPopupMenu* scalingPopup = new QPopupMenu( thePopup );
-  myActionsMap[ PModeXLinearId ]->addTo( scalingPopup );
-  myActionsMap[ PModeXLogarithmicId ]->addTo( scalingPopup );
-  onChangeHorMode();
-  scalingPopup->insertSeparator();
-  myActionsMap[ PModeYLinearId ]->addTo( scalingPopup );
-  myActionsMap[ PModeYLogarithmicId ]->addTo( scalingPopup );
-  thePopup->insertItem( tr( "SCALING_POPUP" ), scalingPopup );
-  onChangeVerMode();
+  QMenu* scalingPopup = thePopup->addMenu( tr( "SCALING_POPUP" ) );
+  scalingPopup->addAction( mgr->action( PModeXLinearId ) );
+  scalingPopup->addAction( mgr->action( PModeXLogarithmicId ) );
+  scalingPopup->addSeparator();
+  scalingPopup->addAction( mgr->action( PModeYLinearId ) );
+  scalingPopup->addAction( mgr->action( PModeYLogarithmicId ) );
+
+  // fit data
+  thePopup->addAction( tr( "TOT_PLOT2D_FITDATA" ), myViewFrame, SLOT( onFitData() ) );
 
-  thePopup->insertItem(tr("TOT_PLOT2D_FITDATA"), myViewFrame, SLOT(onFitData()));
   // curve type
-  QPopupMenu* curTypePopup = new QPopupMenu( thePopup );
-  myActionsMap[ CurvPointsId ]->addTo( curTypePopup );
-  myActionsMap[ CurvLinesId ]->addTo( curTypePopup );
-  myActionsMap[ CurvSplinesId ]->addTo( curTypePopup );
-  thePopup->insertItem( tr( "CURVE_TYPE_POPUP" ), curTypePopup );
+  QMenu* curTypePopup = thePopup->addMenu( tr( "CURVE_TYPE_POPUP" ) );
+  curTypePopup->addAction( mgr->action( CurvPointsId ) );
+  curTypePopup->addAction( mgr->action( CurvLinesId ) );
+  curTypePopup->addAction( mgr->action( CurvSplinesId ) );
+
+  //Normalization type
+  QMenu* normTypePopup = thePopup->addMenu( tr( "NORMALIZATION_TYPE_POPUP" ) );
+  normTypePopup->addAction( mgr->action( PModeNormLMinId ) );
+  normTypePopup->addAction( mgr->action( PModeNormLMaxId ) );
+  normTypePopup->addSeparator();
+  normTypePopup->addAction( mgr->action( PModeNormRMinId ) );
+  normTypePopup->addAction( mgr->action( PModeNormRMaxId ) );
+
 
   // legend
-  myActionsMap[ LegendId ]->addTo(thePopup);
+  thePopup->addAction( mgr->action( LegendId ) );
+
   // settings
-  myActionsMap[ CurvSettingsId ]->addTo(thePopup);
+  thePopup->addAction( mgr->action( CurvSettingsId ) );
 }
 
-//****************************************************************
-bool Plot2d_ViewWindow::eventFilter(QObject* watched, QEvent* e)
+/*!
+  \brief Custom event filter.
+  \param watched event receiver object
+  \param e event
+  \return \c true if further event processing should be stopped
+*/
+bool Plot2d_ViewWindow::eventFilter( QObject* watched, QEvent* e )
 {
-  if (watched == myViewFrame) {
-    int aType = e->type();
-    switch(aType) {
+  if ( watched == myViewFrame ) {
+    switch( e->type() ) {
     case QEvent::MouseButtonPress:
-      emit mousePressed(this, (QMouseEvent*) e);
+      emit mousePressed( this, (QMouseEvent*)e );
       return true;
-
     case QEvent::MouseButtonRelease:
-      emit mouseReleased(this, (QMouseEvent*) e);
+      emit mouseReleased( this, (QMouseEvent*)e );
       return true;
-
     case QEvent::MouseMove:
-      emit mouseMoving(this, (QMouseEvent*) e);
+      emit mouseMoving( this, (QMouseEvent*)e );
       return true;
-
     default:
       break;
     }
   }
-  return SUIT_ViewWindow::eventFilter(watched, e);
+  return SUIT_ViewWindow::eventFilter( watched, e );
 }
 
-//****************************************************************
+/*!
+  \brief Create actions for the view window.
+*/
 void Plot2d_ViewWindow::createActions()
 {
-  if ( !myActionsMap.isEmpty() )
-    return;
-
+  QtxActionToolMgr* mgr = toolMgr();
   QtxAction* aAction;
   SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
 
-  // Dump view
-  aAction = new QtxAction(tr("MNU_DUMP_VIEW"), aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_DUMP" ) ),
-                           tr( "MNU_DUMP_VIEW" ), 0, this);
-  aAction->setStatusTip(tr("DSC_DUMP_VIEW"));
-  connect(aAction, SIGNAL(activated()), this, SLOT(onDumpView()));
-  myActionsMap[ DumpId ] = aAction;
-
-  // FitAll
-  aAction = new QtxAction(tr("MNU_FITALL"), aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_FIT_ALL" ) ),
-                           tr( "MNU_FITALL" ), 0, this);
-  aAction->setStatusTip(tr("DSC_FITALL"));
-  connect(aAction, SIGNAL(activated()), this, SLOT(onFitAll()));
-  myActionsMap[ FitAllId ] = aAction;
-
-  // FitRect
-  aAction = new QtxAction(tr("MNU_FITRECT"), aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_FIT_AREA" ) ),
-                           tr( "MNU_FITRECT" ), 0, this);
-  aAction->setStatusTip(tr("DSC_FITRECT"));
-  connect(aAction, SIGNAL(activated()), this, SLOT(onFitRect()));
-  myActionsMap[ FitRectId ] = aAction;
-
-  // Zoom
-  aAction = new QtxAction(tr("MNU_ZOOM_VIEW"), aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_ZOOM" ) ),
-                           tr( "MNU_ZOOM_VIEW" ), 0, this);
-  aAction->setStatusTip(tr("DSC_ZOOM_VIEW"));
-  connect(aAction, SIGNAL(activated()), this, SLOT(onZoom()));
-  myActionsMap[ ZoomId ] = aAction;
-
-  // Panning
-  aAction = new QtxAction(tr("MNU_PAN_VIEW"), aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_PAN" ) ),
-                           tr( "MNU_PAN_VIEW" ), 0, this);
-  aAction->setStatusTip(tr("DSC_PAN_VIEW"));
-  connect(aAction, SIGNAL(activated()), this, SLOT(onPanning()));
-  myActionsMap[ PanId ] = aAction;
-
-  // Global Panning
-  aAction = new QtxAction(tr("MNU_GLOBALPAN_VIEW"), aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_GLOBALPAN" ) ),
-                           tr( "MNU_GLOBALPAN_VIEW" ), 0, this);
-  aAction->setStatusTip(tr("DSC_GLOBALPAN_VIEW"));
-  connect(aAction, SIGNAL(activated()), this, SLOT(onGlobalPanning()));
-  myActionsMap[ GlobalPanId ] = aAction;
-
-  // Curve type - points
-  aAction = new QtxAction(tr("TOT_PLOT2D_CURVES_POINTS"),
-                aResMgr->loadPixmap("Plot2d", tr("ICON_PLOT2D_CURVES_POINTS")),
-                tr("MEN_PLOT2D_CURVES_POINTS"), 0, this);
-  aAction->setStatusTip(tr("PRP_PLOT2D_CURVES_POINTS"));
-  connect(aAction, SIGNAL(activated()), this, SLOT(onCurves()));
-  aAction->setToggleAction(true);
-  myActionsMap[ CurvPointsId ] = aAction;
-
-  // Curve type - lines
-  aAction = new QtxAction(tr("TOT_PLOT2D_CURVES_LINES"),
-               aResMgr->loadPixmap("Plot2d", tr("ICON_PLOT2D_CURVES_LINES")),
-               tr("MEN_PLOT2D_CURVES_LINES"), 0, this);
-  aAction->setStatusTip(tr("PRP_PLOT2D_CURVES_LINES"));
-  connect(aAction, SIGNAL(activated()), this, SLOT(onCurves()));
-  aAction->setToggleAction(true);
-  myActionsMap[ CurvLinesId ] = aAction;
-
-  // Curve type - splines
-  aAction = new QtxAction(tr("TOT_PLOT2D_CURVES_SPLINES"),
-                 aResMgr->loadPixmap("Plot2d", tr("ICON_PLOT2D_CURVES_SPLINES")),
-                 tr("MEN_PLOT2D_CURVES_SPLINES"), 0, this);
-  aAction->setStatusTip(tr("PRP_PLOT2D_CURVES_SPLINES"));
-  connect(aAction, SIGNAL(activated()), this, SLOT(onCurves()));
-  aAction->setToggleAction(true);
-  myActionsMap[ CurvSplinesId ] = aAction;
-
-  // Mode for X (linear or logarithmic)
-  aAction = new QtxAction(tr("TOT_PLOT2D_MODE_LINEAR_HOR"),
-                 aResMgr->loadPixmap("Plot2d", tr("ICON_PLOT2D_MODE_LINEAR_HOR")),
-                 tr("MEN_PLOT2D_MODE_LINEAR_HOR"), 0, this);
-  aAction->setStatusTip (tr("PRP_PLOT2D_MODE_LINEAR_HOR"));
-  connect(aAction, SIGNAL(activated()), this, SLOT(onViewHorMode()));
-  myActionsMap[ HorId ] = aAction;
-
-  // Mode for Y (linear or logarithmic)
-  aAction = new QtxAction(tr("TOT_PLOT2D_MODE_LINEAR_VER"),
-                 aResMgr->loadPixmap("Plot2d", tr("ICON_PLOT2D_MODE_LINEAR_VER")),
-                 tr("MEN_PLOT2D_MODE_LINEAR_VER" ), 0, this);
-  aAction->setStatusTip(tr("PRP_PLOT2D_MODE_LINEAR_VER"));
-  connect(aAction, SIGNAL(activated()), this, SLOT(onViewVerMode()));
-  myActionsMap[ VerId ] = aAction;
-
-  // Legend
-  aAction = new QtxAction(tr("TOT_PLOT2D_SHOW_LEGEND"),
-                aResMgr->loadPixmap("Plot2d", tr("ICON_PLOT2D_SHOW_LEGEND")),
-                tr("MEN_PLOT2D_SHOW_LEGEND"), 0, this);
-  aAction->setStatusTip(tr("PRP_PLOT2D_SHOW_LEGEND"));
-  connect(aAction, SIGNAL(activated()), this, SLOT(onLegend()));
-  aAction->setToggleAction(true);
-  myActionsMap[ LegendId ] = aAction;
-
-  // Settings
-  aAction = new QtxAction(tr( "TOT_PLOT2D_SETTINGS"),
-                aResMgr->loadPixmap("Plot2d", tr("ICON_PLOT2D_SETTINGS")),
-                tr("MEN_PLOT2D_SETTINGS"), 0, this);
-  aAction->setStatusTip(tr( "PRP_PLOT2D_SETTINGS"));
-  connect(aAction, SIGNAL(activated()), myViewFrame, SLOT(onSettings()));
-  myActionsMap[ CurvSettingsId ] = aAction;
-
-  // Clone
-  aAction = new QtxAction(tr("MNU_CLONE_VIEW"), aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_CLONE_VIEW" ) ),
-                           tr( "MNU_CLONE_VIEW" ), 0, this);
-  aAction->setStatusTip(tr("DSC_CLONE_VIEW"));
-  connect(aAction, SIGNAL(activated()), this, SIGNAL(cloneView()));
-  myActionsMap[ CloneId ] = aAction;
-
-  /* Popup Actions */
-  /* Linear/logarithmic mode */
-  // Horizontal axis
-  aAction = new QtxAction(tr("TOT_PLOT2D_MODE_LINEAR_HOR"),
-                 aResMgr->loadPixmap("Plot2d", tr("ICON_PLOT2D_MODE_LINEAR_HOR")),
-                 tr("MEN_PLOT2D_MODE_LINEAR_HOR"), 0, this);
-  aAction->setStatusTip (tr("PRP_PLOT2D_MODE_LINEAR_HOR"));
-  aAction->setToggleAction(true);
-  myActionsMap[PModeXLinearId] = aAction;
-  connect(aAction, SIGNAL(activated()), this, SLOT(onViewHorMode()));
-
-  aAction = new QtxAction(tr("TOT_PLOT2D_MODE_LOGARITHMIC_HOR"),
-              aResMgr->loadPixmap("Plot2d", tr("ICON_PLOT2D_MODE_LOGARITHMIC_HOR")),
-              tr("MEN_PLOT2D_MODE_LOGARITHMIC_HOR"), 0, this);
-  aAction->setStatusTip(tr("PRP_PLOT2D_MODE_LOGARITHMIC_HOR"));
-  aAction->setToggleAction(true);
-  myActionsMap[PModeXLogarithmicId] = aAction;
-  connect(aAction, SIGNAL(activated()), this, SLOT(onViewHorMode()));
-
-  // Vertical axis
-  aAction = new QtxAction(tr("TOT_PLOT2D_MODE_LINEAR_VER"),
-                 aResMgr->loadPixmap("Plot2d", tr("ICON_PLOT2D_MODE_LINEAR_VER")),
-                 tr("MEN_PLOT2D_MODE_LINEAR_VER" ), 0, this);
-  aAction->setStatusTip(tr("PRP_PLOT2D_MODE_LINEAR_VER"));
-  aAction->setToggleAction(true);
-  myActionsMap[PModeYLinearId] = aAction;
-  connect(aAction, SIGNAL(activated()), this, SLOT(onViewVerMode()));
-
-  aAction = new QtxAction(tr("TOT_PLOT2D_MODE_LOGARITHMIC_VER"),
-                 aResMgr->loadPixmap("Plot2d", tr("ICON_PLOT2D_MODE_LOGARITHMIC_VER")),
-                 tr("MEN_PLOT2D_MODE_LOGARITHMIC_VER" ), 0, this);
-  aAction->setStatusTip(tr("PRP_PLOT2D_MODE_LOGARITHMIC_VER"));
-  aAction->setToggleAction(true);
-  myActionsMap[PModeYLogarithmicId] = aAction;
-  connect(aAction, SIGNAL(activated()), this, SLOT(onViewVerMode()));
-
-}
-
-//****************************************************************
+  // 1. Dump View
+  aAction = new QtxAction( tr( "MNU_DUMP_VIEW" ),
+                           aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_DUMP" ) ),
+                           tr( "MNU_DUMP_VIEW" ),
+                           0, this);
+  aAction->setStatusTip( tr( "DSC_DUMP_VIEW" ) );
+  connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onDumpView() ) );
+  mgr->registerAction( aAction, DumpId );
+
+  // 2. Scaling operations
+
+  // 2.1. Fit All
+  aAction = new QtxAction( tr( "MNU_FITALL" ),
+                           aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_FIT_ALL" ) ),
+                           tr( "MNU_FITALL" ),
+                           0, this);
+  aAction->setStatusTip( tr( "DSC_FITALL" ) );
+  connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onFitAll() ) );
+  mgr->registerAction( aAction, FitAllId );
+
+  // 2.2. Fit Rect
+  aAction = new QtxAction( tr( "MNU_FITRECT" ),
+                           aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_FIT_AREA" ) ),
+                           tr( "MNU_FITRECT" ),
+                           0, this);
+  aAction->setStatusTip( tr( "DSC_FITRECT" ) );
+  connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onFitRect() ) );
+  mgr->registerAction( aAction, FitRectId );
+
+  // 2.3. Zoom
+  aAction = new QtxAction( tr( "MNU_ZOOM_VIEW" ),
+                           aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_ZOOM" ) ),
+                           tr( "MNU_ZOOM_VIEW" ),
+                           0, this);
+  aAction->setStatusTip( tr( "DSC_ZOOM_VIEW" ) );
+  connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onZoom() ) );
+  mgr->registerAction( aAction, ZoomId );
+
+  // 2.4. Create multi-action for scaling operations
+  QtxMultiAction* aScaleAction = new QtxMultiAction( this );
+  aScaleAction->insertAction( mgr->action( FitAllId  ) );
+  aScaleAction->insertAction( mgr->action( FitRectId ) );
+  aScaleAction->insertAction( mgr->action( ZoomId    ) );
+  mgr->registerAction( aScaleAction, ScaleOpId );
+
+  // 3. Moving operations
+
+  // 3.1. Panning
+  aAction = new QtxAction( tr( "MNU_PAN_VIEW" ),
+                           aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_PAN" ) ),
+                           tr( "MNU_PAN_VIEW" ), 
+                           0, this);
+  aAction->setStatusTip( tr( "DSC_PAN_VIEW" ) );
+  connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onPanning() ) );
+  mgr->registerAction( aAction, PanId );
+
+  // 3.2. Global Panning
+  aAction = new QtxAction( tr( "MNU_GLOBALPAN_VIEW" ),
+                           aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_GLOBALPAN" ) ),
+                           tr( "MNU_GLOBALPAN_VIEW" ),
+                           0, this);
+  aAction->setStatusTip( tr( "DSC_GLOBALPAN_VIEW" ) );
+  connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onGlobalPanning() ) );
+  mgr->registerAction( aAction, GlobalPanId );
+
+  // 3.3. Create multi-action for moving operations
+  QtxMultiAction* aPanAction = new QtxMultiAction( this );
+  aPanAction->insertAction( mgr->action( PanId ) );
+  aPanAction->insertAction( mgr->action( GlobalPanId ) );
+  mgr->registerAction( aPanAction, MoveOpId );
+
+  // 4. Curve type operations
+  
+  // 4.1. Points
+  aAction = new QtxAction( tr( "TOT_PLOT2D_CURVES_POINTS" ),
+                           aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_CURVES_POINTS" ) ),
+                           tr( "MEN_PLOT2D_CURVES_POINTS" ),
+                           0, this );
+  aAction->setStatusTip( tr( "PRP_PLOT2D_CURVES_POINTS" ) );
+  aAction->setCheckable( true );
+  mgr->registerAction( aAction, CurvPointsId );
+
+  // 4.2. Lines
+  aAction = new QtxAction( tr( "TOT_PLOT2D_CURVES_LINES" ),
+                           aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_CURVES_LINES" ) ),
+                           tr( "MEN_PLOT2D_CURVES_LINES" ),
+                           0, this );
+  aAction->setStatusTip( tr( "PRP_PLOT2D_CURVES_LINES" ) );
+  aAction->setCheckable( true );
+  mgr->registerAction( aAction, CurvLinesId );
+
+  // 4.3. Splines
+  aAction = new QtxAction( tr( "TOT_PLOT2D_CURVES_SPLINES" ),
+                           aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_CURVES_SPLINES" ) ),
+                           tr( "MEN_PLOT2D_CURVES_SPLINES" ),
+                           0, this );
+  aAction->setStatusTip( tr( "PRP_PLOT2D_CURVES_SPLINES" ) );
+  aAction->setCheckable( true );
+  mgr->registerAction( aAction, CurvSplinesId );
+
+  // 4.4. Create action group for curve type operations
+  QActionGroup* aCurveGroup = new QActionGroup( this );
+  aCurveGroup->addAction( mgr->action( CurvPointsId ) );
+  aCurveGroup->addAction( mgr->action( CurvLinesId ) );
+  aCurveGroup->addAction( mgr->action( CurvSplinesId ) );
+  connect( aCurveGroup, SIGNAL( triggered( QAction* ) ), this, SLOT( onCurves() ) );
+
+  // 5. Horizontal scaling mode operations
+
+  // 5.1. Linear
+  aAction = new QtxAction( tr( "TOT_PLOT2D_MODE_LINEAR_HOR" ),
+                           aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_MODE_LINEAR_HOR" ) ),
+                           tr( "MEN_PLOT2D_MODE_LINEAR_HOR" ),
+                           0, this );
+  aAction->setStatusTip( tr( "PRP_PLOT2D_MODE_LINEAR_HOR" ) );
+  connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewHorMode() ) );
+  aAction->setCheckable( true );
+  mgr->registerAction( aAction, PModeXLinearId );
+  
+  // 5.2. Logarithmic
+  aAction = new QtxAction( tr( "TOT_PLOT2D_MODE_LOGARITHMIC_HOR" ),
+                           aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_MODE_LOGARITHMIC_HOR" ) ),
+                           tr( "MEN_PLOT2D_MODE_LOGARITHMIC_HOR" ),
+                           0, this );
+  aAction->setStatusTip( tr( "PRP_PLOT2D_MODE_LOGARITHMIC_HOR" ) );
+  connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewHorMode() ) );
+  aAction->setCheckable( true );
+  mgr->registerAction( aAction, PModeXLogarithmicId );
+
+  // 5.3. Create action group for horizontal scaling mode operations
+  QActionGroup* aHorGroup = new QActionGroup( this );
+  aHorGroup->addAction( mgr->action( PModeXLinearId ) );
+  aHorGroup->addAction( mgr->action( PModeXLogarithmicId ) );
+
+  // 6. Vertical scaling mode operations
+
+  // 6.1. Linear
+  aAction = new QtxAction( tr( "TOT_PLOT2D_MODE_LINEAR_VER" ),
+                           aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_MODE_LINEAR_VER" ) ),
+                           tr( "MEN_PLOT2D_MODE_LINEAR_VER" ),
+                           0, this );
+  aAction->setStatusTip( tr( "PRP_PLOT2D_MODE_LINEAR_VER" ) );
+  connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewVerMode() ) );
+  aAction->setCheckable( true );
+  mgr->registerAction( aAction, PModeYLinearId );
+
+  // 6.2. Logarithmic
+  aAction = new QtxAction( tr( "TOT_PLOT2D_MODE_LOGARITHMIC_VER" ),
+                           aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_MODE_LOGARITHMIC_VER" ) ),
+                           tr( "MEN_PLOT2D_MODE_LOGARITHMIC_VER" ),
+                           0, this );
+  aAction->setStatusTip( tr( "PRP_PLOT2D_MODE_LOGARITHMIC_VER" ) );
+  connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewVerMode() ) );
+  aAction->setCheckable( true );
+  mgr->registerAction( aAction, PModeYLogarithmicId );
+
+  // 6.3. Create action group for vertical scaling mode operations
+  QActionGroup* aVerGroup = new QActionGroup( this );
+  aVerGroup->addAction( mgr->action( PModeYLinearId ) );
+  aVerGroup->addAction( mgr->action( PModeYLogarithmicId ) );
+
+  // 7. Normalization mode operations
+
+  // 7.1. Normalize to the global minimum by left Y axis
+  aAction = new QtxAction( tr( "TOT_PLOT2D_NORMALIZE_MODE_LMIN" ),
+                           aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_NORMALIZE_MODE_LMIN" ) ),
+                           tr( "MEN_PLOT2D_NORMALIZE_MODE_LMIN" ),
+                           0, this );
+  aAction->setStatusTip( tr( "PRP_PLOT2D_NORMALIZE_MODE_LMIN" ) );
+  connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewNormLMode() ) );
+  aAction->setCheckable( true );
+  mgr->registerAction( aAction, PModeNormLMinId );
+
+  // 7.2. Normalize to the global maximum by right Y axis
+  aAction = new QtxAction( tr( "TOT_PLOT2D_NORMALIZE_MODE_LMAX" ),
+                           aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_NORMALIZE_MODE_LMAX" ) ),
+                           tr( "MEN_PLOT2D_NORMALIZE_MODE_LMAX" ),
+                           0, this );
+  aAction->setStatusTip( tr( "PRP_PLOT2D_NORMALIZE_MODE_LMAX" ) );
+  connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewNormLMode() ) );
+  aAction->setCheckable( true );
+  mgr->registerAction( aAction, PModeNormLMaxId );
+
+    // 7.3. Normalize to the global minimum by right Y axis
+  aAction = new QtxAction( tr( "TOT_PLOT2D_NORMALIZE_MODE_RMIN" ),
+                           aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_NORMALIZE_MODE_RMIN" ) ),
+                           tr( "MEN_PLOT2D_NORMALIZE_MODE_RMIN" ),
+                           0, this );
+  aAction->setStatusTip( tr( "PRP_PLOT2D_NORMALIZE_MODE_RMIN" ) );
+  connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewNormRMode() ) );
+  aAction->setCheckable( true );
+  mgr->registerAction( aAction, PModeNormRMinId );
+
+  // 7.4. Normalize to the global maximum by left Y axis
+  aAction = new QtxAction( tr( "TOT_PLOT2D_NORMALIZE_MODE_RMAX" ),
+                           aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_NORMALIZE_MODE_RMAX" ) ),
+                           tr( "MEN_PLOT2D_NORMALIZE_MODE_RMAX" ),
+                           0, this );
+  aAction->setStatusTip( tr( "PRP_PLOT2D_NORMALIZE_MODE_RMAX" ) );
+  connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onViewNormRMode() ) );
+  aAction->setCheckable( true );
+  mgr->registerAction( aAction, PModeNormRMaxId );
+
+  // 8. Legend
+  aAction = new QtxAction( tr( "TOT_PLOT2D_SHOW_LEGEND" ),
+                           aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_SHOW_LEGEND" ) ),
+                           tr( "MEN_PLOT2D_SHOW_LEGEND" ),
+                           0, this );
+  aAction->setStatusTip( tr( "PRP_PLOT2D_SHOW_LEGEND" ) );
+  connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onLegend() ) );
+  aAction->setCheckable( true );
+  mgr->registerAction( aAction, LegendId );
+
+  // 9. Settings
+  aAction = new QtxAction( tr( "TOT_PLOT2D_SETTINGS" ),
+                           aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_SETTINGS" ) ),
+                           tr( "MEN_PLOT2D_SETTINGS" ),
+                           0, this );
+
+  aAction->setStatusTip( tr( "PRP_PLOT2D_SETTINGS" ) );
+  connect( aAction, SIGNAL( triggered( bool ) ), myViewFrame, SLOT( onSettings() ) );
+  mgr->registerAction( aAction, CurvSettingsId );
+
+  // 9. Analytical curves
+  aAction = new QtxAction( tr( "TOT_PLOT2D_ANALYTICAL_CURVES" ),
+                           aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_ANALYTICAL_CURVES" ) ),
+                           tr( "MEN_PLOT2D_ANALYTICAL_CURVES" ),
+                           0, this );
+
+  aAction->setStatusTip( tr( "PRP_PLOT2D_ANALYTICAL_CURVES" ) );
+  connect( aAction, SIGNAL( triggered( bool ) ), myViewFrame, SLOT( onAnalyticalCurve() ) );
+  mgr->registerAction( aAction, AnalyticalCurveId );
+
+  // 10. Clone
+  aAction = new QtxAction( tr( "MNU_CLONE_VIEW" ),
+                           aResMgr->loadPixmap( "Plot2d", tr( "ICON_PLOT2D_CLONE_VIEW" ) ),
+                           tr( "MNU_CLONE_VIEW" ),
+                           0, this);
+  aAction->setStatusTip( tr( "DSC_CLONE_VIEW" ) );
+  connect( aAction, SIGNAL( triggered( bool ) ), this, SIGNAL( cloneView() ) );
+  mgr->registerAction( aAction, CloneId );
+
+  // 11. Print 
+  aAction = new QtxAction( tr( "MNU_PRINT_VIEW" ),
+                          aResMgr->loadPixmap( "STD", tr( "ICON_PLOT2D_PRINT" ) ),
+                           tr( "MNU_PRINT_VIEW" ),
+                          0, this);
+  aAction->setStatusTip( tr( "DSC_PRINT_VIEW" ) );
+  connect( aAction, SIGNAL( triggered( bool ) ), this, SLOT( onPrintView() ) );
+  mgr->registerAction( aAction, PrintId );
+
+  // Set initial values
+  onChangeCurveMode();
+  onChangeHorMode();
+  onChangeVerMode();
+  onChangeNormLMode();
+  onChangeNormRMode();
+  onChangeLegendMode();
+}
+
+/*!
+  \brief Create toolbar for the view window.
+*/
 void Plot2d_ViewWindow::createToolBar()
 {
-  myActionsMap[DumpId]->addTo(myToolBar);
-
-  SUIT_ToolButton* aScaleBtn = new SUIT_ToolButton(myToolBar);
-  aScaleBtn->AddAction(myActionsMap[FitAllId]);
-  aScaleBtn->AddAction(myActionsMap[FitRectId]);
-  aScaleBtn->AddAction(myActionsMap[ZoomId]);
-
-  SUIT_ToolButton* aPanBtn = new SUIT_ToolButton(myToolBar);
-  aPanBtn->AddAction(myActionsMap[PanId]);
-  aPanBtn->AddAction(myActionsMap[GlobalPanId]);
+  QtxActionToolMgr* mgr = toolMgr();
+  myToolBar = mgr->createToolBar( tr( "LBL_TOOLBAR_LABEL" ),          // title (language-dependant)
+                                 QString( "Plot2dViewOperations" ),  // name (language-independant)
+                                 false );                            // disable floatable toolbar
+  mgr->append( DumpId, myToolBar );
+  mgr->append( ScaleOpId, myToolBar );
+  mgr->append( MoveOpId, myToolBar );
+  mgr->append( toolMgr()->separator(), myToolBar );
+  mgr->append( CurvPointsId, myToolBar );
+  mgr->append( CurvLinesId, myToolBar );
+  mgr->append( CurvSplinesId, myToolBar );
+  mgr->append( toolMgr()->separator(), myToolBar );
+  mgr->append( PModeNormLMaxId, myToolBar );
+  mgr->append( PModeNormLMinId, myToolBar );
+  mgr->append( toolMgr()->separator(), myToolBar );
+  mgr->append( PModeNormRMaxId, myToolBar );
+  mgr->append( PModeNormRMinId, myToolBar );
+  mgr->append( toolMgr()->separator(), myToolBar );
+  mgr->append( PModeXLinearId, myToolBar );
+  mgr->append( PModeXLogarithmicId, myToolBar );
+  mgr->append( toolMgr()->separator(), myToolBar );
+  mgr->append( PModeYLinearId, myToolBar );
+  mgr->append( PModeYLogarithmicId, myToolBar );
+  mgr->append( toolMgr()->separator(), myToolBar );
+  mgr->append( LegendId, myToolBar );
+  mgr->append( CurvSettingsId, myToolBar );
+  mgr->append( AnalyticalCurveId, myToolBar );
+  mgr->append( CloneId, myToolBar );
+  mgr->append( PrintId, myToolBar );
+}
 
-  myCurveBtn = new SUIT_ToolButton(myToolBar);
-  myCurveBtn->AddAction(myActionsMap[CurvPointsId]);
-  myCurveBtn->AddAction(myActionsMap[CurvLinesId]);
-  myCurveBtn->AddAction(myActionsMap[CurvSplinesId]);
-  myActionsMap[CurvLinesId]->setOn(true);
-  onChangeCurveMode();
+/*!
+  \brief Get the visual parameters of the view window.
+  \return visual parameters of this view window formatted to the string
+*/
+QString Plot2d_ViewWindow::getVisualParameters()
+{
+  return myViewFrame->getVisualParameters();
+}
 
-  myActionsMap[HorId]->addTo(myToolBar);
-  onChangeHorMode();
-  myActionsMap[VerId]->addTo(myToolBar);
-  onChangeVerMode();
+/*!
+  \brief Restore visual parameters of the view window from the formated string
+  \param parameters view window visual parameters
+*/
+void Plot2d_ViewWindow::setVisualParameters( const QString& parameters )
+{
+  myViewFrame->setVisualParameters( parameters );
+}
 
-  myActionsMap[LegendId]->addTo(myToolBar);
-  myActionsMap[CurvSettingsId]->addTo(myToolBar);
-  myActionsMap[CloneId]->addTo(myToolBar);
-  onChangeLegendMode();
+/*!
+  \brief Grab the view window to the internal image.
+*/
+void Plot2d_ViewWindow::RefreshDumpImage()
+{
+  QPixmap px = QPixmap::grabWindow( myViewFrame->winId() );
+  myDumpImage = px.toImage();
 }
 
-//****************************************************************
+/*!
+  \brief Called when the scale mode for the horizontal axis is changed.
+*/
 void Plot2d_ViewWindow::onChangeHorMode()
 {
-  bool aLinear = myViewFrame->isModeHorLinear();
-  SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
-
-  myActionsMap[PModeXLinearId]->setOn( aLinear );
-  myActionsMap[PModeXLogarithmicId]->setOn( !aLinear );
+  bool aHorLinear = myViewFrame->isModeHorLinear();
+  bool aVerLinear = myViewFrame->isModeVerLinear();
 
-  QPixmap pix = aResMgr->loadPixmap( "Plot2d", tr( aLinear ? "ICON_PLOT2D_MODE_LOGARITHMIC_HOR" :
-                                                             "ICON_PLOT2D_MODE_LINEAR_HOR" ) );
-  myActionsMap[HorId]->setIconSet( pix );
-  myActionsMap[HorId]->setToolTip( tr( aLinear ? "TOT_PLOT2D_MODE_LOGARITHMIC_HOR" :
-                                                 "TOT_PLOT2D_MODE_LINEAR_HOR" ) );
-  myActionsMap[HorId]->setStatusTip( tr( aLinear ? "PRP_PLOT2D_MODE_LOGARITHMIC_HOR" :
-                                                   "PRP_PLOT2D_MODE_LINEAR_HOR" ) );
+  if ( aHorLinear )
+    toolMgr()->action( PModeXLinearId )->setChecked( true );
+  else
+    toolMgr()->action( PModeXLogarithmicId )->setChecked( true );
 
-  myActionsMap[GlobalPanId]->setEnabled( myViewFrame->isModeVerLinear() && myViewFrame->isModeHorLinear() );
+  toolMgr()->action( GlobalPanId )->setEnabled( aHorLinear && aVerLinear );
 }
 
-//****************************************************************
+/*!
+  \brief Called when the scale mode for the vertical axis is changed.
+*/
 void Plot2d_ViewWindow::onChangeVerMode()
 {
-  bool aLinear = myViewFrame->isModeVerLinear();
-  SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+  bool aHorLinear = myViewFrame->isModeHorLinear();
+  bool aVerLinear = myViewFrame->isModeVerLinear();
 
-  myActionsMap[PModeYLinearId]->setOn( aLinear );
-  myActionsMap[PModeYLogarithmicId]->setOn( !aLinear );
+  if ( aVerLinear )
+    toolMgr()->action( PModeYLinearId )->setChecked( true );
+  else
+    toolMgr()->action( PModeYLogarithmicId )->setChecked( true );
 
-  QPixmap pix = aResMgr->loadPixmap( "Plot2d", tr( aLinear ? "ICON_PLOT2D_MODE_LOGARITHMIC_VER" :
-                                                             "ICON_PLOT2D_MODE_LINEAR_VER" ) );
-  myActionsMap[VerId]->setIconSet( pix );
-  myActionsMap[VerId]->setToolTip( tr( aLinear ? "TOT_PLOT2D_MODE_LOGARITHMIC_VER" :
-                                                 "TOT_PLOT2D_MODE_LINEAR_VER" ) );
-  myActionsMap[VerId]->setStatusTip( tr( aLinear ? "PRP_PLOT2D_MODE_LOGARITHMIC_VER" :
-                                                   "PRP_PLOT2D_MODE_LINEAR_VER" ) );
+  toolMgr()->action( GlobalPanId )->setEnabled( aHorLinear && aVerLinear );
+}
 
-  myActionsMap[GlobalPanId]->setEnabled( myViewFrame->isModeVerLinear() && myViewFrame->isModeHorLinear() );
+/*!
+  \brief Called when the normalization mode (by left Y axis) for curves is changed.
+*/
+void Plot2d_ViewWindow::onChangeNormLMode()
+{
+  bool aNormMax = myViewFrame->isNormLMaxMode();
+  bool aNormMin = myViewFrame->isNormLMinMode();
+
+  if ( aNormMax )
+    toolMgr()->action( PModeNormLMaxId )->setChecked( true );
+  else
+    toolMgr()->action( PModeNormLMaxId )->setChecked( false );
+  if ( aNormMin )
+    toolMgr()->action( PModeNormLMinId )->setChecked( true );
+  else
+    toolMgr()->action( PModeNormLMinId )->setChecked( false );
 }
 
-//****************************************************************
+/*!
+  \brief Called when the normalization mode (by left Y axis) for curves is changed.
+*/
+void Plot2d_ViewWindow::onChangeNormRMode()
+{
+  bool aNormMax = myViewFrame->isNormRMaxMode();
+  bool aNormMin = myViewFrame->isNormRMinMode();
+
+  if ( aNormMax )
+    toolMgr()->action( PModeNormRMaxId )->setChecked( true );
+  else
+    toolMgr()->action( PModeNormRMaxId )->setChecked( false );
+  if ( aNormMin )
+    toolMgr()->action( PModeNormRMinId )->setChecked( true );
+  else
+    toolMgr()->action( PModeNormRMinId )->setChecked( false );
+}
+
+/*!
+  \brief Called when the curve type is changed.
+*/
 void Plot2d_ViewWindow::onChangeCurveMode()
 {
-  myCurveBtn->SetItem(myViewFrame->getCurveType());
+  switch ( myViewFrame->getCurveType() ) {
+  case 0:
+    toolMgr()->action( CurvPointsId )->setChecked( true );
+    break;
+  case 1:
+    toolMgr()->action( CurvLinesId )->setChecked( true );
+    break;
+  case 2:
+    toolMgr()->action( CurvSplinesId )->setChecked( true );
+    break;
+  default:
+    break;
+  }
 }
 
-//****************************************************************
+/*!
+  \brief Called when the legend mode is changed.
+*/
 void Plot2d_ViewWindow::onChangeLegendMode()
 {
-  myActionsMap[ LegendId ]->setOn(myViewFrame->isLegendShow());
+  toolMgr()->action( LegendId )->setChecked( myViewFrame->isLegendShow() );
 }
 
-//****************************************************************
+/*!
+  \brief Called when the "Fit all" action is activated.
+*/
 void Plot2d_ViewWindow::onFitAll()
 {
   myViewFrame->onViewFitAll();
 }
 
-//****************************************************************
+/*!
+  \brief Called when the "Fit rect" action is activated.
+*/
 void Plot2d_ViewWindow::onFitRect()
 {
   myViewFrame->onViewFitArea();
 }
 
-//****************************************************************
+/*!
+  \brief Called when the "Zoom" action is activated.
+*/
 void Plot2d_ViewWindow::onZoom()
 {
   myViewFrame->onViewZoom();
 }
 
-//****************************************************************
+/*!
+  \brief Called when the "Panning" action is activated.
+*/
 void Plot2d_ViewWindow::onPanning()
 {
   myViewFrame->onViewPan();
 }
 
-//****************************************************************
+/*!
+  \brief Called when the "Global panning" action is activated.
+*/
 void Plot2d_ViewWindow::onGlobalPanning()
 {
   myViewFrame->onViewGlobalPan();
 }
 
-//****************************************************************
+/*!
+  \brief Called when horizontal axis scale mode action is activated.
+*/
 void Plot2d_ViewWindow::onViewHorMode()
 {
-  if (myViewFrame->isModeHorLinear())
-    myViewFrame->setHorScaleMode(1);
-  else
-    myViewFrame->setHorScaleMode(0);
+  myViewFrame->setHorScaleMode( toolMgr()->action( PModeXLinearId )->isChecked() ? 0 : 1 );
 }
 
-//****************************************************************
+/*!
+  \brief Called when vertical axis scale mode action is activated.
+*/
 void Plot2d_ViewWindow::onViewVerMode()
 {
-  if (myViewFrame->isModeVerLinear())
-    myViewFrame->setVerScaleMode(1);
-  else
-    myViewFrame->setVerScaleMode(0);
+  myViewFrame->setVerScaleMode( toolMgr()->action( PModeYLinearId )->isChecked() ? 0 : 1 );
+}
+
+/*!
+  \brief Called when normalization mode action (by left Y axis) is activated.
+*/
+
+void Plot2d_ViewWindow::onViewNormLMode()
+{
+  myViewFrame->setNormLMaxMode( toolMgr()->action( PModeNormLMaxId )->isChecked() ? true : false );
+  myViewFrame->setNormLMinMode( toolMgr()->action( PModeNormLMinId )->isChecked() ? true : false );
+}
+
+/*!
+  \brief Called when normalization mode action (by right Y axis) is activated.
+*/
+
+void Plot2d_ViewWindow::onViewNormRMode()
+{
+  myViewFrame->setNormRMaxMode( toolMgr()->action( PModeNormRMaxId )->isChecked() ? true : false );
+  myViewFrame->setNormRMinMode( toolMgr()->action( PModeNormRMinId )->isChecked() ? true : false );
 }
 
-//****************************************************************
+/*!
+  \brief Called when the "Show legend" action is activated.
+*/
 void Plot2d_ViewWindow::onLegend()
 {
-  myViewFrame->showLegend(!myViewFrame->isLegendShow());
+  myViewFrame->showLegend( !myViewFrame->isLegendShow() );
   onChangeLegendMode();
 }
 
-//****************************************************************
+/*!
+  \brief Called when the "Change curve type" action is activated.
+*/
 void Plot2d_ViewWindow::onCurves()
 {
-  QtxAction* aSender = (QtxAction*) sender();
-  if(aSender == myActionsMap[CurvPointsId]) {
-    myActionsMap[CurvPointsId]->setOn(true);
-    myActionsMap[CurvLinesId]->setOn(false);
-    myActionsMap[CurvSplinesId]->setOn(false);
-    myViewFrame->setCurveType(0);
-  }
-  else if(aSender == myActionsMap[CurvLinesId]) {
-    myActionsMap[CurvLinesId]->setOn(true);
-    myActionsMap[CurvPointsId]->setOn(false);
-    myActionsMap[CurvSplinesId]->setOn(false);
-    myViewFrame->setCurveType(1);
-  }
-  else if(aSender == myActionsMap[CurvSplinesId]) {
-    myActionsMap[CurvSplinesId]->setOn( true );
-    myActionsMap[CurvPointsId]->setOn( false );
-    myActionsMap[CurvLinesId]->setOn( false );
-    myViewFrame->setCurveType(2);
-  }
+  if( toolMgr()->action( CurvPointsId )->isChecked() )
+    myViewFrame->setCurveType( 0 );
+  else if ( toolMgr()->action( CurvLinesId )->isChecked() )
+    myViewFrame->setCurveType( 1 );
+  else if ( toolMgr()->action( CurvSplinesId )->isChecked() )
+    myViewFrame->setCurveType( 2 );
 }
-
-//****************************************************************
+/*!
+  \brief Called when the "Dump view" action is activated.
+*/
 void Plot2d_ViewWindow::onDumpView()
 {
-  qApp->postEvent( myViewFrame, new QPaintEvent( QRect( 0, 0, myViewFrame->width(), myViewFrame->height() ), TRUE ) );
+  qApp->postEvent( myViewFrame, new QPaintEvent( QRect( 0, 0, myViewFrame->width(), myViewFrame->height() ) ) );
   SUIT_ViewWindow::onDumpView();
 }
 
-//****************************************************************
+/*!
+  \brief Dump the contents of the view window to the image.
+  \return image, containing all scene rendered in the window
+*/
 QImage Plot2d_ViewWindow::dumpView()
 {
-  QPixmap px = QPixmap::grabWindow( myViewFrame->winId() );
-  return px.convertToImage();
+  if ( getToolBar()->underMouse() || myDumpImage.isNull() ) {
+    QPixmap px = QPixmap::grabWindow( myViewFrame->winId() );
+    return px.toImage();
+  }
+  
+  return myDumpImage;
+}
+
+/*!
+  \brief Dump scene rendered in the view window to the file.
+  \param img image
+  \param fileName name of file
+  \param format image format ("BMP" [default], "JPEG", "JPG", "PNG")
+*/
+bool Plot2d_ViewWindow::dumpViewToFormat( const QImage&  img,
+                                          const QString& fileName, 
+                                          const QString& format )
+{
+  bool res = myViewFrame ? myViewFrame->print( fileName, format ) : false;
+  if( !res )
+    res = SUIT_ViewWindow::dumpViewToFormat( img, fileName, format );
+
+  return res;
+}
+
+/*!
+  \brief Get supported image files wildcards.
+  \return image files wildcards (list of wildcards, separated by ";;")
+*/
+QString Plot2d_ViewWindow::filter() const
+{
+  QStringList filters = SUIT_ViewWindow::filter().split( ";;", QString::SkipEmptyParts );
+  filters << tr( "PDF_FILES" );
+  filters << tr( "POSTSCRIPT_FILES" );
+  filters << tr( "ENCAPSULATED_POSTSCRIPT_FILES" );
+  return filters.join( ";;" );
+}
+
+/*!
+  \brief Called when the "Print view" action is activated.
+*/
+void Plot2d_ViewWindow::onPrintView()
+{
+  if ( !myViewFrame )
+    return;
+
+#if !defined(WIN32) && !defined(QT_NO_CUPS)
+#if QT_VERSION < 0x040303
+  if ( !Qtx::hasAnyPrinters() ) {
+    SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ),
+                              tr( "WRN_NO_PRINTERS" ) );
+    return;
+  }
+#endif
+#endif
+
+  // stored settings for further starts
+  static QString aPrinterName;
+  static int aColorMode = -1;
+  static int anOrientation = -1;
+
+  QPrinter aPrinter;
+
+  // restore settinds from previous launching
+
+  // printer name
+  if ( !aPrinterName.isEmpty() )
+    aPrinter.setPrinterName( aPrinterName );
+  else 
+  {
+    // Nothing to do for the first printing. aPrinter contains default printer name by default
+  }
+
+  // color mode
+  if ( aColorMode >= 0 )
+    aPrinter.setColorMode( (QPrinter::ColorMode)aColorMode );
+  else 
+  {
+    // Black-and-wight printers are often used
+    aPrinter.setColorMode( QPrinter::GrayScale );
+  }
+
+  if ( anOrientation >= 0 )
+    aPrinter.setOrientation( (QPrinter::Orientation)anOrientation );
+  else
+    aPrinter.setOrientation( QPrinter::Landscape );
+
+  QPrintDialog printDlg( &aPrinter, this );
+  printDlg.setPrintRange( QAbstractPrintDialog::AllPages );
+  if ( printDlg.exec() != QDialog::Accepted ) 
+    return;
+
+  // store printer settings for further starts
+  aPrinterName = aPrinter.printerName();
+  aColorMode = aPrinter.colorMode();
+  anOrientation = aPrinter.orientation();
+  
+  int W, H;
+  QPainter aPainter;
+
+  bool needColorCorrection = aPrinter.colorMode() == QPrinter::GrayScale;
+
+  // work arround for printing on real printer
+  if ( aPrinter.outputFileName().isEmpty() && aPrinter.orientation() == QPrinter::Landscape )
+  {
+    aPrinter.setFullPage( false );
+    // set paper orientation and rotate painter
+    aPrinter.setOrientation( QPrinter::Portrait );
+
+    W = aPrinter.height();
+    H = aPrinter.width();
+
+    aPainter.begin( &aPrinter );
+    aPainter.translate( QPoint( H, 0 ) );
+    aPainter.rotate( 90 );
+  }
+  else 
+  {
+    aPrinter.setFullPage( false );
+    aPainter.begin( &aPrinter );
+    W = aPrinter.width();
+    H = aPrinter.height();
+  }
+
+  QMap< QwtPlotCurve*, QPen > aCurvToPen;
+  QMap< QwtPlotCurve*, QwtSymbol* > aCurvToSymbol;
+
+  if ( needColorCorrection )
+  {
+    // Iterate through, store temporary their parameters and assign 
+    // parameters proper for printing
+
+    CurveDict aCurveDict = myViewFrame->getCurves();
+    CurveDict::iterator it;
+    for ( it = aCurveDict.begin(); it != aCurveDict.end(); it++ ) 
+    {
+      QwtPlotCurve* aCurve = it.key();
+      if ( !aCurve )
+        continue;
+
+      // pen
+      QPen aPen = aCurve->pen();
+      aCurvToPen[ aCurve ] = aPen;
+
+      aPen.setColor( QColor( 0, 0, 0 ) );
+      aPen.setWidthF( 1.5 );
+
+      aCurve->setPen( aPen );
+
+      // symbol
+      QwtSymbol* aSymbol = const_cast<QwtSymbol*>( aCurve->symbol() );
+      aCurvToSymbol[ aCurve ] = aSymbol;
+      aPen = aSymbol->pen();
+      aPen.setColor( QColor( 0, 0, 0 ) );
+      aPen.setWidthF( 1.5 );
+      aSymbol->setPen( aPen );
+
+      aCurve->setSymbol( aSymbol );
+    }
+  }
+
+  myViewFrame->printPlot( &aPainter, QRect( 0, 0, W, H ) );
+  aPainter.end();
+
+  // restore old pens and symbols
+  if ( needColorCorrection && !aCurvToPen.isEmpty() )
+  {
+    CurveDict aCurveDict = myViewFrame->getCurves();
+    CurveDict::iterator it;
+    for ( it = aCurveDict.begin(); it != aCurveDict.end(); it++ ) 
+    {
+      QwtPlotCurve* aCurve = it.key();
+      if ( !aCurve || 
+           !aCurvToPen.contains( aCurve ) ||
+           !aCurvToSymbol.contains( aCurve ) )
+        continue;
+
+      aCurve->setPen( aCurvToPen[ aCurve ] );
+      aCurve->setSymbol( aCurvToSymbol[ aCurve ] );
+    }
+  }
 }
+
+/*!
+  \fn void Plot2d_ViewWindow::cloneView();
+  \brief Emitted when the "Clone View" action is activated.
+*/