Salome HOME
refs #416: to store the open state of object browser items in the binary array
[modules/gui.git] / src / SVTK / SVTK_SpaceMouse.cxx
index bc73352fa9da79ecace47fed4becb67f8a8e181b..a2ace80c4869a4b49126991a87bacf7140e0c809 100644 (file)
@@ -1,40 +1,40 @@
-//  SALOME VTKViewer : build VTK viewer into Salome desktop
+// Copyright (C) 2007-2014  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, or (at your option) any later version.
 //
-//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+// 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
 //
+
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
 //  File   : SVTK_SpaceMouse.cxx
 //  Author : Alexander SLADKOV
-//  Module : SALOME
-//  $Header$
 
 #include <string.h>
 #include <math.h>
 #include <stdio.h>
 
+#ifndef WIN32
 #include <X11/X.h>
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 #include <X11/Xatom.h>
 #include <X11/keysym.h>
+#endif
 
 #include "SVTK_SpaceMouse.h"
 
@@ -55,10 +55,14 @@ SVTK_SpaceMouse* SVTK_SpaceMouse::getInstance()
 */
 SVTK_SpaceMouse::SVTK_SpaceMouse()
 {
+#ifndef WIN32
   win = InputFocus;
+#endif
   spaceMouseOn = 0;
 }
 
+#ifndef WIN32
+
 /*!
   Initialization
 */
@@ -115,8 +119,8 @@ int SVTK_SpaceMouse::setWindow( Display *display, Window window )
 
   PropReturn = NULL;
   XGetWindowProperty( display, root, XCommandEvent, 0,1, 0,
-                     AnyPropertyType, &type, &format, &NItems,
-                     &BytesReturn, &PropReturn );
+                      AnyPropertyType, &type, &format, &NItems,
+                      &BytesReturn, &PropReturn );
 
   win = InputFocus;
   if ( PropReturn != NULL ) {
@@ -167,7 +171,7 @@ int SVTK_SpaceMouse::close(Display *display)
   Custom event handler
 */
 int SVTK_SpaceMouse::translateEvent( Display* display, XEvent* xEvent, MoveEvent* spaceMouseEvent,
-                   double scale, double rScale )
+                    double scale, double rScale )
 {
   if ( !spaceMouseOn )
     return 0;
@@ -176,17 +180,17 @@ int SVTK_SpaceMouse::translateEvent( Display* display, XEvent* xEvent, MoveEvent
     if ( xEvent->xclient.message_type == XMotionEvent ) {
       spaceMouseEvent->type = SpaceMouseMove;
       spaceMouseEvent->data[ x ] =
-       xEvent->xclient.data.s[2] * scale;
+        xEvent->xclient.data.s[2] * scale;
       spaceMouseEvent->data[ y ] =
-       xEvent->xclient.data.s[3] * scale;
+        xEvent->xclient.data.s[3] * scale;
       spaceMouseEvent->data[ z ] =
-       xEvent->xclient.data.s[4] * scale;
+        xEvent->xclient.data.s[4] * scale;
       spaceMouseEvent->data[ a ] =
-       xEvent->xclient.data.s[5] * rScale;
+        xEvent->xclient.data.s[5] * rScale;
       spaceMouseEvent->data[ b ] =
-       xEvent->xclient.data.s[6] * rScale;
+        xEvent->xclient.data.s[6] * rScale;
       spaceMouseEvent->data[ c ] =
-       xEvent->xclient.data.s[7] * rScale;
+        xEvent->xclient.data.s[7] * rScale;
       spaceMouseEvent->period = xEvent->xclient.data.s[8];
       return 1;
     }
@@ -204,3 +208,4 @@ int SVTK_SpaceMouse::translateEvent( Display* display, XEvent* xEvent, MoveEvent
   return (!display);
 }
 
+#endif