From: nds Date: Thu, 26 Dec 2013 06:51:12 +0000 (+0000) Subject: Copy/paste view position. X-Git-Tag: BR_hydro_v_0_7~53 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e8c1369317da0dca7532281d3f131bc25875e1f4;p=modules%2Fhydro.git Copy/paste view position. --- diff --git a/src/HYDROGUI/CMakeLists.txt b/src/HYDROGUI/CMakeLists.txt index 64cbc1d8..a9100150 100644 --- a/src/HYDROGUI/CMakeLists.txt +++ b/src/HYDROGUI/CMakeLists.txt @@ -10,6 +10,7 @@ set(PROJECT_HEADERS HYDROGUI_ChannelOp.h HYDROGUI_ColorWidget.h HYDROGUI_CopyPasteOp.h + HYDROGUI_CopyPastePositionOp.h HYDROGUI_DataBrowser.h HYDROGUI_DataModel.h HYDROGUI_DataObject.h @@ -93,6 +94,7 @@ set(PROJECT_SOURCES HYDROGUI_ChannelOp.cxx HYDROGUI_ColorWidget.cxx HYDROGUI_CopyPasteOp.cxx + HYDROGUI_CopyPastePositionOp.cxx HYDROGUI_DataBrowser.cxx HYDROGUI_DataModel.cxx HYDROGUI_DataObject.cxx diff --git a/src/HYDROGUI/HYDROGUI_CopyPastePositionOp.cxx b/src/HYDROGUI/HYDROGUI_CopyPastePositionOp.cxx new file mode 100644 index 00000000..c959cf54 --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_CopyPastePositionOp.cxx @@ -0,0 +1,68 @@ +// Copyright (C) 2007-2013 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 "HYDROGUI_CopyPastePositionOp.h" + +#include "HYDROGUI_DataModel.h" +#include "HYDROGUI_Module.h" +#include "HYDROGUI_UpdateFlags.h" + +#include + +#include +#include + +HYDROGUI_CopyPastePositionOp::HYDROGUI_CopyPastePositionOp( HYDROGUI_Module* theModule, + const bool theIsPaste ) +: HYDROGUI_Operation( theModule ), + myIsPaste( theIsPaste ) +{ + setName( tr( "COPY_PASTE_VIEW_POSITION" ) ); +} + +HYDROGUI_CopyPastePositionOp::~HYDROGUI_CopyPastePositionOp() +{ +} + +void HYDROGUI_CopyPastePositionOp::startOperation() +{ + HYDROGUI_Operation::startOperation(); + + HYDROGUI_DataModel* aModel = module()->getDataModel(); + + if( !myIsPaste ) + { + QClipboard* aClBoard = QApplication::clipboard(); + + + gp_Pnt aPoint( 100, 100, 0 ); + QString aResult = tr( "%1,%2" ).arg( aPoint.X() ).arg( aPoint.Y() ); + if ( !aResult.isEmpty() ) { + aClBoard->clear(); + QApplication::clipboard()->setText( aResult ); + } + } + else + { + } + commit(); +} diff --git a/src/HYDROGUI/HYDROGUI_CopyPastePositionOp.h b/src/HYDROGUI/HYDROGUI_CopyPastePositionOp.h new file mode 100644 index 00000000..fe6c6426 --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_CopyPastePositionOp.h @@ -0,0 +1,43 @@ +// Copyright (C) 2007-2013 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 HYDROGUI_COPYPASTEPOSITIONOP_H +#define HYDROGUI_COPYPASTEPOSITIONOP_H + +#include "HYDROGUI_Operation.h" + +class HYDROGUI_CopyPastePositionOp : public HYDROGUI_Operation +{ + Q_OBJECT + +public: + HYDROGUI_CopyPastePositionOp( HYDROGUI_Module* theModule, const bool theIsPaste ); + virtual ~HYDROGUI_CopyPastePositionOp(); + +protected: + virtual void startOperation(); + +private: + bool myIsPaste; +}; + +#endif diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index c8da5e4d..ea883c19 100644 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -654,6 +654,10 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient, theMenu->addAction( action( HideAllId ) ); theMenu->addSeparator(); } + if ( anIsOCCView ) { + theMenu->addSeparator(); + theMenu->addAction( action( CopyViewerPositionId ) ); + } } void HYDROGUI_Module::update( const int flags ) diff --git a/src/HYDROGUI/HYDROGUI_Operations.cxx b/src/HYDROGUI/HYDROGUI_Operations.cxx index d2a7d3f4..768781b1 100644 --- a/src/HYDROGUI/HYDROGUI_Operations.cxx +++ b/src/HYDROGUI/HYDROGUI_Operations.cxx @@ -26,6 +26,7 @@ #include "HYDROGUI_CalculationOp.h" #include "HYDROGUI_ChannelOp.h" #include "HYDROGUI_DataModel.h" +#include "HYDROGUI_CopyPastePositionOp.h" #include "HYDROGUI_DeleteOp.h" #include "HYDROGUI_DigueOp.h" #include "HYDROGUI_ExportImageOp.h" @@ -161,6 +162,8 @@ void HYDROGUI_Module::createActions() createAction( SplitImageId, "SPLIT_IMAGE", "SPLIT_IMAGE_ICO" ); createAction( EditSplittedImageId, "EDIT_SPLITTED_IMAGE", "EDIT_SPLITTED_IMAGE_ICO" ); + createAction( CopyViewerPositionId, "COPY_VIEWER_POSITION", "" ); + createAction( DeleteId, "DELETE", "", Qt::Key_Delete, false, SLOT( onDelete() ) ); @@ -477,6 +480,9 @@ LightApp_Operation* HYDROGUI_Module::createOperation( const int theId ) const anOp = new HYDROGUI_ImportGeomObjectOp( aModule, HYDROGUI_ImportGeomObjectOp::ImportCreatedAsObstacle, GEOMOp::OpCylinder ); break; + case CopyViewerPositionId: + anOp = new HYDROGUI_CopyPastePositionOp( aModule, false ); + break; case DeleteId: anOp = new HYDROGUI_DeleteOp( aModule ); break; diff --git a/src/HYDROGUI/HYDROGUI_Operations.h b/src/HYDROGUI/HYDROGUI_Operations.h index e4964dc3..a376f7b6 100644 --- a/src/HYDROGUI/HYDROGUI_Operations.h +++ b/src/HYDROGUI/HYDROGUI_Operations.h @@ -92,6 +92,8 @@ enum OperationId CreateBoxId, CreateCylinderId, + CopyViewerPositionId, + DeleteId, ShowId, diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts index 215eb775..9882e9b6 100644 --- a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts +++ b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts @@ -315,6 +315,14 @@ All supported formats (*.brep *.iges *.igs *.step *.stp) + + HYDROGUI_CopyPastePositionOp + + COPY_PASTE_VIEW_POSITION + Copy/paste view position + + + HYDROGUI_DeleteOp @@ -667,6 +675,10 @@ Would you like to remove all references from the image? DSK_EDIT_SPLITTED_IMAGE Edit splitted image + + DSK_COPY_VIEWER_POSITION + Copy position + DSK_EXPORT_IMAGE Export image @@ -899,6 +911,10 @@ Would you like to remove all references from the image? MEN_EDIT_SPLITTED_IMAGE Edit splitted image + + MEN_COPY_VIEWER_POSITION + Copy position + MEN_EXPORT_IMAGE Export image @@ -1111,6 +1127,10 @@ Would you like to remove all references from the image? STB_EDIT_SPLITTED_IMAGE Edit splitted image + + STB_COPY_VIEWER_POSITION + Copy position + STB_EXPORT_IMAGE Export image