Salome HOME
Merge branch 'occ/shaper2smesh'
[modules/gui.git] / src / GLViewer / GLViewer_Viewer2d.cxx
index b91b6248a06ee626798685744e943e25b998d576..9438c066c4da1fb49b4b57d9f350a321276feaeb 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2019  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
@@ -731,7 +731,7 @@ bool GLViewer_Viewer2d::translateTo( VectorFileType aType, QString FileName, Pap
     if ( !getActiveView() )
       return false;
 
-        QFile hFile( FileName.toLatin1() );
+        QFile hFile( FileName.toUtf8() );
 
 #ifdef WIN32
     HDC hMetaFileDC;
@@ -793,7 +793,20 @@ bool GLViewer_Viewer2d::translateTo( VectorFileType aType, QString FileName, Pap
         HDC screen_dc = GetDC( 0 ); //The screen device context
         HDC bitDC = CreateCompatibleDC ( screen_dc ); //The context compatible with screen
 
-        hMetaFileDC = CreateEnhMetaFile( bitDC, FileName.toLatin1().data(), &r, "" );
+#ifdef UNICODE
+       LPTSTR str = new TCHAR[FileName.length() + 1];
+       str[FileName.toWCharArray(str)] = '\0';
+       LPTSTR empty = L"";
+#else  
+       QByteArray arr = FileName.toLatin1();
+       LPTSTR str = arr.constData();
+       LPTSTR empty = "";
+#endif
+
+        hMetaFileDC = CreateEnhMetaFile( bitDC, str, &r, empty );
+#ifdef UNICODE
+       delete str;
+#endif 
         SetMapMode( hMetaFileDC, MM_HIMETRIC );
         SetWindowOrgEx( hMetaFileDC, 0, r.bottom, NULL );
         HRGN ClipRgn = CreateRectRgn( 0, 0, AW, AH );
@@ -808,7 +821,7 @@ bool GLViewer_Viewer2d::translateTo( VectorFileType aType, QString FileName, Pap
         ReleaseDC( 0, screen_dc );
         DeleteDC( bitDC );
 
-        aCurVP->getGLWidget()->translateBackgroundToEMF( hMetaFileDC, &aViewerCS, &aPaperCS );
+        aCurVP->getGLWidget()->translateBackgroundToEMF( hMetaFileDC, &aViewerCS, &aPaperCS ); 
     }
 #endif