Salome HOME
Updated copyright comment
[modules/gui.git] / src / GLViewer / GLViewer_BaseObjects.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 86112cb..013270f
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -212,7 +212,7 @@ bool GLViewer_MarkerSet::translateToPS( QFile& hFile, GLViewer_CoordSystem* aVie
     }
     aBuffer+="closepath\nstroke\n";
 
-    hFile.write( aBuffer.toAscii() );
+    hFile.write( aBuffer.toLatin1() );
 
     return true;
 }
@@ -250,7 +250,7 @@ bool GLViewer_MarkerSet::translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aV
         }
         aBuffer+="PU;\n";
 
-        hFile.write( aBuffer.toAscii() );
+        hFile.write( aBuffer.toLatin1() );
     }
 
     return true;
@@ -370,12 +370,12 @@ GLboolean GLViewer_MarkerSet::highlight( GLfloat x, GLfloat y, GLfloat tol, GLbo
     if ( ( isCircle && ( xdist * xdist + ydist * ydist <= myMarkerSize * myMarkerSize ) ) ||
          ( !isCircle && ( fabs( xdist ) <= radius && fabs( ydist ) <= radius ) ) )
     {
-      isFound = FALSE;
+      isFound = false;
       count++;
       for ( it = myCurSelNumbers.begin(); it != myCurSelNumbers.end(); ++it )
         if( i == *it )
         {
-          isFound = TRUE;
+          isFound = true;
           curHNumbers.append( i );
         }
       
@@ -422,7 +422,7 @@ GLboolean GLViewer_MarkerSet::unhighlight()
   \param isCircle - true if sensitive area of detection is round
   \param isShift  - true if selection exec with append option
 */
-GLboolean GLViewer_MarkerSet::select( GLfloat x, GLfloat y, GLfloat tol, GLViewer_Rect rect, GLboolean isFull,
+GLboolean GLViewer_MarkerSet::select( GLfloat x, GLfloat y, GLfloat tol, GLViewer_Rect /*rect*/, GLboolean /*isFull*/,
                                       GLboolean isCircle, GLboolean isShift )
 {
     if( !myIsVisible )
@@ -462,13 +462,13 @@ GLboolean GLViewer_MarkerSet::select( GLfloat x, GLfloat y, GLfloat tol, GLViewe
       count++;
       if ( isShift )
       {
-        bool isFound = FALSE;
+        bool isFound = false;
           for( it = mySelNumbers.begin(); it != mySelNumbers.end(); ++it )
             if ( *it == i )
             {
               myUSelNumbers.append( *it );
             remIt = it;
-              isFound = TRUE;
+              isFound = true;
               break;
             }
 
@@ -651,7 +651,7 @@ void GLViewer_MarkerSet::exportNumbers( QList<int>& highlight,
 bool GLViewer_MarkerSet::addOrRemoveSelected( int index )
 {
   if( index < 0 || index > myNumber )
-    return FALSE;
+    return false;
 
   int n = mySelNumbers.indexOf( index );
   if( n == -1 )
@@ -661,7 +661,7 @@ bool GLViewer_MarkerSet::addOrRemoveSelected( int index )
     mySelNumbers.removeAt(n);
     myUSelNumbers.append( index );
   }
-  return TRUE;
+  return true;
 }
 
 /*!
@@ -814,11 +814,11 @@ bool GLViewer_MarkerSet::initializeFromByteCopy( QByteArray theArray )
   \param size - size of polyline
   \param toolTip - tool tip of polyline
 */
-GLViewer_Polyline::GLViewer_Polyline( int number, float size, const QString& toolTip ):
+GLViewer_Polyline::GLViewer_Polyline( int number, float /*size*/, const QString& toolTip ):
   GLViewer_Object(),
-  myNumber( 0 ),
   myXCoord( 0 ),
-  myYCoord( 0 )       
+  myYCoord( 0 ),
+  myNumber( 0 )
 {
   myHighFlag = GL_TRUE;
 
@@ -869,7 +869,7 @@ bool GLViewer_Polyline::translateToPS( QFile& hFile, GLViewer_CoordSystem* aView
 
     aBuffer+="closepath\nstroke\n";
     
-    hFile.write( aBuffer.toAscii() );
+    hFile.write( aBuffer.toLatin1() );
 
     return true;
 }
@@ -895,7 +895,7 @@ bool GLViewer_Polyline::translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aVi
 
     aBuffer+="PU;\n";
     
-    hFile.write( aBuffer.toAscii() );
+    hFile.write( aBuffer.toLatin1() );
 
     return true;
 }
@@ -1004,7 +1004,7 @@ GLViewer_Drawer* GLViewer_Polyline::createDrawer()
   \param isCircle - true if sensitive area of detection is round
   \return true if highlight status is changed
 */
-GLboolean GLViewer_Polyline::highlight( GLfloat x, GLfloat y, GLfloat tol, GLboolean isCircle )
+GLboolean GLViewer_Polyline::highlight( GLfloat x, GLfloat y, GLfloat /*tol*/, GLboolean /*isCircle*/ )
 {
     if( !myIsVisible )
         return false;
@@ -1088,15 +1088,15 @@ GLboolean GLViewer_Polyline::unhighlight()
   \param isCircle - true if sensitive area of detection is round
   \param isShift  - true if selection exec with append option
 */
-GLboolean GLViewer_Polyline::select( GLfloat x, GLfloat y, GLfloat tol, GLViewer_Rect rect, GLboolean isFull,
-                                     GLboolean isCircle, GLboolean isShift )
+GLboolean GLViewer_Polyline::select( GLfloat x, GLfloat y, GLfloat /*tol*/, GLViewer_Rect /*rect*/, GLboolean /*isFull*/,
+                                     GLboolean /*isCircle*/, GLboolean /*isShift*/ )
 {
     if( !myIsVisible )
         return false;
     GLfloat xa, xb, ya, yb, l;
     GLfloat rsin, rcos, r, ra, rb;
     // GLboolean update;
-    GLboolean selected = myIsSel;
+    // GLboolean selected = myIsSel;
 
     myIsSel = GL_FALSE;
 
@@ -1394,7 +1394,7 @@ bool GLViewer_TextObject::translateToPS( QFile& hFile, GLViewer_CoordSystem* aVi
     AddCoordsToPS( aBuffer, "moveto", aViewerCS, aPSCS, double(xPos), double(yPos) );
     aBuffer += "(" + aText + ") show\n";
 
-    hFile.write( aBuffer.toAscii() );
+    hFile.write( aBuffer.toLatin1() );
 
     return true;
 }
@@ -1416,7 +1416,7 @@ bool GLViewer_TextObject::translateToHPGL( QFile& hFile, GLViewer_CoordSystem* a
     
     aBuffer = "LB" + aText + "#;";
     
-    hFile.write( aBuffer.toAscii() );
+    hFile.write( aBuffer.toLatin1() );
 
     return true;
 }
@@ -1438,16 +1438,15 @@ bool GLViewer_TextObject::translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerC
            y = double( yPos );
 
     aViewerCS->transform( *aEMFCS, x, y );
-    const char* str = aText.toAscii();
 
     int nHeight = 35*14;       // height of font
     int nWidth = 35*12;        // average character width
     int nEscapement = 0;       // angle of escapement
     int nOrientation = 0;      // base-line orientation angle
     int fnWeight = FW_NORMAL;  // font weight
-    DWORD fdwItalic = FALSE;    // italic attribute option
-    DWORD fdwUnderline = FALSE; // underline attribute option
-    DWORD fdwStrikeOut = FALSE; // strikeout attribute option
+    DWORD fdwItalic = false;    // italic attribute option
+    DWORD fdwUnderline = false; // underline attribute option
+    DWORD fdwStrikeOut = false; // strikeout attribute option
     DWORD fdwCharSet = ANSI_CHARSET; // character set identifier
     DWORD fdwOutputPrecision = OUT_DEFAULT_PRECIS;  // output precision
     DWORD fdwClipPrecision = CLIP_DEFAULT_PRECIS;    // clipping precision
@@ -1466,8 +1465,17 @@ bool GLViewer_TextObject::translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerC
 
     HGDIOBJ old1 = SelectObject( dc, aFont );
     HGDIOBJ old2 = SelectObject( dc, aBrush );
-
+#ifdef UNICODE
+       LPTSTR str = new TCHAR[aText.length() + 1];
+       str[aText.toWCharArray(str)] = '\0';
+#else  
+       QByteArray arr = FileName.toLatin1();
+       LPTSTR str = arr.constData();
+#endif
     TextOut( dc, x, y, str, aText.length() );
+#ifdef UNICODE
+        delete str;
+#endif
 
     SelectObject ( dc, old1 );
     SelectObject ( dc, old2 );
@@ -1573,9 +1581,9 @@ GLboolean GLViewer_TextObject::highlight( GLfloat theX, GLfloat theY, GLfloat th
     QRegion circle( (int)(theX - theTol), (int)(theY - theTol),
                       (int)(2 * theTol), (int)(2 * theTol), QRegion::Ellipse );
     if( isCircle )
-        intersection = obj.intersect( circle );
+        intersection = obj.intersected( circle );
     else
-        intersection = obj.intersect( region );
+        intersection = obj.intersected( region );
     
     if( intersection.isEmpty() )
         myIsHigh = false;
@@ -1613,8 +1621,8 @@ GLboolean GLViewer_TextObject::unhighlight()
   \param isCircle - true if sensitive area of detection is round
   \param isShift  - true if selection exec with append option
 */
-GLboolean GLViewer_TextObject::select( GLfloat theX, GLfloat theY, GLfloat theTol, GLViewer_Rect rect,
-                                       GLboolean isFull, GLboolean isCircle, GLboolean isShift )
+GLboolean GLViewer_TextObject::select( GLfloat theX, GLfloat theY, GLfloat theTol, GLViewer_Rect /*rect*/,
+                                       GLboolean /*isFull*/, GLboolean isCircle, GLboolean /*isShift*/ )
 { 
     if( !myIsVisible )
         return false;
@@ -1631,9 +1639,9 @@ GLboolean GLViewer_TextObject::select( GLfloat theX, GLfloat theY, GLfloat theTo
     QRegion circle( (int)(theX - theTol), (int)(theY - theTol),
                       (int)(2 * theTol), (int)(2 * theTol), QRegion::Ellipse );
     if( isCircle )
-        intersection = obj.intersect( circle );
+        intersection = obj.intersected( circle );
     else
-        intersection = obj.intersect( region );
+        intersection = obj.intersected( region );
     
     if( intersection.isEmpty() )
         myIsSel = false;