]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Copy/paste view position.
authornds <nds@opencascade.com>
Thu, 26 Dec 2013 06:51:12 +0000 (06:51 +0000)
committernds <nds@opencascade.com>
Thu, 26 Dec 2013 06:51:12 +0000 (06:51 +0000)
src/HYDROGUI/CMakeLists.txt
src/HYDROGUI/HYDROGUI_CopyPastePositionOp.cxx [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_CopyPastePositionOp.h [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/HYDROGUI_Operations.cxx
src/HYDROGUI/HYDROGUI_Operations.h
src/HYDROGUI/resources/HYDROGUI_msg_en.ts

index 64cbc1d831d5bb931f7223d167ed86ea56f9ec91..a9100150a296c39530a63b060c6e1168de91cb34 100644 (file)
@@ -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 (file)
index 0000000..c959cf5
--- /dev/null
@@ -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 <gp_Pnt.hxx>
+
+#include <QApplication>
+#include <QClipboard>
+
+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 (file)
index 0000000..fe6c642
--- /dev/null
@@ -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
index c8da5e4d08c7e7451192408b1e43091dee9d5b36..ea883c19cd8fece6b7c1e179426dfe52f26b81c3 100644 (file)
@@ -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 )
index d2a7d3f42c665707dd0988b5a77939f3066202db..768781b1229b2b9cc8972e4b73b62d52ab970f02 100644 (file)
@@ -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;
index e4964dc3532272dd0bd87a946523c77b4be422fa..a376f7b64a72821d22b16a10966867f279ab78cf 100644 (file)
@@ -92,6 +92,8 @@ enum OperationId
   CreateBoxId,
   CreateCylinderId,
 
+  CopyViewerPositionId,
+
   DeleteId,
 
   ShowId,
index 215eb77583b6dc598b7f996a667e0d5233a55385..9882e9b6f9e67d8931765745fdd267e8ce68e6c2 100644 (file)
@@ -315,6 +315,14 @@ All supported formats (*.brep *.iges *.igs *.step *.stp)</translation>
     </message>
   </context>
 
+  <context>
+    <name>HYDROGUI_CopyPastePositionOp</name>
+    <message>
+      <source>COPY_PASTE_VIEW_POSITION</source>
+      <translation>Copy/paste view position</translation>
+    </message>
+  </context>
+
   <context>
     <name>HYDROGUI_DeleteOp</name>
     <message>
@@ -667,6 +675,10 @@ Would you like to remove all references from the image?</translation>
       <source>DSK_EDIT_SPLITTED_IMAGE</source>
       <translation>Edit splitted image</translation>
     </message>
+    <message>
+      <source>DSK_COPY_VIEWER_POSITION</source>
+      <translation>Copy position</translation>
+    </message>
     <message>
       <source>DSK_EXPORT_IMAGE</source>
       <translation>Export image</translation>
@@ -899,6 +911,10 @@ Would you like to remove all references from the image?</translation>
       <source>MEN_EDIT_SPLITTED_IMAGE</source>
       <translation>Edit splitted image</translation>
     </message>
+    <message>
+      <source>MEN_COPY_VIEWER_POSITION</source>
+      <translation>Copy position</translation>
+    </message>
     <message>
       <source>MEN_EXPORT_IMAGE</source>
       <translation>Export image</translation>
@@ -1111,6 +1127,10 @@ Would you like to remove all references from the image?</translation>
       <source>STB_EDIT_SPLITTED_IMAGE</source>
       <translation>Edit splitted image</translation>
     </message>
+    <message>
+      <source>STB_COPY_VIEWER_POSITION</source>
+      <translation>Copy position</translation>
+    </message>
     <message>
       <source>STB_EXPORT_IMAGE</source>
       <translation>Export image</translation>